Francis
Thank bro...
Francis
How do I get a list of the fields only
Francis
Yeah
Francis
I dnt need the 'model' and the 'pk'
Francis
just the name
Mirco
YourModelClass._meta.get_fields() should work
Francis
Gives an error: Object of type ManyToOneRel is not JSON serializable
Francis
Yes, I am getting the serialized data
Francis
But in it, there is the ''model'' and ''pk''
Francis
I dnt need them
Francis
That is what I am using bro... (Django Rest Framework) right !?
.
Yes
Francis
I got a query set, and want to return to user...
.
Pass qs to serializer and make many=True
.
For relation fields make your own fields in serializer
.
Or exclude if you don't need them
Francis
But am not able
Francis
let me try that
.
Show code
.
May be we can help
Francis
categories = profile.category.all() return JsonResponse({'status': '00', "categories": categories}, status=status.HTTP_200_OK)
.
You are not using DRF
.
Use DRF serializer
.
Make CategorySeriliazer class
.
Pass qs to it CategorySerializer(qs, many=True)
.
And return serializer version
.
As CategorySerializer(qs, many=True).data
Francis
Okay... just a min
Francis
"non_field_errors": [ "Expected a list of items but got type \"QuerySet\"." ]
Francis
Same error
Francis
Are you following this ?
This returns: [ { "model": "category", "pk": 2, "fields": { "name": "Music" } } ]
Francis
But I just wante list of the name
Francis
Maybe I can use a for loop to get the fields.... is it advisable !!?
.
But I just wante list of the name
Bro you can get list of field names. Then convert it to JSON like objects. You can then dump to JSON l. And return string
Matvey
Hello guys, Can you help me? Please I add field my custom user model in UserCreationForm and not see this fields in django admin https://gist.github.com/Tingaev/f448ad8f123bcb15695d11b481f19cc5
Francis
Oksy, thank you... ill try
Sampreeth
Hey guys Before deploying the django project should we change DEBUG=true to DEBUG=false
cj
Hey guys Before deploying the django project should we change DEBUG=true to DEBUG=false
you have 2 options: 1. Have, at least, 2 separate files to load settings, for dev and prod, in dev you can have DEBUG=True and in prod you should have DEBUG=False 2. Load the value for DEBUG from an environment variable. My advise: go for option number 1
Sampreeth
Is firebase is best to use in django
cj
Is firebase is best to use in django
define: "best" and, Django works better with PostgreSQL, but you can use any other DBMS you want
cj
you just have to know what you're doing
Sampreeth
Ok
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
I had a question.
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
Is it possible to create a application of a website with Django?
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
will Django be enough for that?
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
I mean application for mobile phones .
Sardor
I do not think so, others correct me if I am wrong
Anonymous
yes it is
eee Sardor qalay iwla o'qiwla qoyile uchragan joyni qarang!
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
cos there is a web project and we wanted to create an app for this to log in from mobile phones
Anonymous
😂👍🏻
😂😂😁😁
Sardor
cos there is a web project and we wanted to create an app for this to log in from mobile phones
we have a web app in django, but the mobile team developed a mobile app in react native, and we had to write APIs for them.
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
Thanks)
Mohamed
cos there is a web project and we wanted to create an app for this to log in from mobile phones
You can use PWA that make your website appear like app on mobile
007
Suppose there are 2 fields in table (1) date & (2) production. If i want to select date from 11-01-2019 to 13-02-2019 in between this date the i want to display available production data
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
You can use PWA that make your website appear like app on mobile
We just wanted to create an app! to make it more comfortable)
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
You can use PWA that make your website appear like app on mobile
Bu thank you anyway)) we will look through this way as well))
007
Is there any method to aggregate data
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
Mohamed
just the name
https://pastebin.com/4s5G5wnL
Anonymous
I do not think so, others correct me if I am wrong
Idk about purely in django. I've never seen anything in pure
Anonymous
Like SQL for server. Html, JavaScript or anything else for scripting
Anonymous
Etc
Anonymous
Etc - end of thinking capacity
007
What data?
Kaushal: Suppose there are 2 fields in table (1) date & (2) production. If i want to select date from 11-01-2019 to 13-02-2019 in between this date the i want to display available production data aggregate
.
In Django ORM?