Михаил
Can someone help?
Hi, you will more likely find the answer in javascript related channels
Anonymous
How can I accept raw html form then save it to the backend
Михаил
How can I accept raw html form then save it to the backend
Check out django tutorial on forms, it's pretty helpful
Михаил
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Forms
Anonymous
How can i include tinymce text editor in my django app, i have set it to admin site it worked, but not in app. Tried this in forms.py from django import forms from .models import Post from django.db import models from tinymce.widgets import TinyMCE class AddPostForm(forms.ModelForm): class Meta: model = Post fields = ['author', 'title', 'created_date', 'published_date', 'content'] formfield_overrides = { models.TextField: {'widget': TinyMCE()}, }
Luis
https://django-tinymce.readthedocs.io/en/latest/usage.html#using-the-widget
Anonymous
What is better modelform or standard Django form?
Михаил
What is better modelform or standard Django form?
It's better to be aware of what you want to get done.
Anonymous
After creating a form my title field does not appear but the description field does.. what I mean is the Description : the box for description But in case of title there is just the box with a placeholder . So how can I fix that and bring back the title field?
Ильяс
How do i make a connection to a search field in html code?
cj
How do i make a connection to a search field in html code?
do you want to have a search field in a template, to show results from a model?
Ильяс
Yes, i have a dropdown field in template and i need it to give me choices from my db
cj
Yes, i have a dropdown field in template and i need it to give me choices from my db
and it has to change the options accordingly to what the user is writing?
Ильяс
No it should just dropdown list that i have in my db
cj
damn... my "reading mind" skills are not good enough ☹️
Ильяс
and from that i should choose
cj
No it should just dropdown list that i have in my db
then, you have a dropdown list, not a search input field 🤔 now I am confused
Ильяс
)))
Ильяс
It is a site for car sale
Ильяс
where you choose brand and a model
cj
where you choose brand and a model
and........ when you choose one brand, the dropdown of models, should change, right?
Ильяс
yes yes yes
Ильяс
)))
Ильяс
Yeah you are surely are getting lvlup)))
cj
one option is to use an endpoint to list brands and models (one endpoit for each model), use javascript to read data from that endpoint and fill the dropdowns with the corresponding options 🙂
Ильяс
i dont know js
Ильяс
i am a python intern)))
cj
another option: use ModelForms and re-render the template each time the dropdown changes its value (each time the user choose another brand)
Ильяс
i am using ModelChoiceField
Ильяс
but the problem is that i dont know how to connect that dropdown bar to my code
cj
i am using ModelChoiceField
well... you have to re-render the template each time the user changes the brand, so you can fill the model's dropdown the next time you render the template
Ильяс
Can you give me an example&
Ильяс
?
cj
but the problem is that i dont know how to connect that dropdown bar to my code
use URLs to catch the brand identifier so when you call your view again, you'll have it to show the corresponding models of that brand, and render the template again with the new values
cj
if you want my opinion, I'd rather go for the javascript approach
Ильяс
Can you give me a link to tutorial of that or an example
Ильяс
&
Ильяс
?
cj
Can you give me a link to tutorial of that or an example
IDK if there are any tutorials/examples, but it's not complicated if you are comfortable enough using URLs and Views...
cj
IDK if there are any tutorials/examples, but it's not complicated if you are comfortable enough using URLs and Views...
and your users don't care about the re-rendering blink they will see in the browser 🙂
Ильяс
mmmm
Ильяс
are there any libs for that?
Anonymous
hello, friend, can django model filtered by foreignkey ?
cj
are there any libs for that?
just bare Django... but if you want to explore the API + JS way, take a look to DRF (Django Rest Framework)
Ильяс
I was given a ready js css and html, i made models from bd and now i need to connect them i wrote all urls and else but i dont know how to connect it in html
Ильяс
No API
cj
can you write an example please?
ok, wait a bit 🙂
cj
can you write an example please?
https://gitlab.com/c0x6a/cars-brands-models
cj
here you have it, simple ASF
cj
Thank you
https://i.c0x6a.dev/56a074f7-ca45-4dd6-89e1-b9a591c53930.mp4 and here you can see it working
n
Can anybody know how to make bot or how to add bot in our webpage
inchidi
#article Do you already know what DEP is? Meet DEP, its like PEP but for Django https://github.com/django/deps/blob/master/final/0001-dep-process.rst#what-is-a-dep
inchidi
#article Django dynamic model field https://stackoverflow.com/a/7934577
inchidi
#article Profiling Django https://code.djangoproject.com/wiki/ProfilingDjango
inchidi
#article Full-Text Search in Django with PostgreSQL https://www.paulox.net/2017/12/22/full-text-search-in-django-with-postgresql/
inchidi
#article Django Projects Optimizations Guide https://dizballanze.com/django-project-optimization-part-1/ https://docs.djangoproject.com/en/2.2/topics/performance/
Ильяс
TypeError: __init__() missing 1 required positional argument: 'queryset'
Ильяс
marka_form = MarkaSearchForm(help_text='Marka', data=request.GET or None)
Ильяс
cant understand why i should type in queryset
Ильяс
?
Ильяс
Internal Server Error: / Traceback (most recent call last): File "/home/ilyas/Documents/Digital_Oracle/autos/shipping/venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/home/ilyas/Documents/Digital_Oracle/autos/shipping/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/home/ilyas/Documents/Digital_Oracle/autos/shipping/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/ilyas/Documents/Digital_Oracle/autos/shipping/venv/lib/python3.6/site-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, *args, **kwargs) File "/home/ilyas/Documents/Digital_Oracle/autos/shipping/venv/lib/python3.6/site-packages/django/views/generic/base.py", line 97, in dispatch return handler(request, *args, **kwargs) File "/home/ilyas/Documents/Digital_Oracle/autos/shipping/w8shipping/views.py", line 15, in get marka_form = MarkaSearchForm(help_text='Marka', data=request.GET or None) TypeError: __init__() missing 1 required positional argument: 'queryset' [06/Jun/2019 06:18:41] "GET / HTTP/1.1" 500 78571
inchidi
https://dpaste.de/CUYi
why do you override ModelChoiceField instead ModelForm there?
Ильяс
thanks
Ильяс
Could you tell how should i request my db so i can choose in a dropdown search field choices from db