Hello
save() method is not working even I directly give my_form.save()
Master of None
user=User() user.set_password(my_form.cleaned_data["password1"] user.save()
you cant use cleaned_data before calling is_valid() method. at first, you must validate the input data (form data), then you can use cleaned_data method to fetch form's data.
Master of None
I have done all those thing and I have used those things only after is_valid()
def register(request): #blah... form = UserForm(request.POST or None) if request.method == "POST": if form.is_valid(): #This would call the clean method for you user = User.objects.create(...) user.set_password(form.cleaned_data.get("password1")) user.save() else: #Form is invalid print form.errors #You have the error list here.
Master of None
With out User.objects.create can't we save using save()
you must create a temporary object instance, then you should call save() to save data in db.
Master of None
Can anyone help me how to make a django model field both unique with case sensitive
hi dear. you can use unique=True attribute in field definition.
Master of None
hi dear. you can use unique=True attribute in field definition.
you can write a custom validator to validate input data....
Hello
form.py
Hello
forms.py def save(self, commit=True): user = super(SignUpForm, self).save(commit=False) user.set_password(self.cleaned_data["password2"]) if commit: user.save() return user views.py def user_signup_view(request): my_form=SignUpForm() if request.method=="POST": my_form=SignUpForm(request.POST) if my_form.is_valid(): print("its coming") user=my_form.save() return render(request,"signup.html",context)
Ankit
Can any one help me with celery, actually it's not working on production server.
Ankit
on nginx?
Yes and gunicorn
Arslan
https://dev.to/idrisrampurawala/deploying-django-with-celery-and-redis-on-ubuntu-3fo6 this one was very helpful for me
Anonymous
which is more in demand with django? reactjs || angularjs
Anonymous
i think, django mysql reactjs stack is trending
Darta
in django admin delete button for image field is not link so i can't remove image what is the problem ?
Rohan
I want a udemy clone project for some reference
Rohan
If any one has it would be a big help
D
Guys I'm planning on starting django if anyone has course materials pdfs or so send me ...
aman
Hey there My name is Aman, I'm creating user form. I want to add address of user using current address what to read how to implement???
Sh
I am a professional django developer. I can help in projects and assignments or any freelancing work in django. DM for any such queries.
Hamouda
can anyone tell me how to generate a file field
Gari
Can anyone suggest me any SQL group
Charanpreet Singh
Hey, in my django project, I first sign up a user, login the user and create a JWT token for him. Next, the user changes his password. But still, the JWT token which was created before is valid.
Charanpreet Singh
What can be the reason for this?
Hello
If is_active=False authenticate method works or not
Deleted
https://stackoverflow.com/questions/67721855/delete-password-last-login-superuser-status-groups-user-permissions-filed pls help
Ss
Anyone who know react js ??
bot
Why am I muted..
.
Hello, did anybody use django-auto-rest? I have a problem if model relation to itself ```Could not resolve URL for hyperlinked relationship using view name "page-detail". You may have failed to include the related model in your API, or incorrectly configured the lookup_field attribute on this field``` What can I do with it?
Anonymous
Guys how to make <script> global in html code??
LIBIN
how can we eliminate the timezone from datetime field??
Anonymous
Shay
hi, im looking for some one who knows django channels and can help me with a small real time chat project i will pay for helping
Joseph
Please when I set django debug to True my websites runs locally with allowed host ['*'] But when I set debug to False I get server error(500) Please can someone help
Joseph
Ok thanks
ДжиКю
Hey gays, I have a Django project. I already did the back end, but I still need a front-end developer to design the templates and to use some javascript. We have about six pages to design. How much would it cost? And how much time should it usually take?
on
Depends on ur design @lacostexit
on
If you need it i can help or do it for you
aman
got stuck between geofencing or maps api.. I thing it could be done using maps api but it is used with django
Yaswanth
Why am I getting error like view.method didn't return httpresponse instead it returned None.
Yaswanth
are you using render
No httpresponse ()
𝓙𝓪𝓶𝓸𝓵𝔁𝓸𝓷
No httpresponse ()
also use reverse
𝓙𝓪𝓶𝓸𝓵𝔁𝓸𝓷
inside httpresponse()
LIBIN
You mean to say, you only need date?
When I serialize the data the datetime get added with timezone?
Kedar
How is clever programmer course for Python and Django
OneZer0
any know what is it? https://ibb.co/mbZqpY5
Ali
Hi guys Today i finished an essential django training (I'm experienced programmer in Cpp and Asp) Now I've a questtion. Imagine that you have an Enterprise django project!!! Whichh architecture you will use? Which design pattern? Even in your project dir structure
ahmed
How to Translation websites in django
Anonymous
Django model is ignoring some fields and save blank value when it creates an object, but data is going correctly From frontend, I used modelform
Anonymous
Ashish
Hey all, Have anyone have any idea that how to lock a web page...I want to make a website just like quiz
Amir
Hello I have this problem: The problem in stack Does anyone know the reason?
Yaswanth
What is the difference between django.urls and django.conf.urls
Conditional elector of HRE
Hello everyone! Why isn't the form creating a new record from the data it receives from the form? Here is the views.py code: def create_trailer (request): form = TrailerForm () if request.method == 'POST': if form.is_valid (): form = TrailerForm (request.POST, request.FILES) form.save () return render (request, 'polls/create_trailer.html', {'form': form}) Here is the forms.py code: class TrailerForm (ModelForm): class Meta: model = Trailer fields = ['name_trailer', 'preview_trailer', 'trailer', 'author'] And here is the create_trailer.html code: <div class = "create_trailer"> <form class = "create_trailer_form" enctype="multipart/form-data" method="post"> {% csrf_token%} {% if form.is_valid%} <h1> Form is valid </h1> {% else%} {{form.errors}} {% endif%} {{form.as_p}} <input type = "submit" value = "Create article"> </form> </div>
Groot
Its base part are done now i want to add signup & signin + comment section + score in a better manner
Groot
But laptop is demage
Ashish
But laptop is demage
Oh that's sad😔
Groot
What is paginator
To create auto pages by recieving data from front end fields
Groot
Auto paage means to modify the data of existing pagge in dynamic manner