Opened 7 years ago

Closed 6 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:

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)

models.py (15.1 KB) - added by jonathan@… 7 years ago.
django/contrib/auth/models.py

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by jonathan@…

django/contrib/auth/models.py

comment:1 Changed 7 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

comment:2 Changed 7 years ago by mtredinnick

  • Resolution invalid deleted
  • Status changed from closed to 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:

  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 7 years ago by mtredinnick

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

  • Resolution set to invalid
  • Status changed from reopened to closed

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