Wednesday, June 27, 2012

Re: ManyToManyField is this right?

Ah, I think that makes sense. Sorry if I wasn't clear earlier on but yes, I am looking for instructors who are certified to teach a certain course. So basically a user could sign up and select some or none of the types of courses they are certified to teach this way other users who want to learn can find them easily. As far as the difference between NRA and CCL, there are several different types of NRA courses one could take however a Concealed Carry course is dependent on which state your certified to teach in. This is what was getting me all confused as I was trying to abstract the type of course from the actual courses provided since there are a number of organizations and individuals (not attached to an organization) that can provide not only courses but services, such as a state certified hunting guide (for instance in Alaska you need one to hunt large game).

I guess though from your example data structure I could put any type of organization, state, etc into the IssuingAuthority and when it comes time to create the profile forms I could just create a drop down list of all issuing authorities for a person to choose from and then populate a select box with all classes that belong to that issuing authority. I would like for people to be able to multi-select and have fields auto-populate all on one page at one time but I'll jump that hurdle when I get there I suppose. Probably need to dive into Javascript/Ajax to make that work.

Thanks much for your help.



On Wed, Jun 27, 2012 at 3:31 PM, Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote:
On Wed, 27 Jun 2012 11:48:22 -0700, David Wagner <cptnwinky@gmail.com>
declaimed the following in gmane.comp.python.django.user:

> Looking at that I think I may need to add a foreignkey to cert_types
> relating to person since a person can have multiple certification types
> (NRA Instructor, CCL Instructor, etc).

       Well, this has just added a different aspect... That of INSTRUCTOR
(my memory of the first messages came across more as a certificate that
one had attended a course <G>, not that it meant they could teach the
course).

       In the case of instructors -- what is the difference between "NRA"
and "CCL" instructor? "NRA" specifies an organization that provides the
certification in /something/, but "CCL" is a /something/ but who issues
it?

       Okay, looking at these as teaching certificates...

Certificates
       ID #primary key
       Name    #text string for the common name of the class
       IssuingAuthority        #NRA or government entity
       DateFirstAuthorized     #not date of issuance, but a double check that
                                                       #an issued certificate date does not come
                                                       #before the "class" was created
       RenewalPeriod           #how often the certificate needs to be renewed

Persons
       ID
       Name
       Address
       whatever

Issued                  #or PersonsCertificates if you want to name the sources
       ID
       pID             foreign key     (Persons.ID) #who this certificate was issued to
       cID             foreign key (Certificates.ID)   #what type of certificate
       DateIssued              #constraint DateIssued > DateFirstAuthorized
       CertificateNumber       #document number
       DateExpires             #for things that need to be renewed periodically
                                               #= DateIssued + RenewalPeriod
       UniqueKey (pID, cID, CertificateNumber)
               #including certificate number means you can track renewals
               #as a renewal would have a different serial number

       This is a many-to-many between Persons and Certificates, in which
the intersection table (Issued) contains additional information.


--
       Wulfraed                 Dennis Lee Bieber         AF6VN
       wlfraed@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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment