MVC and django fundamentals


Pretty new to this scene and trying to find some documentation to adopt best practices. We're building a fairly large content site which will consist of various media catalogs and I'm trying to find some comparable data / architectural models so that we can get a better idea of the approach we should use using a framework we've never made use of before. Any insight / help would be greatly appreciated!

By : scubabbl


To understand django fundementals and the django take on MVC, consult the following:

As a starting point to getting your hands dirty with ... "...trying to find some comparable data / architectural models"

Here is a quick and dirty way to reverse engineer a database to get a file, which you can then inspect to see how django would handle it.

1.) get an er diagram that closely matches your target. For example something like this

2.) create an sql script from the er diagram and create the database, I suggest Postgre, as some MySQL table type will not have forgien key constraints, but in a pinch MySQL or SQLITE will do

3.) create and configure a django app to use that database. Then run: python inspectdb

This will at least give you a file which you can read to see how django attempts to model it.

Note that the inspect command is intended to be a shortcut for dealing with legacy database when developing in django, and as such is not perfect. Be sure to read the following before attempting this:

By : pcn

Take a look at the Expander sample ControlTemplate at

Expander is a subclass of HeaderedContentControl, it has two "contents": Header and Content

The control template has two ContentPresenter elements, the ContentPresenter that is not bound to the default content property is defined as:

<ContentPresenter ContentSource="Header" />

If you need to use a Button and you don't want to add another property for the second content you can use an attached property and data bind the second ContentPresnter Content property to it.

By : Nir

My use case was only to set the value of a local variable.

Personally I found the try and except style cleaner to read

items = [10, 20]
try: first_item = items[0]
except IndexError: first_item = None
print first_item

than slicing a list.

items = [10, 20]
first_item = (items[:1] or [None, ])[0]
print first_item
By : bkowshik

This video can help you solving your question :)
By: admin