Comments (4)
This already exists as FORMS_BUILDER_USE_HTML5 - please consult the readme.
from django-forms-builder.
@stephenmcd I've read the README several times and tried setting the FORMS_BUILDER_USE_HTML5 to both False and True, but I can't seem to get the Django date and datetime widgets. ?
from django-forms-builder.
Ok a little background on this - the correct Django date and datetime widgets are certainly being used when FORMS_BUILDER_USE_HTML5 is set to False. What you will find however is that the default widgets for these are simply text inputs - take a look in the Django source at django.forms.widgets.DateInput and django.forms.widgets.TimeInput.
Now there is a widget in Django that isn't the default for the DateField but is slightly better than the default. That widget is django.forms.extras.SelectDateWidget which gives you 3 select menus for day month and year. Now if you take a look in forms_build.forms.fields, you'll see a structure that defines which custom widgets to use when FORMS_BUILDER_USE_HTML5 is set to False. Here you'll find SelectDateWidget defined for date fields, but nothing defined for datetime fields as from what I know there isn't a better non-default widget for date time fields in Django as there is with date fields.
You may be comparing this to the widgets used in Django's admin interface - I haven't gone through the code in django.contrib.admin to confirm this, but I suspect these are implemented with Javascript on top of some hidden input fields, and aren't implemented by actual widget classes.
So in conclusion, with FORMS_BUILDER_USE_HTML5 set to False you should get a more usable widget for date fields, and datetime fields will still contain a text input, all based on what's available in Django.
If you'd like to go ahead and implement some enhanced widget classes for these without any Javascript required, I'd be happy to merge them in as I agree that the widgets that Django provides certainly leave room for improvement.
from django-forms-builder.
You're probably right. Too be honest, I haven't really looked much at the Django source code.
The reason I brought this up was that I was expecting the Admin widgets of date and datetime (with the JS stuff) to show up when I set FORMS_BUILDER_USE_HTML5 to false. After you're explanation it's clear that that isn't something you get out of the box.
It's possible to get the admin data/datetime JS widgets on your own forms:
http://stackoverflow.com/questions/38601/using-django-time-date-widgets-in-custom-form
Would be useful if this could be built-in.
from django-forms-builder.
Related Issues (20)
- Add option to limit number of submissions for a form HOT 1
- Date and time
- Initial Values feed HOT 2
- render_to_response is deprecated in higher Django versions from 1.9 onwards HOT 1
- Field slug is failing with +100 chars labels HOT 2
- Option for JSON-formatted choices, to allow divergence between submitted values and displayed choices
- request.user.is_authenticated is no longer a method
- Pypi update HOT 1
- Update Soon HOT 2
- New version and pip package.
- is there a working version for django 1.11? HOT 1
- How use the submitted form information in submission confirmation message?
- FORMS_BUILDER_LABEL_MAX_LENGTH affects nothing
- What the purpose of the package ?
- admin_links not displaying as links, need mark_safe
- 'bool' object is not callable HOT 2
- Maintenance of package HOT 5
- Compatible with django 3.1 version? HOT 1
- This project needs a maintainer HOT 3
- integration with django cms
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-forms-builder.