On 12-06-27 8:02 AM, David Wagner wrote:
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.
Probably not. What happens if another new cert gets added to the the
list? You will want a separate table entry for each kind of cert so when
"Howitzer" gets added you can make that available without changing your
models, only changing your data in the database.
afaict your new proposed class "NRA" does not add value here. Have
certs, and have users. Should be enough.
You do have more than one piece of info for the cert model: an acronym
and a long name or description. Those should be two fields in the model.
Then use the many to many relation to allow multiple certs for each user
and to allow multiple users to have the same cert.
hth
- Tom
- Tom
--
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.