On Sep 28, 12:21 pm, Caisys <[EMAIL PROTECTED]> wrote:
> Hi,
> I am new to django and mvc. I have php and asp experience. I followed
> the tutorial and would like to create a site that will act as as a
> sort of city guide. to Simplify things I will assume the site will
> have 5 types of information:
>
> 1-Hotels
> 2- Monuments
> 3-Venues
> 4-Peformers
> 5-Concerts (have to be attached to a venue and a performer)
>
> I would like the urls to 
> behttp://mysite/hotels/name-of-hotel-one,http://mysite/monuments/name-of-monumentetc
>  and for the eventshttp://mysite/YYY-MM-DD/name-of-eventetc.
>
> I have a couple questions for now:
>
> 1- the first three items have the same data structure, text, address,
> description, picture. Should they be in one model or should I create a
> separate model for each type of records.

I would put them in separate models. As time goes on, you might want
to add more data which differs by type - eg opening times for
monuments, facilities for hotels - and that will be more difficult if
everything is in one model.

However, you can save work by having all three as subclasses from a
common model type. See here:
http://docs.djangoproject.com/en/dev/topics/db/models/#id4


> 2- .Will the primary key for each model be the text name in order to
> pass the key from the url to the view?

No need for that - you can pass anything from the URL to the view,
although obviously it helps if it uniquely identifies the instance.
Best to leave Django to manage the primary key (via the automatically-
created id field), and use a SlugField with unique=True to be the
value passed from the URL.

--
DR.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to