Opened 16 years ago
Closed 16 years ago
#9788 closed (invalid)
Make user profile a property
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | contrib.auth | Version: | 1.0 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I found that I wanted to filter users based on information contained in their profile model. The easiest way to do this was to modify User to add a very simple property profile, which I think others might find useful. The attached file is django/contrib/auth/models.py. See line 281.
Attachments (1)
Change History (6)
by , 16 years ago
comment:1 by , 16 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 16 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Simply on principle, anonymous people shouldn't close tickets and tickets shouldn't be closed without a reason. There's no way to review the decision if either of those things happen. I'm reopening so that we might consider it appropriately.
The attached file has any number of problems that need to be fixed before we will consider this:
- It's not a patch. Please don't ask us to rummage through hundreds of lines of code to find the change you made. Even though you describe the location in the description, once the file is downloaded, it's no longer with the description.
- The change isn't correct (
get_profile
is a method, so the proposed new property will return a reference to a method). - The patch doesn't have tests (which would have revealed the problem in 2).
There are minor points like using descriptor notation (doesn't work in Python 2.3, so we avoid it) and not having docs, although we can review the change without the latter.
Is this is only being added to support admin or something? The description doesn't completely describe the use-case and it's already pretty simple to filter querysets on the user profile model (since it's a normal reverse relation).
comment:3 by , 16 years ago
Hmm .. a typo above makes it look like I'm dismissing your proposed change. When I wrote "any number of problems", I meant "a number of problems" (I started to write something else, changed my mind and then didn't delete back far enough). It has problems, not it's ant-ridden with unsolvable problems. Sorry about that.
I'm still unclear on the motivation, but if it's something we want to include, the patch is obviously fixable.
comment:4 by , 16 years ago
Sorry about the confusion. The self.get_profile should obviously be self.get_profile(). The motivation was to allow queryset filtering of users based on things in the user profile, but dir() offered up an already built-in solution to this problem.
comment:5 by , 16 years ago
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
dir() offered up an already built-in solution to this problem
Looks like problem is solved. Reopen if i am wrong.
django/contrib/auth/models.py