Re: [Django] #26254: Support for disallowing filter on local fields in ModelAdmin

2016-02-22 Thread Django
#26254: Support for disallowing filter on local fields in ModelAdmin
--+--
 Reporter:  DheerendraRathor  |Owner:  nobody
 Type:  New feature   |   Status:  closed
Component:  contrib.admin |  Version:  master
 Severity:  Normal|   Resolution:  wontfix
 Keywords:| Triage Stage:  Unreviewed
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+--
Changes (by timgraham):

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


Comment:

 I'll be happy to review a documentation patch. 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 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/074.5a2616ec94cbec969c51be1328ba9bd8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #26254: Support for disallowing filter on local fields in ModelAdmin

2016-02-22 Thread Django
#26254: Support for disallowing filter on local fields in ModelAdmin
--+--
 Reporter:  DheerendraRathor  |Owner:  nobody
 Type:  New feature   |   Status:  new
Component:  contrib.admin |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Unreviewed
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+--

Comment (by DheerendraRathor):

 My first idea was to override this method and I've overridden that in my
 current project.
 But one issue I found that `lookup` param can take forms like
 `field__exact`, `field__contains` etc, so before allowing certain lookup
 it needs to be cleaned which is present in `relation_parts` in
 
https://github.com/django/django/blob/master/django/contrib/admin/options.py#L366

 Another way to override involves something like overriding done in
 `django.contrib.auth.admin` in
 https://github.com/django/django/blob/master/django/contrib/auth/admin.py#L93

 Well, documenting this method will work pretty well. If we're going with
 documenting it, then I'll write docs for this either by taking example
 from auth/admin or by using my custom overridden method.

--
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/074.307c6dd55162f6235edc72de19e625c8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #26254: Support for disallowing filter on local fields in ModelAdmin

2016-02-22 Thread Django
#26254: Support for disallowing filter on local fields in ModelAdmin
--+--
 Reporter:  DheerendraRathor  |Owner:  nobody
 Type:  New feature   |   Status:  new
Component:  contrib.admin |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Unreviewed
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+--
Changes (by timgraham):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 How about documenting the `lookup_allowed()` method as suggested in #17985
 and adding an example of overriding that method to achieve this? As long
 as that doesn't require much boilerplate, I think it's simpler than adding
 another attribute for what is probably not a very common use case.

--
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/074.37d37bf19263ba2a2a9b6946b593c3fd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #26254: Support for disallowing filter on local fields in ModelAdmin

2016-02-21 Thread Django
#26254: Support for disallowing filter on local fields in ModelAdmin
--+
 Reporter:  DheerendraRathor  |  Owner:  nobody
 Type:  New feature   | Status:  new
Component:  contrib.admin |Version:  master
 Severity:  Normal|   Keywords:
 Triage Stage:  Unreviewed|  Has patch:  0
Easy pickings:  0 |  UI/UX:  0
--+
 Currently, if a local field is not present in `list_filter` and filter is
 called on that particular field directly in URL, it is allowed to filter
 on that particular field. But, if filter is called on a relational field
 which is not present in `list_filter`, filter is disallowed on that
 particular field.

 This feature request is in support for disallowing filter on certain
 fields. This can be done by either not allowing filter on a field if field
 is not mentioned in `list_filter` or by adding an extra ModelAdmin field
 `disallowed_lookups`.  But disallowing on the basis of list_filter might
 break admin for sites heavily relying on admin, second option will be
 better in my opinion.


 {{{
 # An example fix
 if len(relation_parts) <= 1:
 # Either a local field filter, or no fields at all.
 if len(relation_parts) == 1 and relation_parts[0] in
 self.disallowed_lookups:
 return False
 return True
 }}}

--
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/059.5f16064725e5c7d30f974fb207f2e753%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.