Humble-structure sites on Django // Suggestion needed

2 views
Skip to first unread message

tezro

unread,
Dec 17, 2009, 8:42:58 AM12/17/09
to Django users
Hello everyone. Making well-structured websites on Django is a very
comprehensive process. All these blogs, news, user-related stuff -
easy. But what about, say, corporate website? I mean I got a project
to do, thought it would be great to base it on Django as usual, but...

Look at the structure, it's pretty easy.

/
––/about/
––/contacts/
––/history/
––/projects/
––––/project1/
––––/project2/
––––/project3/


All the pages should have some meta fields, text field to show, slug -
something that is common for all pages. Now what is different for all
that pages.

Contacts page in addition to common fields should have fields in admin
to edit: 2-4 phone numbers, link to Gmap, ImageField and a ForeignKey
for people related to contacts page (separate model with some fields).

Projects page should have an ImageField too and a ForeignKey for some
projects (separate model with some fields).

About page should have ImageField, 2-5 FileFields, another TextField
and some files as a ForeignKey model.

So, as you see, there should be a number of different editable...
things. All of them with differend fields and some with related
models...

Is it really easy to implement using Django? I'm not really sure how
to do that...

Thanks for replies ahead.

Brian McKeever

unread,
Dec 19, 2009, 3:09:47 PM12/19/09
to Django users
I'm not sure I'm entirely understanding your question, but yes, that
does look easy to implement with django.

What part is troubling you? You seem to have a good idea of what you
want.

tezro

unread,
Dec 20, 2009, 10:15:28 AM12/20/09
to Django users
Thanks for reply.

The main trouble for me is nearly how to do that "right" with the MVT
layer. I'm not really sure how to write models for such a small yet
compound structure.

How do I make, say, the first and second pages (about and contacs)
with some different fields? I will reproduce the method for all other
pages and repost here or question it again.

Brian McKeever

unread,
Dec 20, 2009, 3:19:57 PM12/20/09
to Django users
If the about page is static, you probably don't need any models for
it. A simple template should do, or you could use flat pages if you
want your client to be able to edit it easily on their own.
http://docs.djangoproject.com/en/dev/ref/contrib/flatpages/

The contacts page probably just needs a Contact model with the
appropriate fields, and then you can make a template that displays
them all in the same page (or paginates them if there's a lot).

You probably also want a model for the project with the fields you
specified. You should be able to handle all of the project pages with
one view, one template, and a url scheme like /projects/1/ (assuming
they're going to have the same layout)

Reply all
Reply to author
Forward
0 new messages