Opened 10 years ago

Closed 5 years ago

#714 closed enhancement (duplicate)

access to id of current user on admin

Reported by: flavio.curella@… Owned by: adrian
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 10 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 9 years ago by anonymous

  • priority changed from normal to high

comment:3 Changed 9 years ago by hugo

  • priority changed from high to normal

a more general approach is discussed in #1132.

comment:4 Changed 9 years ago by adrian

  • Resolution set to duplicate
  • Status changed from new to closed

Superceded by #1132.

comment:5 Changed 5 years ago by haras

  • Resolution duplicate deleted
  • Status changed from closed to reopened
  • Version set to SVN

still no solution
superceded tickets has been marked as wontfix

comment:6 Changed 5 years ago by russellm

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

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

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