Sergey
Hello, everyone! I have drf swagger, and I do not understand how to annotate list and retrieve method in ReadOnlyModelViewSet, such that show in app/swagger. Anyone work with it?
Sanji
Hey Guys.... If an User uploads an IMAGE It's not showing after I uploaded it to Heroku..But the images are showing Locally
Sanji
What is the problem here?
Anonymous
I have done it That is why service is free
Anonymous
It deletes medias
Sanji
Is there any solution?
Anonymous
For static files You should use another service, and for deploy heroku, for example aws.
Sanji
I see..lemme try
Anonymous
It was showed this tutorial https://youtu.be/sSquD2u5Ie0
Anonymous
But i couldn't create an account on aws😕
Sanji
It's not free
Anonymous
B
Я все
B
Бросил учится питона
B
Зб уже
Doragonsureiyā
Я все
Hi! This group is English-only. Please, translate your message into English and delete the non-english message. Or move to a group speaking your language (type "!ol" to see the list). Thank you.
B
Лучше заниматься другими работами
Mohamed
hi
Mohamed
I wanna to work on any site as freelancer developer , how can I make good profile I mean question is( any projects to put it on my profile?)
Luq
Hello I deployed django on windows server locally(for internal only) using apache for django and nginx for static files. Everything work perfect how can I configure static catching for nginx?
Pavel
Hello, how to get last value from arrayfield in lookup
Pavel
u can't do it in lookup
William
u can't do it in lookup
Can you show the output of the array?
Pavel
I mean MyModel.objects.filter(my_array_field__last="")
Pavel
But last returns None
William
But last returns None
My_array is ManyToMany?
Pavel
No it's postgres ArrayField
Pavel
The whole picture is JsonField, where the array are stored by key "results". I write MyModel.objects.filter(my_json_field__results__<here i want to get last (like 0 => first)> =1)
Pavel
Wrote it with extra. Thanks
Yusuf
How to insert data in for foreign key attributes from django views? For example i want input country by search country not select country, if country not found than add country.. Thanks sorry for my english.
Enam_may
Hi , what should I do to change my username_field in settings in order to create a login with email or phone number, I want to create a optional choices, Please if any one know help me
♈
Django in is_active default field after form in show a true or false But I want inactive active value show from 0 or 1 Please give a better solution
John
Hey guys I'm trying to search in class based views with pagination but I'm not able to search please help
John
https://pastebin.com/uaFywje6 https://pastebin.com/FKPwh7qT
Sunny
Hey, I am facing one issue with django migrate commad when attempting to create index from django model. The error is ValueError : Found wrong number (2) of constraints for model_name(field_name)
Sergio
Hi, what should I do to create a trial of my project? Please if anyone know help me thanks in advance
Sherlock
if request.method == 'POST': user_form = UserForm(data = request.POST) if user_form.is_valid() : user = user_form.save() user.set_password(user.password) user.save() i'm learning django, I have come across this code in making django form my doubt is why we are making new variable is user = user_form.save() why not just user_form.save() and all.... thanks in advance🙏🙏
Sherlock
You need to get an instance of the user that will be saved. This allows you to use the set_pasword and save a hashed password for the user
sir are both these code have same meaning if request.method == 'POST': user_form = UserForm(data = request.POST) if user_form.is_valid() : user = user_form.save() user.set_password(user.password) user.save() vs if request.method == 'POST': user_form = UserForm(data = request.POST) if user_form.is_valid() : user_form.save() user_form.set_password(user_form.password) user_form.save() i mean we can write like this too instead of another unnecessary variable ?sir
Joseph
Please I have a class called position category Having a foreign key to department category. In my html file I have looped through The departments {% for cat in departmencat%} To display all department {% for position in cat %} Display all positions in the department {%endfor%} {%endfor%} But it is saying object is not iterable
Sarp
Hello gyus i am getting error while integrating razorpay in django project Here i briefly described my problem https://stackoverflow.com/q/68953901/12614466
Joseph
Its being called from the database
Joseph
Try {% for cat in departmencategory.all %} {% for position in cat.all %}
Please if I do this im not getting the right information of the position in each department. It loops through all
vineeth
Any django recording course please?
Joseph
What specific info you needed?
Please want to loop through all department and in each departments it loops through all the positions in the department
Joseph
Ok
Joseph
https://pastebin.com/rihMYYzV
Joseph
Share the models using pastebin.com
https://pastebin.com/rihMYYzV
William
From PositionCategory you need all the category?
Joseph
Yes please
Joseph
.
Please I have paated the codes there
William
Yes please
cat = PositionCategory.objects.filter(cat__name = request.user.category).select_related(''cat) {% for i in cat.categorymain.all %} {% endfor %}
Joseph
cat = PositionCategory.objects.filter(cat__name = request.user.category).select_related(''cat) {% for i in cat.categorymain.all %} {% endfor %}
With this its still looping through all the category thats in the database but not specific to a department
Joseph
Please I want it in a way that. After looping through all the departments. I want the other loop to loop through the department and get all the positions in the departments. Because every department has different positions
♈
Django in is_active default field after form in show a true or false But I want inactive active value show from 0 or 1 Please give a better solution
Joseph
Are referring category as department?
Yes please. So in those departments I want it to list all the position in it I am giving a scenario of how I want it
William
Yes please. So in those departments I want it to list all the position in it I am giving a scenario of how I want it
Give some sample data like what specific data you need. I couldn't understand what you need.
Jovial Joe Jayarson
I've a model 'Individual' with around 40 attributes. It returns the first one as string. But whenever an entry is made I get and error saying: 'Individual' object has no attribute 'q_01'. Snippet: ... class Individual(models.Model): fly = models.ForeignKey( name="Family Name", to=Family, null=False, blank=False, on_delete=models.CASCADE, related_name="family_name") # Question 1 - 10 q_01 = models.CharField( name="01. Full Name", null=False, blank=False, max_length=100, default="") q_02 = models.TextField( name="02. Aliases / Nicknames", blank=True, max_length=200, default="") # ... around 40 more attributes ... # def __str__(self) -> self: return self.q_01 # causes: 'Individual' object has no attribute 'q_01' Is this a bug in latest django (3.2.6) or am I doing something wrong?
Sherlock
They not the same. In fact that's error
Well, I got to know that save() method will return the updated object so there's point of storing that into a new variable. And Thanks You
SUBHAN
Provide links.. To learn I'm beginner
Jovial Joe Jayarson
Make sure that u not used the model name for another object
No I don't. Take a look https://github.com/joe733/cbcefdb/blob/main/survey/models.py
Jovial Joe Jayarson
Make sure that u not used the model name for another object
I tested by changing the model name to Person but it produces the same error: https://i.stack.imgur.com/dQOVa.png
Roy Cyril
Hi , is it possible to alter the order of database fields without manually editing migration files? i have an abstract model with created_at and modified_at fields as a base model, which id use as parent for my other models, i want to make it thr last fields whenever i migrate it to the db, is this possible with the current dj version?if so how?thanks