Re: Protecting the files...

2019-10-07 Thread Pradeep Sukhwani
Hi Suraj, Here <https://b0uh.github.io/protect-django-media-files-per-user-basis-with-nginx.html> there is a detailed example of restricting access to media and static files based on per user. -- Thanks Pradeep Sukhwani On Monday, October 7, 2019 at 4:12:36 PM UTC+5:30, Suraj Thapa FC

Re: ListView from 2 model

2019-10-07 Thread Pradeep Sukhwani
Hi Yann, You can try queryset union functionality: class MultiFilterPlacesListView(ListAPIView): """Custom queryset api view. Does not implement pagination""" pagination_class = None # Import custom pagination if you need the pagination. queryset = Places.objects.all() slice

Re: I want to know about how to implement elastic search in the python django

2019-10-07 Thread Pradeep Sukhwani
://django-haystack.readthedocs.io/en/v2.4.1/installing_search_engines.html#elasticsearch> and if you still have doubts do let us know. -- Thanks Pradeep Sukhwani On Wednesday, October 2, 2019 at 8:39:28 PM UTC+5:30, sachinbg sachin wrote: > > Implimentaion of elastic search in django python

Re: for loop template

2019-10-07 Thread Pradeep Sukhwani
s/> (For creating the custom template filter) Example: StackOverflow <https://stackoverflow.com/a/29664945/10353116> -- Thanks Pradeep Sukhwani On Friday, October 4, 2019 at 8:21:44 PM UTC+5:30, Luca Bertolotti wrote: > > from the view i give to the template the following

Re: Why would check_password(..) return True but authenticate(.., ..) never return user?

2019-10-07 Thread Pradeep Sukhwani
Hi Christian, authentication() functions takes request parameter if the request is None it will simply break the for loop. Check the source code <https://docs.djangoproject.com/en/2.2/_modules/django/contrib/auth/#authenticate> of authenticate. -- Thanks Pradeep Sukhwani On

Re: [Django] Any generalised or optimized way of handling multiple class based generic listviews in django ?

2019-10-07 Thread Pradeep Sukhwani
Hi Dilip, A few days back I stuck at the same issue, then I tried with the queryset union functionality: class MultiFilterPlacesListView(ListAPIView): """Custom queryset api view. Does not implement pagination""" pagination_class = None # Import custom pagination if you need the pa

is_friend relation

2019-07-28 Thread Pradeep Sukhwani
Your question is vague. Share an example may be piece of a code or a scenario that can help us to understand product requirement more clearly. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving ema

Re: Djago Rest framework Error

2019-07-28 Thread Pradeep Sukhwani
I'm assuming you have used ModelViewSet. In that you can always call this method: def get_serializer_class(self): if self.request.user and self.request.user.is_authenticated: return ProfileSerializer else: return UserSerializer -- You received this message because you ar

Re: Djago Rest framework Error

2019-07-28 Thread Pradeep Sukhwani
id(): return Response(serializer.validated_data) On Sunday, July 28, 2019 at 2:38:47 PM UTC+5:30, Soumen Khatua wrote: > > How I can hold Profile details and them save it after provide the user > field details, Cn you tell me how i can do that? > > Thank you > > Regards, > Soume

Re: Djago Rest framework Error

2019-07-28 Thread Pradeep Sukhwani
Hi Soumen, ModelSerializers do not behave in exactly the same way as ModelForm. However, there are intentional design decisions behind these differences. commit is not (and won't ever be) a keyword argument to save(). I believe that the usage of .save() is pretty much adequately documented he

Re: Model Related Issue

2019-07-28 Thread Pradeep Sukhwani
You can always use serializers. Have a look at declaring serializers and then you can call that serializer in your APIView. If this doesn't help then share your code. On Saturday, July 27, 2019 at 11:18:59 PM

Django deployment on production gives error SuspiciousFileOperation

2018-12-18 Thread Pradeep Sukhwani
Hi Mohit, Can you please share the settings.py file which is being used for production? Specially that part where you have defined the static_url and static_root -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and

Re: New to Django

2018-12-16 Thread Pradeep Sukhwani
Normally this type of issue comes when you are not using the environment where Django is installed or maybe you forgot to install Django. To confirm Django is install successfully run this in your terminal: python -c "import django; print(django.get_version())" On Saturday, December 15, 2018 at