Thanks for all the replies and I think I'm getting it now but it gets more
complex too.

So NRA Licenses is essentialy going to become a type of several
certifications. For instance.

NRA Instructor

   - Home Firearm Safety Instructor
   - Refuse to be a Victim Workshop
   - and many more could be selected.....

CCL (or CCW in some states)

   - State in Which your Certified (possibility of multiple states)

Many more different types of licenses and certifications are going to be
added eventually so as you can see these relationships are going to get
complex. So If I'm grasping this correctly let me try some code to see if
I'm on the right track....

class NRA_Certs(models.Model):
    CRSO = models.BooleanField(blank=True, null=True, "Chief Range Safety
Officer")
    HFS = models.BooleanField(blank=True, null=True, "Home Firearm Safety")
    MCR = models.BooleanField(blank=True, null=True, "Metallic Cartridge
Reloading")
    PPH = models.BooleanField(blank=True, null=True, "Personal Protection
in the Home")
    PPO = models.BooleanField(blank=True, null=True, "Personal Protection
Outside the Home")
    PS = models.BooleanField(blank=True, null=True, "Pistol Shooting")
    RS = models.BooleanField(blank=True, null=True, "Rifle Shooting")
    SSR = models.BooleanField(blank=True, null=True, "Shotgun Shell
Reloading")
    SS = models.BooleanField(blank=True, null=True, "Shotgun Shooting")
    RTBVDW = models.BooleanField(blank=True, null=True, "Refuse to be a
Victim Workshop")
    RTBVO = models.BooleanField(blank=True, null=True, "Refuse to be a
Victim Online")
    NMLRA_MP = models.BooleanField(blank=True, null=True, "NMLRA
Muzzleloading Pistol Shooting")
    NMLRA_MR = models.BooleanField(blank=True, null=True, "NMLRA
Muzzleloading Rifle Shooting")
    NMLRA_MS = models.BooleanField(blank=True, null=True, "NMLRA
Muzzleloading Shotgun Shooting")

class NRA(models.Model):
    cert_type = models.ForeignKey(NRA_Certs)
    name = models.CharField() # Is this necessary? Can the name be set to
text in the boolean fields from NRA_Certs?
    expiration = models.DateField(blank=True, null=True)

Does that look right or am I missing it completely. I'm not sure sure on
the NRA_Certs all being boolean, my thinking is that whether they have that
certification should be as simple as true/false.

Thanks once again for all the help.


On Wed, Jun 27, 2012 at 7:38 AM, j_syk <jesyk...@gmail.com> wrote:> 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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
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