Re: [Django] #5863: list_display does not allow functions of referenced objects

2020-11-04 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
 Reporter:  Beat Bolli   |Owner:  nobody
|
 Type:  Uncategorized|   Status:  closed
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  list_display | Triage Stage:  Design
 |  decision needed
Has patch:  1|  Needs documentation:  1
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  1
-+-

Comment (by Michael):

 Replying to [comment:18 Ramiro Morales]:
 > I'd say this ticket can be closed (I found it when looking for material
 related to #10230).
 >
 > Using callables (bare functions for example, i.e. no model methods nor
 `ModelAdmin` subclasses methods) make the "It violates DRY: I have to
 define the same function on each model that references the foreign model"
 argument moot.
 >
 > Also, when it comes to the HTML table headers:
 >
 >  1. Seeing a bare 'Code' header (using the
 [http://code.djangoproject.com/ticket/5863#comment:6 comment 6] example)
 that refers to a `code` field of a `Client` model that is located one or
 more FK-hops away isn't necessarily a good idea, it can be confusing
 because the user could assume it refers about a (non-existent) `code`
 field local to the model being displayed.
 >  2. In the case of more that one level of indirection, having an
 automatically-generated `'Hop1 Model > ... > HopN Model > Field'` header
 wouldn´t be practical/scalable.
 >
 > It's more practical in that case that the developer sets explicitely an
 appropiate, unambiguous header literal using the `.short_description`
 facility.
 >
 > In other words, I'd say current functionality plus a bit of work satisfy
 the needs expressed in this ticket discussion for this arguably rare
 scenario.

 Unless I am missing something, I don't see how `1.` solves the issue. Say
 I have Model `A`, and it has a foreign key to `Z`. Then I have model B,
 which has a foreign key to 'A'. Now in model `B` and `A` I wish to show
 one of `Z`s field's admin, how do I use the common function?

 And with regards to it being rare, as mentioned above about `164K` views
 on stack overflow.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/090.ea4fe7e48522ae276f0c2741c94351d0%40djangoproject.com.


Re: [Django] #5863: list_display does not allow functions of referenced objects

2020-11-04 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
 Reporter:  Beat Bolli   |Owner:  nobody
|
 Type:  Uncategorized|   Status:  closed
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  list_display | Triage Stage:  Design
 |  decision needed
Has patch:  1|  Needs documentation:  1
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  1
-+-

Comment (by Michael):

 I would just like to note its not a "rare use case", the stack overflow
 post on how to acocmplish this has 164K views, and the dissapointing
 answer has about 500 uploads.
 [https://stackoverflow.com/questions/163823/can-list-display-in-a-django-
 modeladmin-display-attributes-of-foreignkey-field]

 This I would dare guess it is the most common limitation people deal with
 the admin interface.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/090.3396f500112836bef6233004a901d8f5%40djangoproject.com.


Re: [Django] #5863: list_display does not allow functions of referenced objects

2016-04-13 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
 Reporter:  Beat Bolli   |Owner:  nobody
|
 Type:  Uncategorized|   Status:  closed
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  list_display | Triage Stage:  Design
 |  decision needed
Has patch:  1|  Needs documentation:  1
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  1
-+-
Changes (by zachborboa):

 * cc: zachborboa@… (added)


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/090.05a92b8daf070c0b868e186482743a37%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #5863: list_display does not allow functions of referenced objects

2015-08-09 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
 Reporter:  Beat Bolli   |Owner:  nobody
|
 Type:  Uncategorized|   Status:  closed
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  list_display | Triage Stage:  Design
 |  decision needed
Has patch:  1|  Needs documentation:  1
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  1
-+-
Changes (by hobarrera):

 * cc: hugo@… (added)


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/090.9df992e212d3737134c53e6e9c2f7b63%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #5863: list_display does not allow functions of referenced objects

2014-04-16 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
 Reporter:  Beat Bolli   |Owner:  nobody
|   Status:  closed
 Type:  Uncategorized|  Version:  master
Component:  contrib.admin|   Resolution:  wontfix
 Severity:  Normal   | Triage Stage:  Design
 Keywords:  list_display |  decision needed
Has patch:  1|  Needs documentation:  1
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  1
-+-

Comment (by petr.dlouhy@…):

 I remade the Snippet 2996 in form of an application (for anyone interested
 in working around this issue): https://github.com/PetrDlouhy/django-
 related-admin

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/090.a3e393a6a9b788f68f4bf86af1dc1eed%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #5863: list_display does not allow functions of referenced objects

2013-02-03 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
 Reporter:  Beat Bolli   |Owner:  nobody
|   Status:  closed
 Type:  Uncategorized|  Version:  master
Component:  contrib.admin|   Resolution:  wontfix
 Severity:  Normal   | Triage Stage:  Design
 Keywords:  list_display |  decision needed
Has patch:  1|  Needs documentation:  1
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  1
-+-
Changes (by jcushman):

 * ui_ux:  0 => 1


Comment:

 (Sorry, not sure why it unset UI/UX when I commented.)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #5863: list_display does not allow functions of referenced objects

2013-02-03 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
 Reporter:  Beat Bolli   |Owner:  nobody
|   Status:  closed
 Type:  Uncategorized|  Version:  master
Component:  contrib.admin|   Resolution:  wontfix
 Severity:  Normal   | Triage Stage:  Design
 Keywords:  list_display |  decision needed
Has patch:  1|  Needs documentation:  1
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by jcushman):

 * ui_ux:   => 0


Comment:

 If anyone else who wants to be able to refer to foreign keys with
 underscore syntax in list_display comes across this ticket, I put together
 a subclass of ModelAdmin to do that:

 http://djangosnippets.org/snippets/2887/

 So you can just do:

 {{{
 class FooAdmin(RelatedFieldAdmin):
 list_display = ('address__phone','address__country__country_code')
 }}}

 and it figures it out.

 The benefit of using a subclass over luke's suggestion is we can override
 queryset() to automatically add the related models to select_related(),
 which prevents a database hit for each row. It also sets sensible defaults
 for short_description and admin_order_field. Would love to hear (over at
 djangosnippets) if anyone has suggested improvements.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #5863: list_display does not allow functions of referenced objects

2011-05-17 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
   Reporter:  Beat   |  Owner:  nobody
  Bolli | Status:  closed
   Type: |  Component:  contrib.admin
  Uncategorized  |   Severity:  Normal
  Milestone: |   Keywords:  list_display
Version:  SVN|  Has patch:  1
 Resolution:  wontfix|Needs tests:  0
   Triage Stage:  Design |  Easy pickings:  0
  decision needed|
Needs documentation:  1  |
Patch needs improvement:  1  |
-+-

Comment (by lukeplant):

 I gave a more full reply on the list: http://groups.google.com/group
 /django-developers/browse_thread/thread/790484bfbe1b421f

 My apologies for bouncing around between Trac and the mailing list, I
 should have stuck to the list as is our policy.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2011-05-17 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
   Reporter:  Beat   |  Owner:  nobody
  Bolli | Status:  closed
   Type: |  Component:  contrib.admin
  Uncategorized  |   Severity:  Normal
  Milestone: |   Keywords:  list_display
Version:  SVN|  Has patch:  1
 Resolution:  wontfix|Needs tests:  0
   Triage Stage:  Design |  Easy pickings:  0
  decision needed|
Needs documentation:  1  |
Patch needs improvement:  1  |
-+-

Comment (by brillgen):

 I agree that its better to restrict the field names than have restrictions
 on other methods or attributes.

 Based on the distinction between list_filter and list_display, I was just
 thinking that a . lookup syntax for attributes (class attribute would be
 closer to the idea that list_display is about object attributes and not
 database joins. However, why would retrieving attributes difficult? The
 admin has the model object and hence can span the model definitions to
 determine the attributes (using the . syntax to identify members and their
 attributes) ..In fact it would allow methods on FKs to be displayed as
 well which was not covered so well with the __ syntax.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2011-05-17 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
   Reporter:  Beat   |  Owner:  nobody
  Bolli | Status:  closed
   Type: |  Component:  contrib.admin
  Uncategorized  |   Severity:  Normal
  Milestone: |   Keywords:  list_display
Version:  SVN|  Has patch:  1
 Resolution:  wontfix|Needs tests:  0
   Triage Stage:  Design |  Easy pickings:  0
  decision needed|
Needs documentation:  1  |
Patch needs improvement:  1  |
-+-

Comment (by lukeplant):

 If we are allowing field names to contain double underscores, that is
 almost certainly a validation bug which should be fixed. We have
 restrictions on how fields can be named, and don't have restrictions on
 other methods or attributes, and I think we should keep it that way.

 Adding attribute lookup into a syntax that has been designed for table
 joins is a bad idea. It will certainly require limitations on the names of
 attributes (e.g. 'private' attributes that start with a double
 underscore). Remembering that there is no reason why the attribute lookup
 should be at the end, it may not be possible at all - I'm not convinced
 you easily handle methods like `__foo__` if it is followed by another
 'join'.

 However, using a **dot** lookup syntax would make sense here, because
 list_display is about object **attributes** and **not** field joins. This
 might be a sensible proposal, but not sure if would deal with all the
 problems - you still can't get the fields verbose_name easily etc.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2011-05-17 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
   Reporter:  Beat   |  Owner:  nobody
  Bolli | Status:  closed
   Type: |  Component:  contrib.admin
  Uncategorized  |   Severity:  Normal
  Milestone: |   Keywords:  list_display
Version:  SVN|  Has patch:  1
 Resolution:  wontfix|Needs tests:  0
   Triage Stage:  Design |  Easy pickings:  0
  decision needed|
Needs documentation:  1  |
Patch needs improvement:  1  |
-+-

Comment (by brillgen):

 @lukeplant, the basic problem you've correctly raised is that list_display
 allows for callables and hence arbitrary names can be used which are
 simiar to the syntax for foreign key fields.
 However, this problem exists for list_filter also: someone may define a
 field with the name class__field and try to use that in list_filter as a
 foreign key field. (i've just checked that you can indeed name a field
 like that)

 So we can't really be compensating for dev stupidity at the cost of
 functionality as we haven't done in list_filter also.
 Since all FKs always start with an alphabet are in the regex format
 (.+__.+.*), the __unicode etc cases can be easily and correctly filtered
 as is required to be done in list_filter.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2011-05-17 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
   Reporter:  Beat   |  Owner:  nobody
  Bolli | Status:  closed
   Type: |  Component:  contrib.admin
  Uncategorized  |   Severity:  Normal
  Milestone: |   Keywords:  list_display
Version:  SVN|  Has patch:  1
 Resolution:  wontfix|Needs tests:  0
   Triage Stage:  Design |  Easy pickings:  0
  decision needed|
Needs documentation:  1  |
Patch needs improvement:  1  |
-+-

Comment (by lukeplant):

 Also, in response to andybak and anonymous, please note:

 list_display is fundamentally different from list_filter and
 search_fields. The other two are defining operations that must happen in
 the database, whereas list_display is defining an operation that must
 happen in Python code, and refers to Python functions/methods, and **not**
 to database fields. The confusion is that a name that of a database field
 is also the name of the corresponding attribute on the Python object, but
 that is where the similarity ends.

 So, for instance, you can set `'__unicode__'` in list_display, and it will
 refer to the `__unicode__` method, and not attempt any field lookups,
 despite the presence of double underscores. As it happens, this example
 makes it obvious that we cannot sensibly add the feature as proposed - how
 would you refer to the `__unicode__` method on a related object?
 `'foreign_keyunicode__'`? How would you parse that? What about other
 methods that people might choose to define, like `__html__`, etc.? The
 only way this feature could get in is we are happy with a bunch of special
 cases in the implementation, and a bunch of arbitrary limitations in
 functionality.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2011-05-17 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
   Reporter:  Beat   |  Owner:  nobody
  Bolli | Status:  closed
   Type: |  Component:  contrib.admin
  Uncategorized  |   Severity:  Normal
  Milestone: |   Keywords:  list_display
Version:  SVN|  Has patch:  1
 Resolution:  wontfix|Needs tests:  0
   Triage Stage:  Design |  Easy pickings:  0
  decision needed|
Needs documentation:  1  |
Patch needs improvement:  1  |
-+-
Changes (by jezdez):

 * status:  reopened => closed
 * resolution:   => wontfix


Comment:

 Please don't reopen tickets that were marked as wontfix by a core
 developer but raise the issue on the django-developers list instead.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2011-05-17 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
   Reporter:  Beat   |  Owner:  nobody
  Bolli | Status:  reopened
   Type: |  Component:  contrib.admin
  Uncategorized  |   Severity:  Normal
  Milestone: |   Keywords:  list_display
Version:  SVN|  Has patch:  1
 Resolution: |Needs tests:  0
   Triage Stage:  Design |  Easy pickings:  0
  decision needed|
Needs documentation:  1  |
Patch needs improvement:  1  |
-+-
Changes (by anonymous):

 * status:  closed => reopened
 * resolution:  wontfix =>


Comment:

 I am re-opening this ticket once more to get some more attention on
 this...the current proposed workarounds have serious deficiencies:

 1. Write functions everywhere (this involves a lot of repetition for every
 single foreign field)
 2. Write a wrapper like @lukeplant suggested (even though it is far
 superior solution to individual functions in every model)

 are all HUGE violation of DRY principles on which sensible programming is
 based toady. Since the parent__child syntax is being used for list filter,
 search fields and everywhere else, why is the list_display so sacrosanct?

 E.g. once a model field already has an attribute like verbose_name
 defined...why should a function or a wrapper function have to define it
 again. It is not feasible to copy that definition in the case of the
 wrapper.

 My question is, will this be accepted as a patch if contributed on the
 trunk with test cases et all?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2011-05-03 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
   Reporter:  Beat   |  Owner:  nobody
  Bolli | Status:  closed
   Type: |  Component:  contrib.admin
  Uncategorized  |   Severity:  Normal
  Milestone: |   Keywords:  list_display
Version:  SVN|  Has patch:  1
 Resolution:  wontfix|Needs tests:  0
   Triage Stage:  Design |  Easy pickings:  0
  decision needed|
Needs documentation:  1  |
Patch needs improvement:  1  |
-+-

Comment (by andybak):

 I agree with @brillgen here.

 It would be clearer and much more consistant to support the parent__child
 syntax for accessing related models wherever feasible.

 I believe it's already been added for admin list_filter.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2011-04-28 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
   Reporter:  Beat   |  Owner:  nobody
  Bolli | Status:  closed
   Type: |  Component:  contrib.admin
  Uncategorized  |   Severity:  Normal
  Milestone: |   Keywords:  list_display
Version:  SVN|  Has patch:  1
 Resolution:  wontfix|Needs tests:  0
   Triage Stage:  Design |  Easy pickings:  0
  decision needed|
Needs documentation:  1  |
Patch needs improvement:  1  |
-+-
Changes (by brillgen):

 * easy:   => 0


Comment:

 @lukeplant: In the absence of any other solution your function is a
 lifesaver. I guess I'm not pythonic enough yet to have thought of it on my
 own...
 Still it does have a few problems that can't be fixed...For instance, how
 to assign the short_description attribute to be the same as what has
 already been defined for the field? It can't be done the way I see it,
 without explicitly passing the model involved or the short description
 (which will have to be repeated here)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2011-04-16 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
   Reporter:  Beat   |Owner:  nobody
  Bolli |   Status:  closed
   Type: |Component:  contrib.admin
  Uncategorized  | Severity:  Normal
  Milestone: | Keywords:  list_display
Version:  SVN|Has patch:  1
 Resolution:  wontfix|  Needs tests:  0
   Triage Stage:  Design |
  decision needed|
Needs documentation:  1  |
Patch needs improvement:  1  |
-+-

Comment (by lukeplant):

 @brillgen:

 It's difficult to believe there would be much difference between the two
 methods if you are using 'select_related' correctly (and we don't want to
 complicate the logic for select_related any further).

 Also, note that you could easily write a function that would eliminate the
 boilerplate, if it is really boilerplate that conforms to a common
 pattern. Untested code:

 {{{
 #!python

 def foreign_field(field_name):
 def accessor(obj):
 val = obj
 for part in field_name.split('__'):
 val = getattr(val, part)
 return val
 accessor.__name__ = field_name
 return accessor

 ff = foreign_field

 class MyAdmin(ModelAdmin):

 list_display = [ff('foreign_key__related_fieldname1'),
 ff('foreign_key__related_fieldname2')]
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2011-04-13 Thread Django
#5863: list_display does not allow functions of referenced objects
-+-
   Reporter:  Beat   |Owner:  nobody
  Bolli |   Status:  closed
   Type: |Component:  contrib.admin
  Uncategorized  | Severity:  Normal
  Milestone: | Keywords:  list_display
Version:  SVN|Has patch:  1
 Resolution:  wontfix|  Needs tests:  0
   Triage Stage:  Design |
  decision needed|
Needs documentation:  1  |
Patch needs improvement:  1  |
-+-
Changes (by brillgen):

 * cc: brillgen (added)
 * type:   => Uncategorized
 * severity:   => Normal


Comment:

 @kmtracey:
  We would have to use over a 100 extra boilerplate functions at last
 estimate since callables is being stated as the only supported means of
 getting direct fields from foreign keys...some of them are simply a text
 field that needs to be displayed as such..I have 2 questions for the
 community:
 1. Isn't there a performance impact of using a callable (select_related)
 benefit loss which could happen in case of simple FK fields required?
 If there is no impact, its irrelevant because the boiler plate code is not
 thaat much trouble
 However, if there is (and I believe there would be),
 2. Would the django admin accept a patch as long as it met the
 requirements of test cases, documentation etc etc.
 I ask because there would be nothing more frustrating than developing a
 fully featured patch against trunk just to hear that it'll never get
 accepted due to contrary design ideas :(

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2011-02-02 Thread Django
#5863: list_display does not allow functions of referenced objects
+---
   Reporter:  Beat Bolli   | Owner:  
nobody  
 Status:  closed| Milestone:
  
  Component:  django.contrib.admin  |   Version:  
SVN 
 Resolution:  wontfix   |  Keywords:  
list_display
   Triage Stage:  Design decision needed| Has patch:  1 
  
Needs documentation:  1 |   Needs tests:  0 
  
Patch needs improvement:  1 |  
+---

Comment (by kmtracey):

 Replying to [comment:29 pihentagy]:
 > And what about sorting?

 Sorting is supported for callables in in list_display, as noted in
 http://code.djangoproject.com/ticket/5863#comment:23

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2011-02-02 Thread Django
#5863: list_display does not allow functions of referenced objects
+---
   Reporter:  Beat Bolli   | Owner:  
nobody  
 Status:  closed| Milestone:
  
  Component:  django.contrib.admin  |   Version:  
SVN 
 Resolution:  wontfix   |  Keywords:  
list_display
   Triage Stage:  Design decision needed| Has patch:  1 
  
Needs documentation:  1 |   Needs tests:  0 
  
Patch needs improvement:  1 |  
+---

Comment (by pihentagy):

 And what about sorting?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2011-02-01 Thread Django
#5863: list_display does not allow functions of referenced objects
+---
   Reporter:  Beat Bolli   | Owner:  
nobody  
 Status:  closed| Milestone:
  
  Component:  django.contrib.admin  |   Version:  
SVN 
 Resolution:  wontfix   |  Keywords:  
list_display
   Triage Stage:  Design decision needed| Has patch:  1 
  
Needs documentation:  1 |   Needs tests:  0 
  
Patch needs improvement:  1 |  
+---
Changes (by kmtracey):

  * status:  reopened => closed
  * resolution:  => wontfix


Comment:

 Replying to [comment:27 Herman S]:
 >
 > As the parent/child relationship is reversed from what Django's
 ModelAdmin.inlines expect, there seems to not be a solution for my
 problem.

 There's a trivially-easy solution you can code: methods on your model or
 model admin that return the information you desire, listed in your
 list_display.

 I'm closing this wontfix; having it be open seems to be confusing people
 into thinking the requested function of allowing a specific field from a
 related model to be shown in list_display is not possible. It is possible,
 quite easily, with a feature (callables in list_display) added since this
 ticket was originally opened. That feature is more powerful than simply
 allowing traversal to a related model's field, so the syntax of how to do
 it is not exactly the same as it would be if just that one piece was
 implemented. But given the more powerful thing has been implemented, I
 don't believe the addition of another way of doing the same thing is
 necessary or worth the implementation/maintenance effort.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2011-02-01 Thread Django
#5863: list_display does not allow functions of referenced objects
+---
   Reporter:  Beat Bolli   | Owner:  
nobody  
 Status:  reopened  | Milestone:
  
  Component:  django.contrib.admin  |   Version:  
SVN 
 Resolution:|  Keywords:  
list_display
   Triage Stage:  Design decision needed| Has patch:  1 
  
Needs documentation:  1 |   Needs tests:  0 
  
Patch needs improvement:  1 |  
+---

Comment (by Herman S):

 This needs attention.

 I have the following models:
 * Applicant
 * Application, which has a field "applicant =
 models.ForeignKey(Applicant)"

 In ApplicationAdmin I'm trying to request the applicants name, phone,
 email etc. with:[[BR]]
 list_display = ['status', 'interview' ... 'applicant__name',
 'applicant__email']

 As the parent/child relationship is reversed from what Django's
 ModelAdmin.inlines expect, there seems to not be a solution for my
 problem.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2010-03-29 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli   | Owner:  nobody 
 
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  1 |  
---+
Changes (by mikexstudios):

 * cc: mike.huynh+dja...@gmail.com (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2010-01-22 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli   | Owner:  nobody 
 
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  1 |  
---+
Changes (by andybak):

 * cc: a...@andybak.net (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #5863: list_display does not allow functions of referenced objects

2010-01-11 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli   | Owner:  nobody 
 
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  1 |  
---+
Comment (by subsume):

 Seems like discussion of this has petered out. Too bad, especially when
 more and more people are looking to subclass parts of admin for their own
 use.

 This is so simple in many other ways in admin. I realize it leads to
 situations where what you get back isn't a field, but another queryset,
 but the developer gets what they deserve in that case. Its not hard (or
 even out of precedent) to simply ignore relations which are nonsense. Just
 take a look at the behavior of select_related! Having to create a custom
 method each time is tedious and this limitation prevents extensibility in
 situations where you've put those fields on the model yourself manually
 using extra() and other methods.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




Re: [Django] #5863: list_display does not allow functions of referenced objects

2009-05-04 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli   | Owner:  nobody 
 
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  1 |  
---+
Comment (by kmtracey):

 Replying to [comment:22 haffi67]:
 > One thing that I think no one has pointed out yet; if it were possible
 to set {{{table__field}}} in list_display, you could order the list by
 that field in the interface, which you can't do with callables.

 You can set admin_order_field on a callable to specify ordering; doc on
 that is the last bullet under
 
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display.
 If that doesn't currently support the double-underscore syntax to
 reference a ordering by a field in a related object, then I doubt it would
 'just work' for things specified that way in list_display.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #5863: list_display does not allow functions of referenced objects

2009-05-04 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli   | Owner:  nobody 
 
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  1 |  
---+
Comment (by haffi67):

 One thing that I think no one has pointed out yet; if it were possible to
 set {{{table__field}}} in list_display, you could order the list by that
 field in the interface, which you can't do with callables.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #5863: list_display does not allow functions of referenced objects

2009-02-27 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli   | Owner:  nobody 
 
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  1 |  
---+
Changes (by codekoala):

  * has_patch:  0 => 1
  * needs_tests:  1 => 0

Comment:

 oops... didn't mean to adjust the ticket properties like that.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #5863: list_display does not allow functions of referenced objects

2009-02-27 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli   | Owner:  nobody 
 
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  0  
 
Needs_docs:  1 |   Needs_tests:  1  
 
Needs_better_patch:  1 |  
---+
Changes (by codekoala):

  * has_patch:  1 => 0
  * needs_tests:  0 => 1

Comment:

 Would someone like to review the snippet I've come up with as a "work
 around" of sorts?  It would definitely need some work before it could be
 used in Django if it's deemed worthy, but I hope it's an option at
 least...  I'm not sure I feel comfortable posting it as a patch because of
 the issues involved with my approach, but I still think it's worth looking
 at.

 You can find it here, along with some details about the issues involved:
 http://www.codekoala.com/blog/2009/feb/27/model-relationships-and-
 list_display/

 Thanks!

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #5863: list_display does not allow functions of referenced objects

2009-02-23 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli   | Owner:  nobody 
 
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  1 |  
---+
Comment (by galund):

 Reasons not to close this ticket:
  - consistency between search_fields, list_display, and list_filter: it
 seems reasonable to want them all to work the same way. At the basic
 level, they are all a list of fields, after that, the limitations seem
 arbitrary (i.e. it seems at first glance as if the more advanced features
 of each could be available but just haven't been programmed yet).

  - this need isn't really so rare, particularly if you have models that
 relate one-to-one, where you naturally do want to include fields from
 across several tables.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #5863: list_display does not allow functions of referenced objects

2009-02-10 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli   | Owner:  nobody 
 
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  1 |  
---+
Comment (by ramiro):

 I'd say this ticket can be closed (I found it when looking for material
 related to #10230).

 Using callables (bare functions for example, i.e. no model methods nor
 `ModelAdmin` subclasses methods) make the "It violates DRY: I have to
 define the same function on each model that references the foreign model"
 argument moot.

 Also, when it comes to the HTML table headers:

  1. Seeing a bare 'Code' header (using the
 [http://code.djangoproject.com/ticket/5863#comment:6 comment 6] example)
 that refers to a `code` field of a `Client` model that is located one or
 more FK-hops away isn't necessarily a good idea, it can be confusing
 because the user could assume it refers about a (non-existent) `code`
 field local to the model being displayed.
  2. In the case of more that one level of indirection, having an
 automatically-generated `'Hop1 Model > ... > HopN Model > Field'` header
 wouldn´t be practical/scalable.

 It's more practical in that case that the developer sets explicitely an
 appropiate, unambiguous header literal using the `.short_description`
 facility.

 In other words, I'd say current functionality plus a bit of work satisfy
 the needs expressed in this ticket discussion for this arguably rare
 scenario.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #5863: list_display does not allow functions of referenced objects

2008-10-31 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli <[EMAIL PROTECTED]>  | Owner:  nobody   
   
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  1 |  
---+
Comment (by kmtracey):

 Replying to [comment:16 pihentagy]:
 > Should I open a ticket for that, or is there one for it?

 I believe that is what this ticket is asking for, so no need for another
 ticket.  In the absence of a working patch for this ticket, you can
 achieve what you want by adding !ModelAdmin methods (or callables) that
 return the information you are looking for, and specifying these methods
 in your `list_display`.  It is not particularly difficult and not a lot of
 code.  Doc is here: http://docs.djangoproject.com/en/dev/ref/contrib/admin
 /#list-display

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #5863: list_display does not allow functions of referenced objects

2008-10-31 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli <[EMAIL PROTECTED]>  | Owner:  nobody   
   
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  1 |  
---+
Comment (by pihentagy):

 Khm, sorry for the noise guys, I think I misread this ticket.

 All I want to do is:

 {{{
 list_display = ('foreign_key__related_fieldname1',
 'foreign_key__related_fieldname2')
 }}}

 so displaying related fields.
 Should I open a ticket for that, or is there one for it?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #5863: list_display does not allow functions of referenced objects

2008-10-24 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli <[EMAIL PROTECTED]>  | Owner:  nobody   
   
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  1 |  
---+
Comment (by kmtracey):

 Replying to [comment:14 danros]:
 >
 > Can I add that I would very much like this functionality for my project.
 In fact the lack of this functionality led me to give up on the admin
 interface and create my own thing that did do that!

 It was easier to write your own admin than write some trivial !ModelAdmin
 methods that returned the information you were interested in?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #5863: list_display does not allow functions of referenced objects

2008-10-24 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli <[EMAIL PROTECTED]>  | Owner:  nobody   
   
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  1 |  
---+
Comment (by danros):

 Replying to [comment:13 pihentagy]:
 > What's the common situation where user's would really like to see the
 value of a field in a related model instead of just the text
 representation of the related model?  I'm just not seeing that as a very
 common need, meaning when you need it if you have to write a little extra
 code it's no big deal.  It's not boilerplate if you only have to do it in
 rare situations.  I'm looking for something a little more concrete as
 motivation than mom and apple pie goodness.

 Can I add that I would very much like this functionality for my project.
 In fact the lack of this functionality led me to give up on the admin
 interface and create my own thing that did do that!

 Being able to mix-in related model fields is very useful for creating a
 'dashboard' style admin page which I would think is a very common
 requirement.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #5863: list_display does not allow functions of referenced objects

2008-10-17 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli <[EMAIL PROTECTED]>  | Owner:  nobody   
   
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  1 |  
---+
Comment (by pihentagy):

 Replying to [comment:12 kmtracey]:
 > Replying to [comment:11 pihentagy]:
 > > Consistency and DRY: so you shouldn't write boilerplate code. You
 shouldn't specify column name django alredy knows.
 >
 > I understand wanting to avoid boilerplate code but I'm missing how this
 is a common enough case to warrant inclusion and balance the additional
 complexity (both for users -- the list of things you can put in
 list_display is getting a bit long -- and code maintainers).  What's the
 common situation where user's would really like to see the value of a
 field in a related model instead of just the text representation of the
 related model?  I'm just not seeing that as a very common need, meaning
 when you need it if you have to write a little extra code it's no big
 deal.  It's not boilerplate if you only have to do it in rare situations.
 I'm looking for something a little more concrete as motivation than mom
 and apple pie goodness.

 If you have just 1 or 2 foreign keys, you have a lot of place, so it seems
 logical to display more interesting fields from a foreignkey. The unicode
 representation is ok, but it is just 1 column, you will find things
 quickly, if you have 2 or 3 fields from a foreign tabble (not to mention,
 you will be able to sort on that field for free!)

 For example m2m tables with additional fields doesn't contain interesting
 information on their own. Maybe you want to display more columns from one
 FK and sort on them...

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #5863: list_display does not allow functions of referenced objects

2008-10-10 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli <[EMAIL PROTECTED]>  | Owner:  nobody   
   
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  1 |  
---+
Comment (by kmtracey):

 Replying to [comment:11 pihentagy]:
 > Consistency and DRY: so you shouldn't write boilerplate code. You
 shouldn't specify column name django alredy knows.

 I understand wanting to avoid boilerplate code but I'm missing how this is
 a common enough case to warrant inclusion and balance the additional
 complexity (both for users -- the list of things you can put in
 list_display is getting a bit long -- and code maintainers).  What's the
 common situation where user's would really like to see the value of a
 field in a related model instead of just the text representation of the
 related model?  I'm just not seeing that as a very common need, meaning
 when you need it if you have to write a little extra code it's no big
 deal.  It's not boilerplate if you only have to do it in rare situations.
 I'm looking for something a little more concrete as motivation than mom
 and apple pie goodness.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #5863: list_display does not allow functions of referenced objects

2008-10-10 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli <[EMAIL PROTECTED]>  | Owner:  nobody   
   
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  1 |  
---+
Comment (by pihentagy):

 Replying to [comment:10 kmtracey]:
 > but even before that please answer the first question I had: what does
 this provide that isn't already possible given the expanded options of
 things you can now specify in list_display?

 Consistency and DRY: so you shouldn't write boilerplate code. You
 shouldn't specify column name django alredy knows.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #5863: list_display does not allow functions of referenced objects

2008-10-09 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli <[EMAIL PROTECTED]>  | Owner:  nobody   
   
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Design decision needed| Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  1 |  
---+
Changes (by kmtracey):

  * needs_better_patch:  0 => 1
  * has_patch:  0 => 1
  * stage:  Accepted => Design decision needed
  * needs_docs:  0 => 1

Comment:

 Replying to [comment:9 pihentagy]:
 > What is the next step to see this patch in django?
 >

 Since this ticket was raised callables were added to the list of things
 allowed, in list_display, as were methods on !ModelAdmin, in [8352].  Do
 we need yet another way to specify something in list_display?  Can this
 case not be covered by callables?

 I was going to experiment to see, but I can't.  First, the patch doesn't
 apply cleanly to existing trunk.  The actual apply failures are on the
 tests, not the code, so I thought I could experiment with the code, but I
 can't get that to work either.  If I add something with the double
 underscore syntax to the list_display for one of the models in my app, I
 get an !ImproperlyConfigured exception thrown during admin validation:

 {{{
 Traceback:
 File "/home/kmt/django/trunk/django/core/handlers/base.py" in get_response
   77. request.path_info)
 File "/home/kmt/django/trunk/django/core/urlresolvers.py" in resolve
   179. for pattern in self.urlconf_module.urlpatterns:
 File "/home/kmt/django/trunk/django/core/urlresolvers.py" in
 _get_urlconf_module
   198. self._urlconf_module = __import__(self.urlconf_name,
 {}, {}, [''])
 File "/home/kmt/software/web/xword/../xword/urls.py" in 
   9. admin.autodiscover()
 File "/home/kmt/django/trunk/django/contrib/admin/__init__.py" in
 autodiscover
   40. __import__("%s.admin" % app)
 File "/home/kmt/software/web/xword/../xword/crossword/admin.py" in
 
   61. admin.site.register(Puzzles, PuzzlesAdmin)
 File "/home/kmt/django/trunk/django/contrib/admin/sites.py" in register
   76. validate(admin_class, model)
 File "/home/kmt/django/trunk/django/contrib/admin/validation.py" in
 validate
   38. % (cls.__name__, idx, field,
 cls.__name__, model._meta.object_name))

 Exception Type: ImproperlyConfigured at /admin/crossword/authors/
 Exception Value: PuzzlesAdmin.list_display[4], 'AuthorID__Notes' is not a
 callable or an attribute of 'PuzzlesAdmin' or found in the model
 'Puzzles'.
 }}}

 This may be validation code added since the patch was originally created,
 I don['t know -- I think I specified the new thing correctly but I'm not
 entirely sure because there are no docs for the new supported thing in
 list_display.  The existing docs spell out pretty clearly what's allowed:
 http://docs.djangoproject.com/en/dev/ref/contrib/admin/#list-display and
 they would also need to be updated if it's decided this addition is still
 worthwhile.

 So a working patch with docs that applies cleanly to trunk (and doesn't
 have the same problem with sorting that [8352] introduced, see [9212]),
 plus something that addresses graham's last remark about the title for the
 column being non-intuitive, are all missing for this to get in...but even
 before that please answer the first question I had: what does this provide
 that isn't already possible given the expanded options of things you can
 now specify in list_display?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #5863: list_display does not allow functions of referenced objects

2008-10-09 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli <[EMAIL PROTECTED]>  | Owner:  nobody   
   
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Accepted  | Has_patch:  0  
 
Needs_docs:  0 |   Needs_tests:  0  
 
Needs_better_patch:  0 |  
---+
Comment (by pihentagy):

 What is the next step to see this patch in django?

 thanks

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #5863: list_display does not allow functions of referenced objects

2008-09-15 Thread Django
#5863: list_display does not allow functions of referenced objects
---+
  Reporter:  Beat Bolli <[EMAIL PROTECTED]>  | Owner:  nobody   
   
Status:  reopened  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  
list_display
 Stage:  Accepted  | Has_patch:  0  
 
Needs_docs:  0 |   Needs_tests:  0  
 
Needs_better_patch:  0 |  
---+
Comment (by [EMAIL PROTECTED]):

 The patch uploaded shows the related objects field values in the same way
 as the object field values are shown (a boolean as an tick icon etc.)
 rather than as a string as a custom method would.

 However the header of the field still shows the related object's verbose
 name. Ideally it would show something like (section -> title) to indicate
 its a related objects field, but I haven't worked out how to do that yet
 :)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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-updates?hl=en
-~--~~~~--~~--~--~---