No TextInput-like form< no information render.
See original GitHub issueI used this guide to make autocomplete forms on my page.
My forms.py
driver=forms.ModelChoiceField(
queryset=Driver.objects.all(),
widget=autocomplete.ModelSelect2(url='dautoc')
)
class Meta:
model = Plan
fields = ('driver', )
widgets = {
}
urlpatterns
urlpatterns = [
url(r'^dautoc/$', DriverAutocomplete.as_view(), name="dautoc"),
]
views.py
def get_queryset(self):
if not self.request.user.is_authenticated():
return Driver.objects.none()
qs = Driver.objects.all()
if self.q:
qs = qs.filter(name__istartswith=self.q)
return qs
And it’s supposed to work fine, because it’s almost identical, but instead I don’t receive any results from my model’s db and more of that it’s Select-like instead of TextInput.
Any help or info is appreciated.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Django Form does not Render in web page - Stack Overflow
I am trying to create a post edit page in Django, but when I test it the form does not render, only the...
Read more >Custom Block Components | Draft.js
If no custom renderer object is returned by the blockRendererFn function, Editor will render the default EditorBlock text block component.
Read more >Basic native form controls - Learn web development | MDN
It is used for creating most types of form widgets including single line text fields, time and date controls, controls without text input...
Read more >How to Render Django Form Manually
Dealing with user input is a very common task in any Web application or Web site. The standard way to do it is...
Read more >Form Renderer - Form.io Documentation
Another way to alter the submission data construct is to use any of the Data Components within a form. These are special components...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The python warning is because you forgot to add default ordering in the Model I suppose.
If you have no js error, no select2, perhaps the js is not loaded at all ? Have you tried rendering {{ forms.media }} after loading jquery.js like in the documentation ?
It seems like your python is ok because the select is meant to be empty because it’s going to fetch results. Are you sure that javascript is loading correctly ? Does it work with runserver with DEBUG=True ? If you’re on a git checkout, have you initialized submodules ?