Opened 11 years ago

Closed 7 years ago

#714 closed enhancement (duplicate)

access to id of current user on admin

Reported by: flavio.curella@… Owned by: Adrian Holovaty
Component: contrib.admin Version: master
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The model code of admin application doesn't have access to the request, so if I want to save the id of user that is creating the poll, I can't access to it.

this may be more clear, something like this should work:

from django.core import meta
from django.models.auth import User

# Create your models here.
class Poll(meta.Model):

question = meta.CharField(maxlength=200)
pub_date = meta.DateTimeField('date published')
author = meta.ForeignKey(User, default=User.id)
class META:

admin = meta.Admin()

Change History (6)

comment:1 Changed 11 years ago by Flavio.curella@…

The model code of admin application doesn't have access to the request, so if I want to save the id of user that is creating the poll, I can't access to it.

this may be more clear, something like this should work:

from django.core import meta
from django.models.auth import User

# Create your models here.
class Poll(meta.Model):
    question = meta.CharField(maxlength=200)
    pub_date = meta.DateTimeField('date published')
    author = meta.ForeignKey(User, default=User.id)
    class META:
        admin = meta.Admin()

comment:2 Changed 11 years ago by anonymous

priority: normalhigh

comment:3 Changed 11 years ago by hugo

priority: highnormal

a more general approach is discussed in #1132.

comment:4 Changed 11 years ago by Adrian Holovaty

Resolution: duplicate
Status: newclosed

Superceded by #1132.

comment:5 Changed 7 years ago by Matt Harasymczuk

Resolution: duplicate
Status: closedreopened
Version: SVN

still no solution
superceded tickets has been marked as wontfix

comment:6 Changed 7 years ago by Russell Keith-Magee

Resolution: duplicate
Status: reopenedclosed

Please don't reopen tickets closed by a core developer.

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