acidjunk / crispy-forms-semanticui-templates Goto Github PK
View Code? Open in Web Editor NEWcrispy-forms-semanticUI-templates
License: GNU General Public License v3.0
crispy-forms-semanticUI-templates
License: GNU General Public License v3.0
pip package should be aligned with last version of Django/Crispy form.
Some form use formactions, resulting into:
django.template.exceptions.TemplateDoesNotExist: semantic-ui/layout/formactions.html
What license is the code released under?
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:
Am I missing a step, or do I need to manually add all Semantic classes in the forms.py
file?
Hi,
When I add this CRISPY_TEMPLATE_PACK = 'semantic-ui' to my settings I'm receiving this error:
I'm using semantic-ui in my project so I will try to help with this crispy forms semantic ui pack.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.