Jean-Yves
https://www.toptal.com/developers/hastebin/igopupuleh.py
Дмитрий
I want to make a view of type get in class based view which saves the product to the wishlist as a listview.
Something like that class MyWishList(ListView): model = WishList queryset = <some request to db> but I have never used ListView to save to db. This example for displaying a list in a template
Jean-Yves
i want to show you the view and the model. It's two parts different
Umut
https://stackoverflow.com/questions/71131520/django-admin-404-page-display-error-unable-to-find-return-page-when-data-is-ins
Дмитрий
i want to show you the view and the model. It's two parts different
Of course, but 'view' must now what 'model' will be used
Abdikarimov Farhod
hi i need help with jango muomo is that there is an admin section and there is a staff section now the work done by the staff should not be visible to another employee this is how can i
ꜱᴀᴇᴇᴅ
Hello, how can I put the phone number receiving field in the models and send an SMS to the number taken from the user to login to the site, can anyone help me? 🤔
Дмитрий
can you help me about my problem
I see three possible scenario: 1) db is not connected (and/or migration undone) 2) view for admin action is not created/uploaded 3) question to permission/token
Alex
Hello, how can I put the phone number receiving field in the models and send an SMS to the number taken from the user to login to the site, can anyone help me? 🤔
If I understand you right, you need to define something like phone = models.CharField(max_length=15). You also have to sanitize it from any additional signs like parentheses, spaces, dashes and so on in your validation logic (forms or serializers).
Alex
I want to make a view of type get in class based view which saves the product to the wishlist as a listview.
ListView is about displaying things, not creating. I think you need to learn about FormSets https://stackoverflow.com/questions/56087609/formset-in-django-classbased-createview https://docs.djangoproject.com/en/4.0/topics/forms/formsets/
Alex
Thanks, how can I filter the parentheses?🤔
I think the best way will be to iterate over a string and filter out any non digits.
ꜱᴀᴇᴇᴅ
I think the best way will be to iterate over a string and filter out any non digits.
Thank you, how can I send an sms code to the number received from the user to her phone number?
Alex
Thank you, how can I send an sms code to the number received from the user to her phone number?
Well, it's not a programming question, but rather business. You have to find some provider for that. Probably it will be some local provider in your country
Alex
Thank you, how can I send an sms code to the number received from the user to her phone number?
There you enter into a contract and you will be given some API for that.
ꜱᴀᴇᴇᴅ
How can I edit the Django username field and filter the # £ _ & /?! * Characters so that if the user enters these characters in the username, they will give an error
Alex
How can I edit the Django username field and filter the # £ _ & /?! * Characters so that if the user enters these characters in the username, they will give an error
You can try to create a custom validator https://docs.djangoproject.com/en/4.0/ref/validators/#writing-validators and set there rules by your own.
Alex
Thank you, can I use the django-sms package or not? 🤔
It doesn't look like a well supported package. Be in your place, I would rather write my own wrapper for such API. If you are curious, here is a patter for that https://martinfowler.com/articles/gateway-pattern.html
jolli
hello all. I am working with templates folder. my error is template is not exist. I have Included the app in installed apps. can any one help with that.
Najim patel
queryset = queryset.filter(and_(Template.start_dt <=Template.start_dt, Template.end_dt >=Template.end_dt, Template.status==1)).order_by(Template.end_dt.desc()) queryset = queryset.all()
Najim patel
How I can understand My query is wrong or correct
Alex
This is flask query
There is no such thing as a "flask query". I think it's tortoise or gino orm
Najim patel
There is no such thing as a "flask query". I think it's tortoise or gino orm
It's Sqlalchemy orm I am sorting two dates i need future date result
Kiran
Access to XMLHttpRequest at 'http://127.0.0.1:8000/accounts/login/' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Alex
It's Sqlalchemy orm I am sorting two dates i need future date result
Then the question is unrelated to the group. Proceed to @python
Kiran
i am newbie in django,i put "CORS_ORIGIN_WHITELIST = [ "https://localhost:3000" ]" in settings
Anonymous
http://localhost:8000/python_learning/7/3/page this url path giving error, how can I filter the old id from the return url
jolli
Did you update templates dir in settings file?
Yes I did. My path is also perfect yet could not fix it.
Anonymous
http://localhost:8000/python_learning/7/3/page
Anonymous
Page not found (404) Request Method: GET Request URL: http://localhost:8000/python_learning/7/3/page Using the URLconf defined in python_learning.urls, Django tried these URL patterns, in this order:
Anonymous
this is my urls.py code path('<int:id>/page',views.page,name='page'), and my views.py code is def page(request,id): id1=str(id) return render(request,'user/a'+id1+'.html') I am try to go to next page, from the already render page, but there I am getting a error the error is: Page not found (404) Request Method: GET Request URL: http://localhost:8000/python_learning/7/3/page Using the URLconf defined in python_learning.urls, Django tried these URL patterns, in this order: I am using same path and function for render next page but I got this error tell me how to remove the old /id from the return request url… please
M
Hi guys as I have been freaking out for 2 hours, I appeal to your goodwill. I can put variables like STATIC_URL, MEDIA_ROOT and MEDIA_URL inside the .env file (I use django environ) ?Because at the moment I'm not succeeding.. If you could give me a hint please:(
M
Thx guys
M
Resolved issue
Брат
Why Model.objects.all() is not a single query? I mean it depends how much objects inside of it. For instance if there are 5 objects then, Model.objects.all() will query 6 times not one...
Брат
You can check it yourself in python shell
Брат
or in django toolbar
Fan / Ac
He might be accessing foreign key in the query
Брат
Im using many to many field in this model
Брат
What I can do about it?
Fan / Ac
check select_related()
Брат
prefetch_related() doesn't help
Брат
check select_related()
omg, I didn't notice, that I have a OneToOne relationship either, it worked for me thx!
Rohit
Hello Everyone can we write a script to turn api’s on when system reboots ?
Alex
Hi guys I use django&gunicorn&nginx for deploy and have a problem with celery-progress - progress-bar doesn’t move, while jobs are executing fine (200 response, status pending). When I use celery-progress with dev settings everything works fine (settings do not include nginx and gunicorn) What can be the problem?
samkit
hi guys i just started learning django cannot really understand how MVC works? any suggestions
Doragonsureiyā
hi guys i just started learning django cannot really understand how MVC works? any suggestions
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Mirco
Django supports MVT
If he doesn't get MVC , he cannot get MVT
cj
also Django doesn't "support" MVT... Django has it's own pattern, which is Django
cj
go read about that in the official documentation
Lokdai
Hey guys i wish you all are doing well,, i have a problem here in login page when i login with the right username an password it shows me inviled info rather than redirect me to home page
Doragonsureiyā
Hey guys i wish you all are doing well,, i have a problem here in login page when i login with the right username an password it shows me inviled info rather than redirect me to home page
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
Arshia
Hi guys To work in the backend, we need to make changes in the design of the site??
Брат
How can I add an object in manytomany field withing 1 query? It tooks me somehow 4 queries to do so: getting_model = Model.objects.get(id=id) # +1 query getting_model.friends.add(AnotherModel) # +3 queries
Anshu
Hi guys To work in the backend, we need to make changes in the design of the site??
Design of webapp can be same and you can still work in backend