Can't reference related object inside model property

2019-05-08 Thread Ajat Prabha
I have to display a calculated property in the model admin's list_display. ```python class A: # attributes class B: a = models.OneToOneField(A, on_delete=models.CASCADE, related_name='b_obj') timestamp = models.DateTimeField() class AProxy(A): @property def calc_prop(self):

Getting no such table: django_session error after enabling social_django in a project

2018-09-06 Thread Ajat Prabha
Hi, After adding social_django to this project, in some of the pages, the server is throwing OperationalError no such table: django_session, which is kind of weird because it is there. Most of the functionality is working fine but some things

Re: CI build failing but local builds pass

2018-08-01 Thread Ajat Prabha
The issue is fixed now, it happened because Travis used PostgreSQL v9.2 by default and Django v2.1 works with v9.4+ (changelog <https://docs.djangoproject.com/en/2.1/releases/2.1/#dropped-support-for-postgresql-9-3> ) On Wednesday, 1 August 2018 23:47:16 UTC+5:30, Ajat Prabha wrote:

CI build failing but local builds pass

2018-08-01 Thread Ajat Prabha
Hi, I'm working on a hobby project and the issue I'm facing is that the CI build is failing and I'm not sure why is this happening. The only difference is that I updated

Re: Need help in calling dispatch on custom mixin for authorization

2017-06-15 Thread Ajat Prabha
I was able to resolve the issue. In mixins.py, .get_object() was unresolvable so I inherited from SingleObjectMixin also I had to use the id to check equality. from django.contrib.auth.mixins import LoginRequiredMixin from django.core.exceptions import PermissionDenied from

Re: Need help in calling dispatch on custom mixin for authorization

2017-06-15 Thread Ajat Prabha
There's a typo in > if request.user.is_authenticated() and request.user is not > self.get_object().owner.user: It is > if request.user.is_authenticated() and request.user is not > self.get_object().author.user: But still, it doesn't work. Same issue persists. -- You received this message

Re: Need help in calling dispatch on custom mixin for authorization

2017-06-14 Thread Ajat Prabha
Can someone point out what is wrong in the code? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this

Need help in calling dispatch on custom mixin for authorization

2017-06-12 Thread Ajat Prabha
Hi there, I'm learning django and creating a forum for this purpose, now I have a Topic model and I want to create an UpdateView for it, but what I want is that a user should be logged in and owner of that topic, only then the author can edit it. For login part, I'm using LoginRequiredMixin and

Re: Filter queryset based on another model's foreign key in a class based view.

2017-06-10 Thread Ajat Prabha
Thanks, Melvyn Sopacua, Now it all makes sense. On Saturday, 10 June 2017 21:54:57 UTC+5:30, Melvyn Sopacua wrote: > > On Saturday 10 June 2017 08:22:20 Ajat Prabha wrote: > > > > > > > class TopicDetailView(generic.DetailView): > > > > model = Top

Filter queryset based on another model's foreign key in a class based view.

2017-06-10 Thread Ajat Prabha
Hi there, I'm having trouble in filtering objects of a model based on another model's foreign key. The scenario is, I've got a forum homepage and when a topic is clicked, it opens its DetailView. Now if I try to get all answers in the database there's no issue, but I want to get only the

Re: Need help in Django User Model customization and authentication

2017-05-18 Thread Ajat Prabha
would be to simply put *all* possible fields on > UserProfile and just populate them based on affiliation. That's not very > clean though, because if someone stops being faculty for instance, it would > be tricky to ensure you remove all of the right field data (it's messy). So >

Re: Need help in Django User Model customization and authentication

2017-05-18 Thread Ajat Prabha
rks very well in almost all cases. > And if you go that way then authentication/authorization based questions > should not bring any worries at all. > > But may be I missed something. > If so, please provide us with more concrete questions. > > Regards, > Constantine C.

Need help in Django User Model customization and authentication

2017-05-13 Thread Ajat Prabha
Hello everyone, I'm creating a payment gateway to make transactions on my college campus go cashless. It can be used to pay library dues, stationary charges, etc. The user will add money to a central account and then he/she can use that money virtually. I chose Django because of its security.