Sorry, it was my intention but had the wrong autocomplete. My apologies.

On Tue, May 28, 2013 at 10:00 PM, Angus Turner <[email protected]> wrote:
> You'd be better off posting this to django-users as this list is for the
> development of django itself.
>
> Thanks
> Angus Turner
> [email protected]
>
>
> On Wed, May 29, 2013 at 10:33 AM, Andres Osinski <[email protected]>
> wrote:
>>
>> Hi everyone, I've created a custom User model and reated a proxy for
>> it, like this:
>>
>> class User(AbstractUser):
>>     USER_KINDS = (
>>         ('d', 'doctor'),
>>         ('p', 'patient')
>>     )
>>      kind = models.CharField(max_length=2, choices=USER_KINDS)
>>
>> class DoctorManager(BaseUserManager):
>>     def get_queryset(self):
>>         return super(DoctorManager, self).get_queryset().filter(kind='d')
>>
>>
>> class PatientManager(BaseUserManager):
>>     def get_queryset(self):
>>         return super(DoctorManager, self).get_queryset().filter(kind='p')
>>
>>
>> class Doctor(User):
>>     objects = DoctorManager()
>>
>>     class Meta:
>>         proxy = True
>>
>>
>> class Patient(User):
>>     objects = PatientManager()
>>
>>     class Meta:
>>         proxy = True
>>
>> ----------------------------------------
>>
>>
>> Now, my admin has the following code:
>>
>> # Forms subclassing default auth forms
>> class DemographicsUserAdmin(reversion.VersionAdmin, UserAdmin):
>>     form = DemographicsUserChangeForm
>>     add_form = DemographicsUserCreationForm
>>
>> class PatientAdmin(admin.ModelAdmin):
>>     add_form_template = 'admin/auth/user/add_form.html'
>>     form = PatientChangeForm
>>     add_form = PatientCreationForm
>>
>>     def get_queryset(self, request):
>>         return Patient.objects.all()
>>
>> class DoctorAdmin(admin.ModelAdmin):
>>     add_form_template = 'admin/auth/user/add_form.html'
>>     form = PatientChangeForm
>>     add_form = PatientCreationForm
>>
>>     def get_queryset(self, request):
>>         return Doctor.objects.all()
>>
>>
>>
>> admin.site.register(User, DemographicsUserAdmin)
>> admin.site.register(Doctor, DoctorAdmin)
>> admin.site.register(Patient, PatientAdmin)
>>
>> ------------------------------------------------------
>>
>>
>> Now, this would seem to indicate that the proxy model admins would be
>> filtering only those users with the proper kind. However, not only is
>> this not happening, but the get_queryset() methods for either admins
>> is not running, nor the default objects() manager. Any idea why this
>> would be happening?
>>
>> Thanks
>> --
>> Andrés Osinski
>> http://www.andresosinski.com.ar/
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at
>> http://groups.google.com/group/django-developers?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-developers?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
Andrés Osinski
http://www.andresosinski.com.ar/

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to