@permalink maps a model to a view function through a specific url
pattern giving you the ability to use get_absolute_url()  just by
passing parameters to the function. it will create the url for you.

to the app question. An application or an organizational and way to
focus your development. An app should have a goal, and a focus. You
should be able to sum up what your application does in 1 simple
sentence. If you can't you are probably describing something on the
scope of a project.

My app allows users to leave comments on any object from any view.
That is what it does and that is ALL that it does. DONE.
So organization and focus. For example todd, no, views do not need to
live in a file called views.py. They can live anywhere. You would just
need to remember where you are putting them all and tell your urls
that is where the view function it should use is. But this would get
very confusing to others trying to use your code. So it is a standard
practice to use a file called views.py

with an app that has a lot of views, I often times create a package
called views and segment out the views into their own files that have
a more specific focus

http://www.youtube.com/watch?v=A-S0tqpPga4

The best advice I think anyone can give you comes down to 2 options.
1. don't bring your framework's 'programming baggage' with you. Django
is not framework-X, it never will be, so trying to develop you
programs as if it were, will get you frustrated fast. Baggage all
leads to a dysfunctional relationship. in other words, trying to build
a application like you do in RoR with django is going to situations /
mailing list discussions like this one.

2.  if you really like framework X...use framework X.

On Dec 3, 2:30 pm, Todd Blanchard <tblanch...@mac.com> wrote:
> Models?  Where do I find an example?
>
> I've got Pro Django, Definitive Guide to Django, Python Essential Reference, 
> and I've read the online django tutorial and a bunch of random docs.  I have 
> yet to see an instance of mapping a url to a model.
>
> Or, I don't know what you mean by model vs view (because when I say view - I 
> mean just a function that takes a request, returns a response, and lives in a 
> file called views.py).
>
> What am I missing?
>
> On Dec 3, 2009, at 11:58 AM, bruno desthuilliers wrote:
>
>
>
> > On 3 déc, 20:42, Todd Blanchard <tblanch...@mac.com> wrote:
> >> On Dec 3, 2009, at 10:46 AM, Javier Guerra wrote:
>
> >>> remember that an app can do a lot more than provide views.
>
> >> Explain this one to me.  AFAICS, its just http request/response all the 
> >> way down and this is basically done by getting a request to a view that 
> >> spits out a response.  Side effects like updating the database sometimes 
> >> occur.
>
> > An app can expose views, indeed. It can also expose models - one of
> > the most important parts of an application -, templatetags, filters,
> > forms, fields, widgets etc. FWIW, the views are perhaps one of the
> > less important thing an app has to offer - and obviously the most easy
> > to factor out, cf genericviews. Models, OTHO, are really the core. If
> > you end up writing most of your code in views, then you more than
> > probably failed to identify what belongs to the model and what belongs
> > to the views. The fact that "views" are a mandatory part of the
> > request-response cycle doesn't mean they are the most important part
> > of the app.
>
> > --
>
> > 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 
> > athttp://groups.google.com/group/django-users?hl=en.

--

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