Caisys 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 be http://mysite/hotels/name-of-hotel-one,
> http://mysite/monuments/name-of-monument etc and for the events
> http://mysite/YYY-MM-DD/name-of-event etc.
>
> 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.
> 2- .Will the primary key for each model be the text name in order to
> pass the key from the url to the view?
>
> Thanks
> Ahmed
>   


1.  The answer to your model question is "either way".
If you combine different types into 1 model you will need a new field 
called "type" or something similar. This "may" be a good idea if you 
think you may be adding new types in the future.
To be consistent though, it "may" be better to have a model for each 
type.  The correct answer to this decision will only be known in time as 
you start to implement different parts of your site.

2.  Django will add an "id" field to each of your tables which will be 
the primary key (this is the default behavior but can be changed).

The names of your URL's are defined in the URL dispatcher, see 
http://docs.djangoproject.com/en/dev/topics/http/urls/

Regards,

Ray Smith
http://RaymondSmith.com
P.S. I'm just a newbie as well so I "may" not be 100% correct :)


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to