Django Bot
>> Links - NewbieMistakes – Django
sasuke
How to add json objects in a array using django forms..?
Anonymous
here
thank you 🌹
sasuke
mind to elaborate?
I got a field called items its is a jsonfield in model ..
sasuke
{1:{key :value},2:{key:value}...}
N S
modelformset factory can update multiple instances of a model right ??
inchidi
try add formset = studentformset(request.POST) after the if on line 163
inchidi
if its still not updating, add print(formset.errors) and see what wrong from you console
N S
The view student.views.Studentform_edit didn't return an HttpResponse object. It returned None instead. i got this error
N S
try add formset = studentformset(request.POST) after the if on line 163
The view student.views.Studentform_edit didn't return an HttpResponse object. It returned None instead. i got this error when doing that
N S
show me your current code
i solved that error indent mistake
N S
if its still not updating, add print(formset.errors) and see what wrong from you console
{'join': ['This field is required.'], 'regno': ['This field is required.'], 'sub2': ['This field is required.'], 'subcode5': ['This field is required.'], 'branch': ['This field is required.'], 'section': ['This field is required.'], 'subl1': ['This field is required.'], 'subl2': ['This field is required.'], 'subcodel1': ['This field is required.'], 'sub4': ['This field is required.'], 'id': ['This field is required.'], 'cursem': ['This field is required.'], 'subcode1': ['This field is required.'], 'sub1': ['This field is required.'], 'subcode2': ['This field is required.'], 'subcode3': ['This field is required.'], 'subcodel3': ['This field is required.'], 'subcodel2': ['This field is required.'], 'sub5': ['This field is required.'], 'subcode4': ['This field is required.'], 'sub6': ['This field is required.'], 'subcode6': ['This field is required.'], 'subcodel4': ['This field is required.'], 'sub3': ['This field is required.'], 'type': ['This field is required.']}]
N S
those are things you didnt provide, its pretty clear you should know what to do
Have a look at this on how instances are updated i did exactly like this
N S
They are just using the modelformset_factory instance to update each instance of the model
N S
Does modelformset_factory be able to update multiple records of a model?
inchidi
Does modelformset_factory be able to update multiple records of a model?
you already do this at line 165-167 but it never reach line 165 coz formset.is_valid() not true. never true until you provide data required
N S
Thats not possible the querset executes and there is data in the form once i give submit that data is gone.
N S
Here is the screenshot of form before and after submit
inchidi
dont send message too fast, combot doesnt like it
N S
okay
Django Bot
>> Links - NewbieMistakes – Django - Django Newbie Mistakes | Hacker News
inchidi
submited doesnt mean saved
N S
submited doesnt mean saved
i know but i am not understanding where i am wrong
N S
https://www.youtube.com/watch?v=we8-83hzTpk i used this video to do that
Have a look at this video they did this updation with the modelformset factory
N S
the model is different i have a foreign key in addition to 10 fields
inchidi
i know but i am not understanding where i am wrong
okay i'll guide you how to troubleshoot this kind of problem
inchidi
first thing you need to check is what data provided by your requests.POST
inchidi
you can try print(request.POST) to check it
N S
ok
Django Bot
>> Links - Test-Driven Web Development with Python - The Book
N S
@Inchidi
inchidi
@Inchidi
did you place the print in first line of your views function?
N S
No just before request.method == post
Django Bot
>> Links - Test Driven Development with Python
inchidi
okay, you can see there your request send the form-0-markx data but not other required fields such as sub1 etc
inchidi
in this rendered page, did you have any input for that?
inchidi
yes i set them to have a default value of 0
its hidden? show me the html code
N S
heres the models.py https://dpaste.de/tAJW
inchidi
heres the models.py https://dpaste.de/tAJW
at this point you need to check your html
Jimmies San
someone use here django-allauth? if i want enable registration only from a particular domain/list of domains allowed ... any idea? no sociallogin.
Jimmies San
i override the registrationclass adding this check?
Django Bot
>> Links - Django newbie mistakes
Django Bot
>> Links - Test Driven development with python
Django Bot
>> Links - eternicode / django-videologue-html5 — Bitbucket
Klim
Hello there. Can you help me? I have to find middleware for Django Graphql which will check auth token with every request. In graphql_jwt i have a couple of decorators such as @login_required. But i should wrap every function i created before. How can i do it globally, not for each function?
Anonymous
Is that python
Django Bot
>> Links - Writing your first Django app, part 1 | Django documentation | Django
Django Bot
>> Links - The Book
Maz
Is that python
Yes. Are you new to this?
Django Bot
>> Blogs - Equivalents in Python and JavaScript. Part 1 >> Links - The Book
N S
@Inchidi did you get any solution for my problem
Ярослав
I'm trying to make automatic session renewal, all I found in google is quite old and not working. Managed to make this work without crashing Django, is it safe to use? class ExtendUserSession: def __init__(self, get_response): self.get_response = get_response def __call__(self, request): if request.user.is_authenticated: now = timezone.now() if request.session.get_expiry_date() < now + timedelta(days=RENEW_THRESHOLD): request.session.set_expiry(now + timedelta(days=EXTENDED_SESSION)) return self.get_response(request)
Maz
😅Yeah
No worries
inchidi
https://dpaste.de/XVLf
your <form> outside that template? can you give me rendered html instead?
Django Bot
>> Links - pydanny.com
N S
your <form> outside that template? can you give me rendered html instead?
I have an a primary key automatically set in my model how do i exclude that in the modelformset_factory
Django Bot
>> Links - A primer on sending email thru Django – Django Musings – Medium
Django Bot
>> Links - The Book
Django Bot
>> Links - cfpb/wagtail-flags: Feature flags for Wagtail sites
Anonymous
Any one with react knowledge here ?
Anonymous
Need some help
Django Bot
>> Links - React Pages - use React freely in non-Node.JS environments, like Django
rahidul
how to dynamic bootstrap carousel in django
Arjun
Pass the slider images in a list to template and iterate it in carousel component
Arjun
I mean the path to slider images
Django Bot
>> Links - Equivalents in Python and JavaScript. Part 1
N S
Is it possible to upload data as csv into models using modelform
Django Bot
>> Links - How to Utilize Google's Free SMTP Server to Send Emails