Mike
Anyone have best video on restful API?
Doragonsureiyā
Anonymous
How is filter data according within to 10 kn range
Anonymous
I have try geodjango but its dependency libary not install
Anonymous
Use sqlite data base
Anonymous
Plz help me
Артем
how this url must be presented in urls.py?
http://94.228.112.111/thanks?orderId=652a7043-05ee-7fe8-b48c-e3d027e6b5e0&lang=ru
Артем
such as?
urlpatterns = [
path('add_order_click/', add_order_fast_click, name='add_order_fast_click'),
path('add_order_click_basket/', add_order_click_basket, name='add_order_click_basket'),
path('thanks/(?orderid=<slug:order>)/', thanks, name='thanks'),
]
Erik
Hey! Do anybody know how to display to unauthorized user datetime fileds somewhere in a template in his local timezone??
Mirco
Mirco
Erik
Whole day yesterday
Mirco
You need more time then
Timezones are not easy 😊
But it's pretty easy to do it also inside the context
To know the timezone from the browser you can just use vanilla JS and then with pytz or the new ZoneInfo you can convert times
Azizbek Xushnazarov
#Question
I have a model that has a foreignkey for User model. And I have to get it's username.
To do this, i have overrided the field declaration and set CharField(). But in this way I can only read data but cant create.
How can I achive this?
Or should I create separate serializers for reading and writing Model.
Y
Hi I use for loop for my list. list example data={"name":"John} I use This code `{% for i in username %}
<span>{{username.i}}{{i}}</span><br>
{% endfor %}` But username.i dont give me result , if I write username give me all list if I write i give me list key But I write as key value
Erik
Mahdi
Hello guys
I wana learn django, can you share the good resources for learning?
William
MAK
May I know where to learn django
Maxim
ㅤㅤㅤㅤ ㅤㅤㅤ◡̈⃝ㅤㅤ ㅤㅤㅤㅤㅤㅤ ㅤㅤㅤ
William
Azizbek Xushnazarov
So i overrided user field in serializer like this:
class TaskSerializer(ModelSerializer):
user = StringRelatedField()
but StringRelatedField is read only
William
If you just want the username you can do it like this
user_username=serializers.CharField(null=True, source='user.username')
William
Azizbek Xushnazarov
Azizbek Xushnazarov
Azizbek Xushnazarov
cause the user field shoud get User instance not Charfield
ㅤㅤㅤㅤ ㅤㅤㅤ◡̈⃝ㅤㅤ ㅤㅤㅤㅤㅤㅤ ㅤㅤㅤ
Azizbek Xushnazarov
Azizbek Xushnazarov
it is supposed to be an id. but we override the field that now it require dictionary. that is why it is giving this error
Michael the wolf 🐺
Are there any opensource django web applications ? Rest api's
Charly
Michael the wolf 🐺
ok thnx
لزيز
Ok
William
Azizbek Xushnazarov
William
other
Share the error message you got.
Azizbek Xushnazarov
user field gets id as an int when creating a task model instance.
but Charfield does not like it.
Mirco
Сардор
how to edit existing pdf file and render to page ?
Azizbek Xushnazarov
Mirco
Otherwise you need a nested serializer by using a UserSerializer ( example name )
Mirco
If your FK is called user
Inside your model serializer you will have something like
user = UserSerializer()
Instead of a useless and wrong CharField
Azizbek Xushnazarov
Mirco
Azizbek Xushnazarov
nested serializer then 😊
In this case it serialize username and not pk and I love it. But I cant create model then 💀
Azizbek Xushnazarov
Azizbek Xushnazarov
since it returns str() which is equal to username 😊
Mirco
priyanka
Jupyter*
Nayan
Hi I am facing issue while serving media files
I am uploading files and it is going under media folder and it runs fine with local server
But gives 404 error at Apache server
Nayan
Can anyone guide me why this is because of ??
Bye world
Which one should I lean first? Database or Django
Mirco
Bye world
Peaches
Hi guys I wanna build Online payment system like Stripe and Paypal in Django
Peaches
Could you please share any resources that might help
Azizbek Xushnazarov
Azizbek Xushnazarov
Peaches
Peaches
As of know I do not understand how things flow in online payment system
Klaus
Actually I have doubt api..
Klaus
how its works ?
Klaus
i know to write code for api using drf but I do not how it is useful ?
Azizbek Xushnazarov