Anonymous
Abrar
return render (request, self.template_name,context={'data':data}
R.U.S.H.A.B.H
Hs anyone made Django project for student and teacher?? I want tl build that app but not getting how to handle many users with 2 administration!?
Abrar
Beka
Anonymous
R.U.S.H.A.B.H
R.U.S.H.A.B.H
Beka
Anonymous
Anonymous
Beka
Anonymous
def get_queryset(self):
return *whatever you want to*
Beka
Anonymous
The
I tried twice for training manager.
Their interview process is worst.
Anonymous
Beka
I have no idea, how your model connected. If two model isn't conntedted then you need to work with get_context_data. If somehow connected then you need to focus on getting categories with related_name.
Anonymous
Class ListTaskView(ListView):
model = task
catCount = Category.objects.all().count()
Field = "__all__"
And I want to pass catCount to my template
Anonymous
Beka
Anonymous
What will be the correct approach?
Beka
Use get_context_data
Beka
Anonymous
Use get_context_data
Ok buddy...can you give me a example
Otherwise will get through google
Thanks
Beka
Beka
Welcome!
Beka
I just want to show how you can use django generics.
You are doing it little bit wrong way.
class ProductCategoryView(ListView):
model = Product
template_name = 'product/product_category.html'
context_object_name = 'products'
paginate_by = 6
paginate_orphans = 1
page_kwarg = 'category'
Focus on first three fields.
This is the correct approach of using generics.
Anonymous
Ok thanks....buddy😊
Lone
Hey,I know the basics of python,oops concepts, HTML and CSS is it possible for me to learn and understand Django framework
Beka
Possible!
Lone
Hey thx man that motivated me
dilip
Hi,I am hosting django on IIS webserver.for load balancing I have 2 servers. The problem comes up with media files. If user 1 logs in, it might take to server1 or server 2 randomly. So if user stores a file in server and sometime in future he wants to view it, but server is logged to server 2.it throws a error saying no file exist. So I created a shared path and assigned that path to media files in settings. Now the problem is path says permission denies on hosting site, but runs fine on url. Any thoughts how to fix it??
dilip
Basically any idea how to set up a common storage server??
Chandraprakash
How to save extra fields along with username,password while registering a new user in Django rest framework
Chandraprakash
Please help if anybody knows about this
Chandraprakash
I m creating a api which takes users details and I have register that user in the system along with all the information he gave
nightescapist
Beka
Chandraprakash
How to do that
Chandraprakash
Do you have any video or something
Chandraprakash
I can refer to
Murshid
Beka
Mehmet
How to do that
https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html
This post shows how to handle extending the User model.
Mehmet
I personally use a secondary OneToOne related Profile and implement custom authentication and authorization over User and Profile via DRF
Chandraprakash
dilip
Can we serialize multiple models in a single serializer in REST framework
Beka
Mehmet
If there is not a relationship between models to be serialized, you can use serializermethodfield. In order to handle N+1 errors again cache your subquery per object with a single query by overriding outer serializers init function.
Mehmet
I answered supposing your need is nested multiple serializer, if you wish to create single depth multiple serializer then you can use SerializerMethodField, or JsonField if your base field is JsonObject. SerializerMethodField is always insecure because it may leak memory if you use global variables, and it is very high probability that you create N+1 situation, always try to log your queries in development.
Stv
dilip
dilip
Reason?
Needed for my project. Have 4 models where 3 models are foreign keyed to parent model.
Anonymous
Anonymous
But u should write 3 serializers for child models..and inherite them in the parent serializer
Rishabh
Hi friends,
I want to create a website ,
Using django in which pdfs is uploaded n there is one search bar .
Function of search bar is to list out pdfs which contains particular searching word
Rishabh
Any 1 please. Help
Rishabh
How much this took the time to create this website
Beka
Just do it, man. Just do it.
Anonymous
Anybody here Contributing to Django open source?
محمد دلشاد
how can i use mobile number otp verification in django??
i hate milk
hello all.
how can i check that the request was made on the frontend?
i hate milk
maybe i need jwt-tokens? or not?
Nikkey
Sai
Hi guys i am designing a app and i need to render google maps by passing.dynamic maps url every time. How do i pass to iframes from django
Sai
محمد دلشاد
We can use foriegn key relation to get all datas in a select dropdown
How can i only get the data which are have a specific value in its one field
محمد دلشاد
https://hastebin.com/suciluzuxo.coffeescript