sveetch / crispy-forms-foundation Goto Github PK
View Code? Open in Web Editor NEWDjango application to add 'django-crispy-forms' layout objects for Foundation
Home Page: https://crispy-forms-foundation.readthedocs.io
License: MIT License
Django application to add 'django-crispy-forms' layout objects for Foundation
Home Page: https://crispy-forms-foundation.readthedocs.io
License: MIT License
Hi,
this commit:
78759aa#diff-1a77a0ef39514b22b57499cd39df30c1
had both row.html and column.html and it looks like they're missing in release 0.8.0. Could you please add those files and release it to PyPI? Thanks!
Actually, layout element like Submit or Button are builded as <input>
element. In those days where <button>
have real meaning and utility (it can have css pseudo elements, opposed to input element), it becomes required.
Hello !
Now I see list with errors on top the form/
I want see error as
<div class="large-6 columns error">
<label>Another Error
<input type="text">
</label>
<small class="error">Invalid entry</small>
</div>
and in field.strict.html I see similar to what I want. How to use it ?
Sorry for dump question.
I have encountered this same issue two times in Django 2.0 involving different package, this is the error.
Exception Value: not enough values to unpack (expected 2, got 0)
{% if not field|is_checkbox and not field|is_checkboxselectmultiple %}
{% crispy_field field %}
{% endif %}
thanks.
Please merge #43
Is the current version supporting / works with foundation v5 ?
Hey man,
this project ROCKS and thank you very much for sharing it,
I'm basing my next great web software on it.
What do you think about integrating this part http://foundation.zurb.com/docs/components/abide.html and do you have any ideas, how much work and where would this require?
I think I'd like to hack on support for native validation a bit.
Seems css classes are not correct with crispy 1.5.x, like Submit() that should be "submit button" but appears to be "btn btn-primary".
Some layout element have internal switch to fallback on some default value depending on used template pack.
Why did it work before and why it don't now ? Have to test on demo.
Errors should be rendered as in the foundation documentation (using with an error class).
I'm getting this error with
django-crispy-forms = "^2.0"
crispy-forms-foundation = "^0.9.0"
Traceback (most recent call last):
File "/app/tbxcodingtask/tracker/test/test_torchbox.py", line 16, in test_create_project
response = client.get(
^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/test/client.py", line 836, in get
response = super().get(path, data=data, secure=secure, **extra)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/test/client.py", line 424, in get
return self.generic(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/test/client.py", line 541, in generic
return self.request(**r)
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/test/client.py", line 810, in request
self.check_exception(response)
File "/usr/local/lib/python3.11/site-packages/django/test/client.py", line 663, in check_exception
raise exc_value
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 56, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
return view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 103, in view
return self.dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 142, in dispatch
return handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/views/generic/edit.py", line 180, in get
return super().get(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/views/generic/edit.py", line 144, in get
return self.render_to_response(self.get_context_data())
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/views/generic/edit.py", line 74, in get_context_data
kwargs["form"] = self.get_form()
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/views/generic/edit.py", line 39, in get_form
return form_class(**self.get_form_kwargs())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/tbxcodingtask/tracker/forms.py", line 14, in __init__
super(BaseTrackerForm, self).__init__(*args, **kwargs)
File "/usr/local/lib/python3.11/site-packages/crispy_forms_foundation/forms.py", line 193, in __init__
self.init_helper()
File "/usr/local/lib/python3.11/site-packages/crispy_forms_foundation/forms.py", line 112, in init_helper
if isinstance(self.fields[pointer[1]].widget,
because pointer
seems to be an object Pointer(positions=[1], name='title')
yes they introduced here: https://github.com/django-crispy-forms/django-crispy-forms/pull/1293/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
several test fail, for example
003_fields.py::test_fakefield
sequence item 1: expected str instance, BoundField found
We are using your project in our application and we are seriously planning to migrate our basecode to Python 3. Since django-crispy-templates
does support Python 3 at the moment, are you :
I am planning a patch to Python 3 but let me know if you are interested or not in it since I really don't plan to use Six and to maintain Python 2 support in this patch.
Including this https://github.com/sveetch/crispy-forms-foundation/blob/master/crispy_forms_foundation/templates/foundation-6/field.html#L19 means that overriding the template for any widget that uses this in forms.py has no effect.
Same issue as here:
django-crispy-forms/django-crispy-forms#834
And a solution to it:
django-crispy-forms/django-crispy-forms#836
Is Foundation 6 support being worked on?
I think the title is fairly self-explanatory - when you have data-abide set the form indiscriminately adds required="" even when the field should not have it, like when a FileField already has a file set (haven't tested it but this may need to be excluded for RadioSelects too, as you do here https://github.com/sveetch/crispy-forms-foundation/blob/master/crispy_forms_foundation/templatetags/crispy_forms_foundation_field.py#L77). I believe this needs to be fixed here https://github.com/sveetch/crispy-forms-foundation/blob/master/crispy_forms_foundation/forms.py#L70 but I can't see how we might access the form data at this point?
All made by manual but I get this error.
settings.py
INSTALLED_APPS = [
'flat', # django-flat-theme must be BEFORE contrib.admin
# Django apps
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.humanize',
'django.contrib.syndication',
'django.contrib.staticfiles',
# Third party apps
'compressor',
'crispy_forms',
'crispy_forms_foundation',
'django_extensions',
# Local apps
'base',
]
CRISPY_TEMPLATE_PACK = 'foundation-5'
Noticed that this does not support Django 1.11.
Update: I had issues getting the test suite to run locally. Happy to resolve this issue if you have any pointers?
I wanted to add a closable div to my crispy-form. Think of some html like:
<form>
<div class="something" id="close_div" data-closable>
<input type="button" name="close_button" value="Close" data-close>
</div>
...
</form>
I started with with following layout:
self.helper.layout = Layout(
Div(css_class="something", css_id="close_div", data_closable=""),
Button(name="close_button", value="Close", data-close=""),
...
)
But unfortunately data-closable
and data-close
are generated together with =""
as code handles them as any other flat_attrs
:
<form>
<div class="something" id="close_div" data-closable="">
<input type="button" name="close_button" value="Close" data-close="">
</div>
...
</form>
which does not work in foundation!
Suggestion:
Add keyword list_elements
(or something more intuitive) for simple list/tuple elements added to div, like:
Div(css_class="something", css_id="close_div", list_elements=["data-close"])
forms.py
class NameForm(forms.Form):
your_name = forms.CharField(label='Your name', max_length=100)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_action = 'POST'
views.py
'form': forms.NameForm(),
template
{% load crispy_forms_tags %}
{% crispy form %}
I get the error:
sequence item 1: expected str instance, BoundField found
site-packages/crispy_forms_foundation/templates/foundation-6/field.html, error at line 22
I'm using foundation 5. When I have non field errors in my forms an alert box appears. But I cannot to close it. I think this can be fixed by adding a "data-alert" attribute to the div with id errorMsg in these files:
crispy-forms-foundation/crispy_forms_foundation/templates/foundation/errors.html
crispy-forms-foundation/crispy_forms_foundation/templates/foundation/errors_formset.html
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.