Saurabh
I am also confusing here, i tried everything but I don't know where is problem.
Saurabh
len just a example but I am not able to do anything with this queryset. It showing same error.
Saurabh
Okay.
Danilo
Hi guys, i have a def validate_email(self, value): in a serializer of type ModelSerializer and he is not called, this field it was declarated in the fields array as well, i need validate this email if is empty to raise an exception
Alex
Okay.
*pastebin
Bernard
hi guys how to get started with Django?
Daniil
hi guys how to get started with Django?
Try to build a simple notes or to do app
Bernard
how to get Django
Dillag
Write your first shop, so you will learn everything you need to get started
Dillag
for example now I write my vapeshop, because I know a lot about vape
Dillag
just choose a topic you are good at
Mirco
Doragonsureiyā
how to get Django
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Eugene
Hey,guys. What would you say about separating HTML and static files in different apps
Eugene
?^^
Eugene
Is it a good practice to do that ?
Daniil
Hey,guys. What would you say about separating HTML and static files in different apps
Static is always separated from html. Just as it’s own folder.
Bernard
!djangotut
thanks Mirco
Anonymous
guys, I need a hand, I got some problem when I wanna try to POST data from Reactjs to Django API that I made. and this is the error, it's about cors "Access to XMLHttpRequest at 'http://127.0.0.1:8000/categories' from origin 'http://localhost:3000' has been blocked by CORS policy" and this is my setting.py CORS_ALLOW_ALL_ORIGINS = True CORS_ALLOW_METHODS = [ 'DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT', ] CORS_ALLOW_HEADERS = [ "accept", "accept-encoding", "authorization", "content-type", "dnt", "origin", "user-agent", "http-x-csrftoken", "x-csrftoken", "x-requested-with", # ] CSRF_COOKIE_SECURE = True CSRF_COOKIE_HTTPONLY = True CSRF_TRUSTED_ORIGINS = ['http://127.0.0.1:3000'] it's been 2 days😭🙏🏻
Eugene
I meant apps
Eugene
Not folders dude
HamidReza Fekri
hi i use postgres sql for my project i want to have another database for my models only for some spacial fields how can i have logical foreign key to mongodb
Anonymous
https://cdn.discordapp.com/attachments/696432394974265374/872819501668904970/unknown.png
i want to show the recent chats in left section of chats i use Django channels for chating but while chating in one group the new messages from other groups are not coming in left section as a recent chats of chat please can you tell me what to do
Anonymous
Anonymous
I've defined it like this CORS_ALLOWED_ORIGINS = ['http://127.0.0.1:3000'] but it doesnt work,
Mirco
I've defined it like this CORS_ALLOWED_ORIGINS = ['http://127.0.0.1:3000'] but it doesnt work,
Did you read what I've told u ? The Middleware settings is the most important config Follow what's explained into the repo README
HRITIK
In my prod model if I remove constructor function it is showing no error otherwise it is showing error that init fun can't take more than 1 positional arguments
HRITIK
Plz explain
HamidReza Fekri
hi i use postgres sql for my project i want to have another database for my models only for some spacial fields how can i have logical foreign key to mongodb
Doragonsureiyā
In my prod model if I remove constructor function it is showing no error otherwise it is showing error that init fun can't take more than 1 positional arguments
Please provide a full explanation including all the details that you consider relevant. Your statement is too broad and there is no clear way to answer you, you have to explain: - what you're doing - what you're expecting - what you're using - where you're running the script - what Python version you're using - what packages and their versions you're using - and the most important thing: show the code YOU wrote (read rule 5️⃣ for that) and more details, that way your chances to get help will increase
HRITIK
https://dpaste.org/N4xO
HRITIK
Here is my code In my prod model if I remove constructor function it is showing no error otherwise it is showing error that init fun can't take more than 1 positional arguments
Maxim
try to add CORS_ORIGIN_WHITELIST with same as in CORS_ALLOWED_ORIGINS value
Anonymous
same result sir, doesnt work
HamidReza Fekri
try to add CORS_ORIGIN_WHITELIST with same as in CORS_ALLOWED_ORIGINS value
hey newly I start django and i have problem can you help me ?????
HRITIK
Plz help me
Margavya
Anyone here is having Django Ecommerce project with MySQL database?
HamidReza Fekri
HamidReza Fekri
Tell your problem
hi i use postgres sql for my project i want to have another database for my models only for some spacial fields how can i have logical foreign key to mongodb
HamidReza Fekri
yes
Anonymous
yes
But if I may ask, is that a good design philosophy?
Doragonsureiyā
hey newly I start django and i have problem can you help me ?????
Don't tag people randomly, even if they seem knowledgeable. Most of the time, the person you tagged doesn't even know about the topic you just brought up. If people want to help you, they will - just be patient.
Doragonsureiyā
hey newly I start django and i have problem can you help me ?????
Don't ask meta questions like: "Any user of $x here?" "Anyone used technology $y?" "Hello, I need help on $z!" Just ask directly! The better you are at explaining the problem, the more likely you are to get help. Asking smart questions
HamidReza Fekri
@fishworm yes the reason that I want to do this increase speed of product filter by properties
Seth
hi guys, how could I submit a form that has your data and also several dependent foreignkey?
Anonymous
@fishworm yes the reason that I want to do this increase speed of product filter by properties
Look into proper ways of query optimization like creating indexes
HamidReza Fekri
@fishworm thank but can you please tell me what exactly google
Anonymous
@fishworm thank but can you please tell me what exactly google
Here https://docs.djangoproject.com/en/3.2/topics/db/optimization/
HamidReza Fekri
@fishworm thank you so so much🙏🙏🙏
HRITIK
https://dpaste.org/N4xO In my prod model if I remove constructor function it is showing no error otherwise it is showing error that init fun can't take more than 1 positional arguments
Rushikesh
How can I remove seconds 10:20:00 from this time format in django Timefield to display as 10:20
Ihor
hi! how can i build a query like this? django orm`s SELECT * FROM ( SELECT * FROM TABLE ) AS TMP WHERE ROW = n
Ranken
Can filter() and aggregrate() methods be used together???.... If yes please show me a snippet
Ihor
SELECT * FROM ( SELECT "accounts_seller"."id" as "id", "accounts_seller"."user_id" as "user_id", CONCAT("accounts_user"."first_name", CONCAT("accounts_user"."last_name")) AS "full_name", "accounts_userbalance"."total_points" AS "points", ROW_NUMBER() OVER (ORDER BY "accounts_userbalance"."total_points" DESC) AS "number" FROM "accounts_seller" INNER JOIN "accounts_user" ON ("accounts_seller"."user_id" = "accounts_user"."id") LEFT OUTER JOIN "accounts_userbalance" ON ("accounts_user"."id" = "accounts_userbalance"."user_id") ) as "top" WHERE user_id = '' // OR LIMIT 100
Ihor
qs = (self.model.objects .select_related('user', 'shop_address', 'user__balance') .annotate(full_name=Concat('user__first_name', Value(' '), 'user__last_name'), city=F('shop_address__city__name'), points=F('user__balance__total_points')) .annotate(number=Window(expression=RowNumber(), order_by=F('points').desc()))) need filter or limit
Ihor
I can use raw(sql) but I want orm
kritikos
Can filter() and aggregrate() methods be used together???.... If yes please show me a snippet
You can call aggregate after filter but not the reverse. For the snippet just check Django doc : https://docs.djangoproject.com/fr/3.2/topics/db/aggregation/
Jitendra Kumar
How to make a dynamic website?
Jitendra Kumar
Using Django framework
Charly
How to make a dynamic website?
what do you mean with dynamic?
cj
what do you mean with dynamic?
OP: that has dynamic animations made with flash player, you know
Daniel
rsrs
HamidReza Fekri
How to make a dynamic website?
this is really big question if i were you i would study django doc about api and views
Seth
Hi, How could I have more than two drop down dependents?
Igor'
Hey! How can I test reverse_lazy in CreatView using TestCase? My code: def test_my_method(self): client = Client() response = client.post('/add_income') self.assertRedirects(response, 'main_page', status_code=301) But I get error: AssertionError: 200 != 301 : Response didn't redirect as expected: Response code was 200 (expected 301)