i think I may just be over thinking this. The last time I did any
significant coding for the web as pre-php5 and so this whole MVC thing is
something to adapt too for sure.

I think I need to start thinking of the Model in the same way I would
design a database back in the day with phpMyAdmin. I think I'm getting
bogged down in trying to understand how it will relate to the View. Perhaps
I need to just put the View out of my mind for the time being.

So thinking of this as just a database schema it would be something like
(in psuedo-code)....

cert_types

   - type
   - date_created

certs

   - type = foreignkey(cert_types)
   - name
   - state (optional)
   - date_created

person

   - name
   - etc...
   - certificates = foreignkey(certs)

Does that make sense? If so each table would be represented by a single
class and I think I understand then how they relate to each other and I
just need to stop worrying about the View.

Thanks for all your patience everyone as well. Like I said, I'm not
classically trained in computer science so there are a lot of concepts that
elude me and some lingo that I don't get but the concepts I may grasp if I
just understand the translation.
On Wed, Jun 27, 2012 at 10:55 AM, Dennis Lee Bieber
<wlfr...@ix.netcom.com>wrote:

> On Wed, 27 Jun 2012 08:02:37 -0700, David Wagner <cptnwi...@gmail.com>
> declaimed the following in gmane.comp.python.django.user:
>
> >
> > 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")
> >
>         Ugh!...
>
>        I'm not familiar enough with Django's internal format so I'm using a
> form of old relational theory notation: tablename(_key_, /foreignkey/,
> other, fields...)
>
> NRACertificate(_ID_, certificateName, other, type, specific,
> attributes))
>
>        {I forget your individual model so a generic}
>
> Person(_ID_, name, other, stuff)
>
> Person_NRACertificate(_ID_, /personID/, /nracertificateID/,
> dateCertified, dateExpires, other, certificate, specfic, data)
>
>        Django can build this intersection table automatically -- but it
> would only have _ID_, /personID/, /nracertificateID/! I think, for your
> information, you'd want to define your own "through" table to hold the
> data specific to an instance of a certificate as held by a person.
>
>        Same with concealed carry permits IF you need a list on a, say, per
> state basis.
>
>        Note though, that if the /lists/ don't carry any significant
> information beyond the name of the item, you just need one-to-many
> configurations. For example, if the only information you track for CCW
> is: who (foreign key to Person), license number, issuing state (or other
> government entity), date issued, date expires... then a one-to-many is
> all you need. (Though you may find you need another one-to-many --
> California's rare CCW includes a list of /which/ firearm(s) are
> permitted [if you sell one gun and buy a different one, you have to beg
> the government to update the CCW with the new gun's information]).
>
>        The NRACertificates table may also not be needed if all it provides
> is a list of names to populate a dropdown selection box -- might speed
> up processing by just hard-coding the list and saving the name directly
> (replace the /nracerticateID/ in the intersect table with the actual
> text of the certificate as selected from the dropdown selection.
>
>        Bigger note: You will NOT be using a multiple selection list... More
> reasonable is an "add new certificate" button which brings up a form
> from which to select one certificate (by name in dropdown), and fields
> for the dates, and whatever else is common to certificates.
>
>        When displaying a person, the certificates would be (if I recall
> Django terms) a "formset" (where the "form" is for a single
> certificate's data).
> --
>        Wulfraed                 Dennis Lee Bieber         AF6VN
>        wlfr...@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
>
> --
> 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.
>
>

-- 
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