Opened 10 years ago

Closed 9 years ago

#9788 closed (invalid)

Make user profile a property

Reported by: jonathan@… 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: UI/UX:


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/ See line 281.

Attachments (1) (15.1 KB) - added by jonathan@… 10 years ago.

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by jonathan@…

Attachment: added


comment:1 Changed 10 years ago by anonymous

Resolution: invalid
Status: newclosed

comment:2 Changed 10 years ago by Malcolm Tredinnick

Resolution: invalid
Status: closedreopened

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:

  1. 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.
  2. The change isn't correct (get_profile is a method, so the proposed new property will return a reference to a method).
  3. 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 Changed 10 years ago by Malcolm Tredinnick

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 Changed 10 years ago by jonathan@…

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 Changed 9 years ago by anonymous

Resolution: invalid
Status: reopenedclosed

dir() offered up an already built-in solution to this problem

Looks like problem is solved. Reopen if i am wrong.

Note: See TracTickets for help on using tickets.
Back to Top