One to One is the right type for linking a user to a profile in the Django 
world. However I think you may be mixed up on the many to many. 
How you have it setup would lead to a User being connected to multiple 
License objects, each with a nra and ccl attribute. If I didn't realize 
what those stood for, I'd say you are right. But, I think that you might be 
thinking of it as the nra and ccl being separate licenses so in that case 
they shouldnt be the same object

Here's what I'd recommend. Either put those two booleans directly on the 
profile model or make the License class more generic for any relevant 
details of a potential license. For example

class License(models.Model):
    name = models.CharField(max_length=255)
    expiration = models.DateField(blank=True, null=True)
    details = models.TextField()

With something like this, the User could have multiple licenses like: 
Concealed Carry 5/10/2015 and NRA no expire .

On Wednesday, June 27, 2012 8:57:24 AM UTC-5, David Wagner wrote:
>
> I'm a self taught programmer who hasn't done much of anything for years so 
> please forgive me if this question is naive. I have a hard time sometimes 
> understanding some of the lingo used by trained programmers.
>
> With that said, I'm having trouble wrapping my brain around the ManyToMany 
> and Many-To-One and OneToOne concepts. I'm trying to create a multi-select 
> option for a user profile in which a user can have multiple attributes of a 
> certain kind. Right now I'm just working on the model. This is what I have, 
> is it right?
>
> # Different licenses for instructors to select from
> class Licenses(models.Model):
>     nra = models.BooleanField()
>     ccl = models.BooleanField()
>
> # User Profile Model
> class UserProfile(models.Model):
>     user = models.OneToOneField(User)
>     
>      #.......
>
>     licensed_instructor = models.ManyToManyField(Licenses)
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/VModQy3bu7UJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to