Tuesday, July 1, 2014

Re: Creating subusers

On 2/07/2014 3:16 PM, Lachlan Musicman wrote:
> I would recommend Intermediate Models as a good solution for these
> type of weird situations
>
> https://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships

+1

>
> Cheers
> L.
>
> On 2 July 2014 12:20, Jorge Andrés Vergara Ebratt <javebratt@gmail.com> wrote:
>> Hello everyone,
>>
>> I'm trying to create a system that has 3 different user types:
>>
>> Independent Agent, that basically is what it sounds like, and Django's User
>> Model works fine for this one.
>>
>> But the catch comes from the other 2, because it also needs to support
>> agencies and agencies have sub-users...
>>
>> I'm trying to figure out the best way to do this, currently I'm trying with
>> User profiles but don't really know if what I'm doing is correct, I'm doing
>> this:
>>
>>
>> class IndependentAgent(models.Model):
>> user = models.OneToOneField(User)
>> tipo_licencia = models.CharField(max_lenght=140)
>>
>>
>> class AgencyUser(models.Model):
>> user = models.OneToOneField(User)
>> agency = models.ForeignKey(User, related_name='Agency')
>>
>>
>> Can I do this? Like that user profile for Agency User would let me 'asign'
>> those users to their respective agencies so that later I can set my code
>> that those users can only see that agency's information?
>>
>> Or would making groups be better to handle this kind of situations?
>>
>> Appreciate any help I can get, thanks in advance
>>
>>
>> --
>> Jorge Andres Vergara Ebratt
>> #SoftwareDeveloper (Or at least trying to be)
>> @javebratt
>> facebook.com/javebratt
>>
>> --
>> 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+unsubscribe@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAAeX05Gc6gnjdDi%3Dv%2B-n72mSi1JWdO1ecYUQORogvMifAw5o7w%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/53B3ADE0.8060604%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment