The question is how do I relate this to the business_types in the
FulLProfile model? Since a business can have multiple "Premises"

On Jun 16, 4:44 pm, Peter Bengtsson <pete...@gmail.com> wrote:
> Without caring or even attempting to understand your business I sounds
> like you just need to stop using a BooleanField() and instead use a
> ForeignKey(null=True) and then judge if it's "on_premise" by a method
> rather than a field something like this:
>
> class MyModel(Model):
>     related_premise = ForeignKey(Premise, null=True)
>     def on_premise(self):
>         return self.related_premise is not None
>     def get_related_premise(self):
>         assert self.on_premise()
>         return self.related_premise
>
> On Jun 16, 3:39 pm, Nick <nickt...@gmail.com> wrote:
>
> > OK, here's the deal. I'm working up an obituary site. There are 3
> > models/tables and at one point I need to connect two in a way that is
> > different than I have done up to this point. Here is the situation,
> > any recommendations on how to accomplish this would be great:
>
> > I have an obituary table. In that table there is a field that checks
> > if a funeral service is on the premises (column name "on_premises" of
> > the Funeral Home that is entering the information.
>
> > If this BooleanField is checked then it returns the location
> > information of the funeral home which is stored in a business_profile
> > table. Not difficult, just check if the boolean returns a value and
> > then populate the template
>
> > That works out nicely except I have been given an extra criteria for
> > this project. Some business have both a funeral home and a
> > crematorium. Many of these situations require that we list the address
> > of one or the other. Since the "on premises" is a BooleanField there
> > is no way for someone to state what part of their business is
> > responsible for the service.
>
> > What I would like to do is make this option a drop down in the
> > obituary form that basically gives the business the option of choosing
> > which one of their locations is the one we want attached to this obit.
> > Once this is chosen then I will pull the value into the templates.
>
> > How do I relate these models? My first thought is to create two
> > "business type" columns in the business profile table and then relate
> > the "service_location" column to these columns in a drop down? Is that
> > even possible?
>
> > How do I retrieve the values from two different fields and then select
> > from them in another model?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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