Koen de
Hi I have a ModelForm that I've added an extra CharField to it . This CharField is not a field of my model. I just want to use its value. When im calling form.save(commit=False), i get an attribute error that tells me my model has no attribute to my CharField. Is there any solution?
You might want to override the save method in your model like ; https://ilovedjango.com/django/models-and-databases/override-save-method-django-models/ Or the ModelForm https://www.djangotricks.com/tricks/Swv44PDSrJYQ/
Krishna
def update_view(request,id): sevekari = Sevekari.objects.get(no=id) if request.method == 'POST': formobj = SevekariForm(request.POST,instance=sevekari) if formobj.is_valid(): formobj.save() return redirect ('/sevekari') return render(request,'moralapp/update.html',{'sevekari':sevekari})
Krishna
Can anyone help here...update record is not working for me
Doragonsureiyā
Can anyone help here...update record is not working for me
If you need help, don't just say "not working", explain in detail what's not working the way you expect it to
Krishna
If condition is not passing i guess...is there any other way to define if statement?
Krishna
Try to include redirect inside if condition. I guess therefore it is not being updated
If condition itself failing...object seems ok..not sure why
Krishna
Change below, Sevakari.objects.get(id=id)
Its resolved....forms.py was arranged with all fields and that worked for me...instead of all fields ..i have listed down one by one
Maksim
Hi! Have a difference between 1 (u.password = password, u.save()) 2 (u.set_password(password), u.save()) in u = User.objects.get(name=name)?
Doragonsureiyā
Okey wait
Rule 5️⃣: Never post walls of text or screen photos. Use paste bins like https://linkode.org, https://nekobin.com (or your favorite one)
Masoud
hi when use rabbit in django i have this error :amqp.exceptions.AccessRefused: (0, 0): (403) ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
yusof
hey i have file field and it gets audio. i wanna save audio duration in another field? any idea how to do that ? thanks
𝔸𝕣𝕞𝕒𝕟 ֍
Hi guys, what you need to know, to start learning Django?? Like mySQL
Maksim
English language and basic knowledge MySQL, Python
Holla
http://linkode.org/#QTxqVkSXSwASckBDXbYCR1
Dave
updated addes the urls.py code
Have you also register or included in your main project's urls.py the urls.py from app?
Holla
yes i did f
Holla
from django.urls import path,include
Holla
path('',include('events.urls')),
Dave
path('',include('events.urls')),
Oh I see. Try to put a kwarg name in the url pattern where it requires a kwarg year and month [path('',views.home,name="home"), path('<int:year>/<str:month>/',views.home, name="home")]
Holla
you mean i should **kwargs to the function
Dave
you mean i should **kwargs to the function
Its not like that. The kwargs I said is name kwarg in path function in urls.py. Try adding a name kwarg in it with value if home. The you error you encounter NoReverseMatch commonly shows when your app can't find a url with a name kwarg in path function.
Holla
ok
Holla
http://127.0.0.1:8000/may/2022 this gived me page not found
Dave
http://127.0.0.1:8000/may/2022 this gived me page not found
Remove the name kwarg on the url pattern "".
Holla
did still page not found
Dave
If you can, can you also add the views.py with home function.
Holla
<a class="nav-link" href="{% url 'home' '2022' 'March'%}">March</a> i think its expecting something from here
Holla
i think i should go back to the tutorial and watch it agian
Holla
thanks for the help will dave
Dave
thanks for the help will dave
No problem, just rewatch and read the official guide of Django's documentation. Come back here to ask again if any problem occurs.
Holla
ok thanks
Anonymous
How to connect Django with React
Anonymous
1)Babel+Webpack+Django+React Or 2)npx create react app(local host 3000) python manage.py runserver (local host 8000)
Anonymous
Which one is better
Maxim
1)Babel+Webpack+Django+React Or 2)npx create react app(local host 3000) python manage.py runserver (local host 8000)
you have to decide for yourself based on the specifics of your project or personal preferences or whatever you find more convenient
Maxim
Thanks, but I want to know which way is more widely used
this is a very strange criterion for choosing as if the parents are not teaching the child their own language, but the most common language in the world
S
this is a very strange criterion for choosing as if the parents are not teaching the child their own language, but the most common language in the world
he is asking a legit qs. If u dnt know about that, dont say. This a tech group - not some philosophical blasphemy. Let ppl discuss about pros & cons of both approach !
Maxim
he is asking a legit qs. If u dnt know about that, dont say. This a tech group - not some philosophical blasphemy. Let ppl discuss about pros & cons of both approach !
maybe you didn't notice, but his question is not technical it's a question of choosing between two approaches, each of which is applicable and more relevant to different situations, which is what my answer reflects using statistics to make choices where more relevant criteria should be used is silly, which is what i reported have a nice day
S
1)Babel+Webpack+Django+React Or 2)npx create react app(local host 3000) python manage.py runserver (local host 8000)
When u say better, do u mean performancewise or implementation wise or scalabilitywise ?
Anonymous
example performance
Maxim
example performance
server-side or client-side performance ?
S
both
Well in that case, I hv seen approach 2 being followed more by teams that I hv worked with. Although that doesn't necessarily make approach 2 to be "better". But u get what I'm saying right ?
MRT
hey guys, how i can use django orm with one connection in multiple thread ?
Zunair
Can we use django default admin panel after deploy
Andrej
Thanks
The admin panel is a plugin like everyone else. When it is included you will have access to it. It's a nice way to manage your data on the production system.
Zunair
Sinan
👋 hi friends how to give user permission on specify fields of model only i.e Field Level Permission Django
Sinan
By using filter
please more details to do it
s@123
Is anyone a college student in this group from india, which has intermediate or advanced skills in (Django or react). I am interested in participating in upcoming hackathons but need a good team partner for participation.
theDisgrace
i am unable to send post/get request using axios to django. Axios says network error and i've tried all the solutions from stackoverflow
Zunair
please more details to do it
Search it from Stack overflow
Maksim
For SignUp and LoginUp use one form or twice?
Maxim
For SignUp and LoginUp use one form or twice?
by combining forms you (probably) reduce the amount of code, but make it harder to understand and maintain
Zunair
I will create django site on local server now I want to deploy in my hosting domain how I can deploy?
No
For registration I create an form In view when If form.is_valid(): Give a error. '<' can Everyone can help please
Krishna
Hi all, how to achieve search for records on django
Krishna
Requirement to take user input from html page
Doragonsureiyā
Hi all, how to achieve search for records on django
These single steps will help you a lot: Step 1️⃣: Open a browser Step 2️⃣: Write down https://google.com or https://duck.com and press Enter Step 3️⃣: In the search box, write down the same words you asked here Step 4️⃣: Read the first results
😅乛 𝐃𝐚𝐫𝐤𝐊𝐧𝐢𝐠𝐡𝐭 🚩™
A server error occurred. Please contact the administrator. How to fix this error