Thank you, but that's exactly what I said I *didn't* want to do, because
it's silly. :-)

Why should my *data model* know *anything* about the presentation? And
what happens when I want a parrot row ID, or a parrot foo ID, or a
parrot cheese ID? Suddenly I have a proliferation of things in my data
model that have jack all to do with the data, and everything to do with
a particular implementation of a particular view.

And then don't forget the Sloth Button ID as well... so if I have two
different data objects with similar presentation needs (but no other
similarities beyond that), I have to either a) introduce an inheritance
dependency that really makes no sense or b) duplicate a lot of code.

And then there's the fact that I can't use my nice generic button tag
with anything other than data that understands how it's supposed to be
displayed by a particular tag.

Regards,
-scott anderson

On Fri, 2007-09-14 at 09:14 +0000, Samuel Adam wrote:
> no, Scott, you should just do *this*:
> 
> In your Parrot model, you could add a property that displays your DOM
> id.
> 
> class Parrot(models.Model):
>     # fields
> 
>     def _domid(self):
>         return ''parrotButton-%s" % self.id
>     domid = property(_domid)
> 
> and use parrot.domid in your templates.
> 
> On 14 sep, 06:46, "James Bennett" <[EMAIL PROTECTED]> wrote:
> > On 9/13/07, Scott Anderson <[EMAIL PROTECTED]> wrote:
> >
> > > What I'm hoping, however, is that this missive was moot, because you'll
> > > say, "no, Scott, you should just do *this*:", followed by an elegant and
> > > reasonable solution that I, as a relative newcomer to Django, have not
> > > yet considered. Here's to your reply, and cheers!
> >


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