Mo
Model=models.IntegerField(default=12) invalid syntax error why this error happens?
Mirco
Model=models.IntegerField(default=12) invalid syntax error why this error happens?
Show the code via pastebin What you have written has no sense as it is
Jay
My jwt comes in the form {"token":"my token here"} but, the backend is not accepting it with the header "Authorization":"JWT {"token":"my token here"}". What should I do to make it work?
Jay
Using drf
Mirco
Basic Authentication
So you need to send the Authorization header with the keyword Token <your_token>
Jay
Yes, I understand that
Jay
So you need to send the Authorization header with the keyword Token <your_token>
But is there a way to get only the token and not the rest of the formatting from django?
Mirco
But is there a way to get only the token and not the rest of the formatting from django?
What's your main goal ? You mean by avoiding the Token keyword ?
Mirco
yes, From the backend
You need to override the TokenAuthentication class and set the keyword to None
Jay
Ok, thanks
Doragonsureiyā
Ok, thanks
You're welcome! 😊
Saugat
Yes 3rd party
Yes there is PhoneNumberField
Saugat
Yes 3rd party
(unique = True)
Poojitha
how to automatically create a record in one table when user registers to site in django.Can anyone pls tell me
عبد الله
when django assign reversed fk to model? I need to count it but - in pre_save and post_save signals - in clean/save methods it doesn't appear, if I look in db it says there still -1 of what I've added in inline.
عبد الله
ModelA(): fk=ModelB and I need to count it in ModelB
Владислав
What to do, I'm paranoid ... And I need your help. If I see more than 10 sql requests per page, I feel bad. Can you dispel the myth, how much sql is normal, and will the site crash if there are 50 sql per page?
Владислав
I tried hitcount and when I showed for 10 posts from listview I went into shock how much sql was done ...
Владислав
Does anyone have a good model for collecting statistics for posts, or can genericforeighnkey without a bunch of sql queries? Who can share? I'll be very thankful. You just need a view counter, with the ability to make templatetags to sort popular articles
Глеб
!markdown
Doragonsureiyā
• Use a backtick (`) on both ends of your single line: print("hello world") • For more lines, use three backticks (```) before the first line, and after the last: def hello(name): print(f"hello {name}") • You can also select text when typing, and select the markdown option.
Глеб
What output will be if it is empy Author.objects.filter(name__contains="Terry")
Sadra
Seriously? I mean list have no repeated id. Example: {1, 1, 2} - wrong, {1, 2} - good
Once you get them all, there won't be any repeated value in the response.
Anonymous
👋🥺
Mo
how can we define list of strings or integers in models.py? (for django rest api)
Mo
Use choices parameter.
i mean selecting multiple values of strings or integers like a list [1,2,3,4] not one value from a list that is defined by choices.
Sadra
i mean selecting multiple values of strings or integers like a list [1,2,3,4] not one value from a list that is defined by choices.
You have 2 options. 1. Use choice parameter with multiple values. 2. Add your values to another model and choose them from a foreignkey field.
Aswith
Can we use firebase in django??
Pratik
How can I get common json field in views???? Ex-i have table called player...and json field hobby...now I want to get common hobby of players
Mo
You have 2 options. 1. Use choice parameter with multiple values. 2. Add your values to another model and choose them from a foreignkey field.
do you mean something like this? https://stackoverflow.com/questions/31395153/django-rest-framework-including-multiple-choice-fields-in-serializer class Genres(models.Model): genre = models.CharField(unique=True) class Movies(models.Model): genres = ManyToManyField(Genres, related_name='movies')
🏁 🏁 🏁
My Django site is very slow and very huge TTFB (Time to first byte). What to do???
🏁 🏁 🏁
George
How?
first profiling
Prateek
is there any one who is expert in django
Pratik
Ask your question
How can I get common json field in views???? Ex-i have table called player...and json field hobby...now I want to get common hobby of players
Bharathwajan
any know how to add custom device frames for viewing in chrome or edge or any kind of browser i need iphone x or higher model frame for visializing
Bharathwajan
any know how to add custom device frames for viewing in chrome or edge or any kind of browser i need iphone x or higher model frame for visializing
i know that the screen ratios are available by default but i need that with frames i know how to 3d models but how can i used it my web browser
Anonymous
Hey guys I have a mixin class for "like" and another mixin class for "comment" Now I want to use like class for comment class I mean i want to be able to like the comments How can i do that? Any help would be appreciated🙏🏻
🏁 🏁 🏁
How can I speed up Python Files in Django??
Doragonsureiyā
🏁 🏁 🏁
What are you talking about?
Launching a page with python files takes a very long time, about 35 seconds. If you remove them, the site is very fast. These are 3 files of 500 lines of code.
🏁 🏁 🏁
I don't think I can cut them too much
Prateek
1) create a model with fields a) UUID b) username c) gender (radio button) d) full user e) email f) avatar g) phone number h) address 2) Create a view, URL for storing record with full validation Note: Implement email already exist validation 3) Create a view, URL to show recent 20 records in the table with the edit view delete option 4) Create a view, URL for showing a particular record details 5) Create a view, URL for edit a particular record details email not changeable
🏁 🏁 🏁
it depends on what these files do
They collect information from other sites (legally) using requests and BeautifulSoup and analyze it. I understand that this is what loads the system very heavily, but what can I do?
Mirco
They collect information from other sites (legally) using requests and BeautifulSoup and analyze it. I understand that this is what loads the system very heavily, but what can I do?
you can use async views if u are using Django 3.1 and above or simply use background tasks managed by Celery or Django Q external calls via requests are sync, it's normal it takes time
Sadra
Celery + RabbitMQ
Baggy ️️
Guys what is the price of a personal blog
Baggy ️️
Any idea
Mo
Yeap.
class Names(models.Model): name= models.CharField(unique=True) class factory(models.Model): market=models.IntegerField(default=0) names = ManyToManyField(Names) Model=models.IntegerField(default=12) Starttime=models.DateField(default=datetime.now, blank=True) Endtime=models.DateField(default=datetime.now, blank=True) name = ManyToManyField(Names) NameError: name 'ManyToManyField' is not defined
Sh
Django Deployment : https://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
Ruslan
Guys, is Django a good choice for React native?
Yaswanth
Hi guys.. can I create a framework just like django or flask...? If yes then how..?
Yaswanth
yes, you need to know how HTTP works
Is there any tutorial on that or where can I find the info about it..?
Charly
Is there any tutorial on that or where can I find the info about it..?
No, you'll need to learn that bu yourself, or if you don;'t know how, just use django
A
Is there any tutorial on that or where can I find the info about it..?
Yes, you can google it and you should do basic server programming in python and develop your framework.
123
Hi how can i store all data to multiple data base
James
Hellow. I want to user_id on urls how should i perfom this in django?
James
Mirco
I mean url path
Just accept an id, then in your code you will pass the user id via reverse