Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Nov. 8, 2010 23:42:49

T.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Generic Views - do you use them?


What are their pros and cons? How often do you use them when you're
coding?

The more I code in django the less I find generic views to be useful
shortcuts (direct to template being the exception).

My biggest complaints are:
* You don't end up saving many keystrokes unless you have 3 or more
views that are going to use the same info_dict.
* They can't be tweaked or changed much before you have to move the
code to the views file, destroying the keystroke savings.
* Second syntax for doing the same thing makes Django harder to
learn.

Am I alone on this?

I've thought about it and i think there is a better way. I want to
see if there are others in the community who aren't in love with
generic views before I develop the alternate approach.

I'm not trying to start a flame war.

--
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.

Offline

#2 Nov. 9, 2010 15:17:13

r.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Generic Views - do you use them?


I don't use them either for much the same reasons, and because I often
end up using custom render_to_response shortcuts that set common
context or handle custom template loading. Although the new class-
based views may make them more customizable.

I don't see much need for an alternative, though (I'm perfectly happy
writing my own views), and don't know what sort of alternate approach
you're suggesting.



On Nov 8, 6:42 pm, Ted <ted.tie...@gmail.com> wrote:
> What are their pros and cons?  How often do you use them when you're
> coding?
>
> The more I code in django the less I find generic views to be useful
> shortcuts (direct to template being the exception).
>
> My biggest complaints are:
> * You don't end up saving many keystrokes unless you have 3 or more
> views that are going to use the same info_dict.
> * They can't be tweaked or changed much before you have to move the
> code to the views file, destroying the keystroke savings.
> * Second syntax for doing the same thing makes Django harder to
> learn.
>
> Am I alone on this?
>
> I've thought about it and i think there is a better way.  I want to
> see if there are others in the community who aren't in love with
> generic views before I develop the alternate approach.
>
> I'm not trying to start a flame war.

--
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.

Offline

#3 Nov. 10, 2010 12:44:50

d.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Generic Views - do you use them?


I have not really understood when and why they are needed; I would be
interested to see an alternative also because it might improve my
understanding.

On Nov 9, 3:27 pm, ringemup <ringe...@gmail.com> wrote:
> I don't use them either for much the same reasons, and because I often
> end up using custom render_to_response shortcuts that set common
> context or handle custom template loading.  Although the new class-
> based views may make them more customizable.
>
> I don't see much need for an alternative, though (I'm perfectly happy
> writing my own views), and don't know what sort of alternate approach
> you're suggesting.
>
> On Nov 8, 6:42 pm, Ted <ted.tie...@gmail.com> wrote:
>
> > What are their pros and cons?  How often do you use them when you're
> > coding?
>
> > The more I code in django the less I find generic views to be useful
> > shortcuts (direct to template being the exception).
>
> > My biggest complaints are:
> > * You don't end up saving many keystrokes unless you have 3 or more
> > views that are going to use the same info_dict.
> > * They can't be tweaked or changed much before you have to move the
> > code to the views file, destroying the keystroke savings.
> > * Second syntax for doing the same thing makes Django harder to
> > learn.
>
> > Am I alone on this?
>
> > I've thought about it and i think there is a better way.  I want to
> > see if there are others in the community who aren't in love with
> > generic views before I develop the alternate approach.
>
> > I'm not trying to start a flame war.

--
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.

Offline

#4 Nov. 10, 2010 16:14:29

S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Generic Views - do you use them?


Every Framework is so difficult to understand that it is better to
"code by own" the functionality provided by them.
We would have better control + peace of mind. Frameworks unnecessarily
bring hassle, irritation for a programmer.

--
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.

Offline

#5 Nov. 11, 2010 15:50:45

Shawn M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Generic Views - do you use them?


On Wed, Nov 10, 2010 at 4:35 AM, derek <gamesb...@gmail.com> wrote:
> I have not really understood when and why they are needed; I would be
> interested to see an alternative also because it might improve my
> understanding.
>

I've never used them before, and always avoided looking into them
because I thought they were some dumbed-down way for newbies to avoid
writing views. Also, the views in my company's application tend to be
fairly complex and I was certain that they'd be too limiting.

However, I was just reading the 1.3 alpha release notes and followed this link:http://docs.djangoproject.com/en/dev/topics/class-based-views/It seems that they could be really useful in nearly any application
(at least the ListView), even for experienced Django developers. In
any case, it's an interesting read and I recommend having a look.

Shawn

--
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.

Offline

#6 Dec. 10, 2010 01:44:58

R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Generic Views - do you use them?


On Nov 8, 6:42 pm, Ted <ted.tie...@gmail.com> wrote:
> What are their pros and cons?  How often do you use them when you're
> coding?
>
> The more I code in django the less I find generic views to be useful
> shortcuts (direct to template being the exception).
>
> My biggest complaints are:
> * You don't end up saving many keystrokes unless you have 3 or more
> views that are going to use the same info_dict.
> * They can't be tweaked or changed much before you have to move the
> code to the views file, destroying the keystroke savings.
> * Second syntax for doing the same thing makes Django harder to
> learn.
>
> Am I alone on this?
>
> I've thought about it and i think there is a better way.  I want to
> see if there are others in the community who aren't in love with
> generic views before I develop the alternate approach.
>
> I'm not trying to start a flame war.

They may be useful sometimes but I've never needed them
as I usually work on open-ended projects that would grow
out of generic views soon even if they may be possible to
use at first.

I think there's a problem with the way generic views are
introduced in documentation. I've actually tutored someone
on use of Django and we ran into a problem that they
started using generic views and kept asking me how to
do this or that with them and they could do almost nothing
they wanted. I could see it was frustrating for the student.

I think the docs should either completely move generic
views into some optional section or there should be an
extremely clear and explicit walkthrough of their limits
and a disclaimer that you shouldn't use them unless
you're pretty sure they can do everything you need your
app to do.

I think I've seen a web talk by Adrian where he said
generic views were introduced for designers (i.e.
non-programmers) to make it possible to make a
useful app with no programming at all. I don't have
a problem with that at all. The main issue is how the docs
approach generic views..

--
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.

Offline

#7 Dec. 10, 2010 09:05:09

Łukasz R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Generic Views - do you use them?


You should try the new class-based generic views:http://docs.djangoproject.com/en/dev/topics/class-based-views/They're much more flexible.

On 10 December 2010 02:44, Rainy <andrei....@gmail.com> wrote:
> On Nov 8, 6:42 pm, Ted <ted.tie...@gmail.com> wrote:
>> What are their pros and cons?  How often do you use them when you're
>> coding?
>>
>> The more I code in django the less I find generic views to be useful
>> shortcuts (direct to template being the exception).
>>
>> My biggest complaints are:
>> * You don't end up saving many keystrokes unless you have 3 or more
>> views that are going to use the same info_dict.
>> * They can't be tweaked or changed much before you have to move the
>> code to the views file, destroying the keystroke savings.
>> * Second syntax for doing the same thing makes Django harder to
>> learn.
>>
>> Am I alone on this?
>>
>> I've thought about it and i think there is a better way.  I want to
>> see if there are others in the community who aren't in love with
>> generic views before I develop the alternate approach.
>>
>> I'm not trying to start a flame war.
>
> They may be useful sometimes but I've never needed them
> as I usually work on open-ended projects that would grow
> out of generic views soon even if they may be possible to
> use at first.
>
> I think there's a problem with the way generic views are
> introduced in documentation. I've actually tutored someone
> on use of Django and we ran into a problem that they
> started using generic views and kept asking me how to
> do this or that with them and they could do almost nothing
> they wanted. I could see it was frustrating for the student.
>
> I think the docs should either completely move generic
> views into some optional section or there should be an
> extremely clear and explicit walkthrough of their limits
> and a disclaimer that you shouldn't use them unless
> you're pretty sure they can do everything you need your
> app to do.
>
> I think I've seen a web talk by Adrian where he said
> generic views were introduced for designers (i.e.
> non-programmers) to make it possible to make a
> useful app with no programming at all. I don't have
> a problem with that at all. The main issue is how the docs
> approach generic views..
>
> --
> 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.
>
>



--
Łukasz Rekucki

--
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.

Offline

#8 Dec. 10, 2010 17:37:16

R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Generic Views - do you use them?


On Dec 10, 4:04 am, Łukasz Rekucki <lreku...@gmail.com> wrote:
> You should try the new class-based generic
> views:http://docs.djangoproject.com/en/dev/topics/class-based-views/>
> They're much more flexible.


Is there a doc somewhere that details what the limitations are? How
do you tell if some task is definitely too much for new generic views?
I'm not using 1.3 yet and generally what I've been doing recently
doesn't seem to fit generic views but eventually I might use them.

--
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.

Offline

#9 Dec. 10, 2010 21:47:42

Ted T.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Generic Views - do you use them?


Class based generic views still have the major drawbacks of the
previous version. They are a more powerful, more complicated version,
but they're still a red-herring.

Ted


On Fri, Dec 10, 2010 at 9:37 AM, Rainy <andrei....@gmail.com> wrote:
> On Dec 10, 4:04 am, Łukasz Rekucki <lreku...@gmail.com> wrote:
>> You should try the new class-based generic
>> views:http://docs.djangoproject.com/en/dev/topics/class-based-views/>>
>> They're much more flexible.
>
>
> Is there a doc somewhere that details what the limitations are? How
> do you tell if some task is definitely too much for new generic views?
> I'm not using 1.3 yet and generally what I've been doing recently
> doesn't seem to fit generic views but eventually I might use them.
>
> --
> 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.
>
>

--
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.

Offline

#10 Dec. 10, 2010 22:23:27

Łukasz R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Generic Views - do you use them?


On 10 December 2010 22:47, Ted Tieken <ted.tie...@gmail.com> wrote:
> Class based generic views still have the major drawbacks of the
> previous version.  They are a more powerful, more complicated version,
> but they're still a red-herring.

Can you elaborate on this ? Taking your original concerns:

> My biggest complaints are:
> * You don't end up saving many keystrokes unless you have 3 or more
> views that are going to use the same info_dict.

That sounds like a general rule for all things "generic" - if you
don't have similar problems, you must have different solutions. If you
have a couple of views that are almost similar, you can create a
common base class and make final tweaks as parameters to the as_view()
function.

* They can't be tweaked or changed much before you have to move the
code to the views file, destroying the keystroke savings.

Class-based views are designed to solve exactly this problem. By
creating a subclass you can customize the parts you want and reuse
others. If the current API doesn't suite your needs, please do say.
I'm not going to argue it's perfect, but it surely is the right
direction :)

* Second syntax for doing the same thing makes Django harder to learn.

I don't understand this one. Is this targeted at old generic views or
the new views ?

> On Fri, Dec 10, 2010 at 9:37 AM, Rainy <andrei....@gmail.com> wrote:
>>
>> Is there a doc somewhere that details what the limitations are? How
>> do you tell if some task is definitely too much for new generic views?
>> I'm not using 1.3 yet and generally what I've been doing recently
>> doesn't seem to fit generic views but eventually I might use them.

What kind of limitations you have in mind ?

Generic views usually can't solve your task out-of-the-box - this is
where the need for customization comes from. Old generic views let you
only customize small parts of variables. Class-based views take a
different approach - every time there is a (substantial) decision to
make, call a method on self. This way subclasses can redefine the way
that decision is made without the need to copy all of the view's code.

--
Łukasz Rekucki

--
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.

Offline

Board footer

Moderator control

Enjoy the 17th of August
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support