Re: Customizing Django built-in views such as LoginView

2020-05-29 Thread אורי
Thank you. אורי u...@speedy.net On Fri, May 29, 2020 at 3:57 PM Augusto Destrero wrote: > I would choose the second option and define a LoginView subclass in the > views.py module. > The outcome is exactly the same, but I'd prefer to have my views all > defined in views.py file. > Adding too

Re: Can You please help me out!!!

2020-05-29 Thread meera gangani
I Want to implement Mark all a read in notification!! So What should i do!! Can you explain me a little bit of this! On Sat, May 30, 2020 at 8:46 AM meera gangani wrote: > Thank you So much for helping me out!! > Thanks a lot > > Meera Gangani > > On Fri, May 29, 2020 at 5:08 PM Sencer Hamarat

Re: Can You please help me out!!!

2020-05-29 Thread meera gangani
Thank you So much for helping me out!! Thanks a lot Meera Gangani On Fri, May 29, 2020 at 5:08 PM Sencer Hamarat wrote: > Hi Meera, > > You have only one record because of you are using .latest() method in the > query. > > If you want to last 3 or 4 object ordered by descending date, you

Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-29 Thread Matt D
> > Hello Iain, > I am also working on Mosh's python tutorial and I'm having the same problems that you expressed in this chat. Did you delete the migrations through pycharm or through your computer to make it work? Thanks -- You received this message because you are subscribed to the Google

AttributeError when returning post.title in a comment model

2020-05-29 Thread Ahmed Khairy
I was working on a comment section for post and was getting an AttributeError when I return return '{}-{}'.format(self.post.title, str(self.user.username)) in the comment model I am trying to link users and posts to the comment I am getting the same error Here is the Models.py class

Re: help on jwt

2020-05-29 Thread ola neat
ea i checked the permission_classes variable, i got attached the error message displayed On Thu, May 21, 2020 at 4:34 PM Chetan Ganji wrote: > If you post the error, someone can help you better. > > Did you look into authentication_classes variable of the endpoint ??? > > Regards, > Chetan

Soy nuevo en el Foro

2020-05-29 Thread Mateo Carbajal Montiel
Hello, good day everyone on the forum, I am new to the topic, but I have the basic notions and it makes me quite interesting, I would ask you to recommend books, documents, to understand the topic further, excellent day, greetings. -- You received this message because you are subscribed

Re: filter on multiple tables

2020-05-29 Thread Soumen Khatua
Thank You, for your guidance.I think I'm very close to this problem. Thank you once again. ‪On Fri, May 29, 2020 at 9:56 AM ‫אורי‬‎ wrote:‬ > Hi Soumen, > > You can filter on another table by using __, for > example: > > User.objects.filter(profile__profiles__institute_name="Example") > > Or:

Re: Optimized Query

2020-05-29 Thread Soumen Khatua
Hi, Yeah, but whenever I'm trying to iterate a loop on all these qs. I'm getting an *error too many sql variables.* I know I'm doing something wrong,but I'm not able to find the error. Thank you for your response and time. Regards, Soumen ‪On Fri, May 29, 2020 at 5:49 PM ‫אורי‬‎ wrote:‬ >

Re: filter on multiple tables

2020-05-29 Thread Soumen Khatua
Hi, whenever I'm trying to filter as per your convention I'm getting some error like FieldError: *Eg.* *profile = Profile.objects.filter(education__profile__institute_name="IIT KGP")* of course, I'm getting this error because Profile is working here as a Foreign Key, in Education table.

Re: function model which generate a code for model field

2020-05-29 Thread Derek
I would not assume what "previous" means. Rather use post_save to get the actual ID of the current recording. On Friday, 29 May 2020 12:43:19 UTC+2, Anselme SERI wrote: > > Hello Derek, > Is it possible to retrieve the id of the previous recording from this > function? If possible I could

Re: How models.Manager is working behind the scene and calling different serialize methods?

2020-05-29 Thread django-newbie
Ohk, I got it now.. Thanks for clarifying this. My further doubts in continuation of this are. 1. For confirmation, ModelName.objects.all() calls get_queryset() method, while ModelName.objects.get calls get() method internally. 2. In above code to override default serialize method of

Re: Customizing Django built-in views such as LoginView

2020-05-29 Thread Augusto Destrero
I would choose the second option and define a LoginView subclass in the views.py module. The outcome is exactly the same, but I'd prefer to have my views all defined in views.py file. Adding too much logic in the urls.py module IMHO is not a good idea and it makes the view less extendable in

Re: Parallel or split payment options using paypal

2020-05-29 Thread Akshat Zala
Hi John I agree with Kasper. Regards, Akshat On Thursday, 28 May 2020 01:31:03 UTC+5:30, Kasper Laudrup wrote: > > Hi John, > > On 27/05/2020 19.06, John McClain wrote: > > Hello All, > > > > Can anyone provide a method to split payments via paypal. I basically > > want to earn a

Customizing Django built-in views such as LoginView

2020-05-29 Thread אורי
Django users, Which way is preferred to customize Django built-in views such as LoginView: - Define a line in urls.py: path(route='login/', view=views.django_auth_views.LoginView.as_view( template_name='accounts/login.html', authentication_form=forms.LoginForm, extra_context=None,

Re: Optimized Query

2020-05-29 Thread אורי
They both work for both. אורי u...@speedy.net On Fri, May 29, 2020 at 12:47 PM Sencer Hamarat wrote: > I thought select_related works for only FK/M2M and prefetch_related works > for only reverse relations, doesn't it? > > Saygılarımla, > Sencer HAMARAT > > > > ‪On Fri, May 29, 2020 at 7:32 AM

Re: Templates vs. source code

2020-05-29 Thread אורי
Thank you. אורי u...@speedy.net On Fri, May 29, 2020 at 12:56 PM Sencer Hamarat wrote: > Hi Uri, > Never expose whole settings anytime. settings is always includes sensitive > data. At least DB access key and Django's secret value. > This attitude is highly vulnerable. Anyone could access

Re: Can You please help me out!!!

2020-05-29 Thread Sencer Hamarat
Hi Meera, You have only one record because of you are using .latest() method in the query. If you want to last 3 or 4 object ordered by descending date, you should write queryset like this: notifications = Notification.objects.all().order_by('-date')[0:x] # The 'x' could be 3 or 4 by your

Re: function model which generate a code for model field

2020-05-29 Thread Anselme SERI
Hello Derek, Is it possible to retrieve the id of the previous recording from this function? If possible I could increment it to get the id of the current recording. Anselme S. Le ven. 29 mai 2020 à 06:08, Derek a écrit : > The suggested code will not work because, at this point, the "id" has

Re: How models.Manager is working behind the scene and calling different serialize methods?

2020-05-29 Thread Sencer Hamarat
I believe, the method "get_query*set*" name is explains what you want to know. If you filter or fetch every thing with django query, it returns queryset. The .get() query on the other hand, returns a single object. Saygılarımla, Sencer HAMARAT On Fri, May 29, 2020 at 4:43 AM django-newbie

Re: Templates vs. source code

2020-05-29 Thread Sencer Hamarat
Hi Uri, Never expose whole settings anytime. settings is always includes sensitive data. At least DB access key and Django's secret value. This attitude is highly vulnerable. Anyone could access those sensitive data via response headers if you don't play settings without cautious. Saygılarımla,

Re: Optimized Query

2020-05-29 Thread Sencer Hamarat
I thought select_related works for only FK/M2M and prefetch_related works for only reverse relations, doesn't it? Saygılarımla, Sencer HAMARAT ‪On Fri, May 29, 2020 at 7:32 AM ‫אורי‬‎ wrote:‬ > Hi Soumen, > > Sometimes prefetch_related is much faster and more efficient than > select_related.

Re: function model which generate a code for model field

2020-05-29 Thread Derek
The suggested code will not work because, at this point, the "id" has not yet been generated by the database (unlike the other data which is typically entered by the user). You will need to move this code to a post_save signal function -