Code Monkey home page Code Monkey logo

crispy-forms-semanticui-templates's People

Contributors

acidjunk avatar globophobe avatar rodmanning avatar tuvokki avatar zoidyzoidzoid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crispy-forms-semanticui-templates's Issues

Is there a trick to getting the Semantic UI classes in the forms?

I've saved this repo's files to templates/semantic-ui and added the following settings to settings.py:

CRISPY_TEMPLATE_PACK = 'semantic-ui'
CRISPY_ALLOWED_TEMPLATE_PACKS = ('semantic-ui')

My template has this code:

{% extends 'layouts/main.html' %}
{% load crispy_forms_tags %}

{% block content %}
<div class="ui main text container">
    {% crispy form %}
</div>
{% endblock %}

The form code is:

class ExampleForm(forms.Form):

    def __init__(self, *args, **kwargs):
        super(ExampleForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_id = 'someId'
        self.helper.form_class = 'some-class'
        self.helper.form_method = 'post'
        self.helper.form_action = 'sample_form_name'

        self.helper.add_input(Submit('submit', 'Submit'))

    like_website = forms.TypedChoiceField(
        label='Do you like this website?',
        choices=((1, 'Yes'), (0, 'No')),
        coerce=lambda x: bool(int(x)),
        widget=forms.RadioSelect,
        initial='1',
        required=True,
    )

    favorite_food = forms.CharField(
        label='What is your favorite food?',
        max_length=80,
        required=True,
    )

    favorite_color = forms.CharField(
        label='What is your favorite color?',
        max_length=80,
        required=True,
    )

    favorite_number = forms.IntegerField(
        label='Favorite number',
        required=False,
    )

    notes = forms.CharField(
        label='Additional notes or feedback',
        required=False,
    )

The view code is:

def sample_form(request):
    context = {'form': ExampleForm}

    return render(request, 'someform/someform_create.html', context)

But when I load the form, there aren't any semantic classes in the form:

crispy-semantic

Am I missing a step, or do I need to manually add all Semantic classes in the forms.py file?

Error when adding CRISPY_TEMPLATE_PACK = 'semantic-ui'

Hi,

When I add this CRISPY_TEMPLATE_PACK = 'semantic-ui' to my settings I'm receiving this error:

Exeption: crispy tag's template_pack argument should be in ('bootstrap', 'uni_form', 'bootstrap3', 'bootstrap4')

I'm using semantic-ui in my project so I will try to help with this crispy forms semantic ui pack.

pip installable Django app

The most important part is making sure we package all the templates like django-crispy-forms does: https://github.com/maraujop/django-crispy-forms/blob/dev/MANIFEST.in , and whatever else is needed to have it work from adding it to INSTALLED_APPS. I assume it'll just be moving it into crispy_semantic_ui/templates or something.

It might be worth changing the template folder to semantic_ui or something so it can match the Django app name, though crispy-semantic_ui or something similar might be more specific.

P.S.: I have a crispy form test project that I used for testing my templates when I worked on the Bootstrap 4 stuff. If I make the time to work on this, I'll add it there too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.