Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#12518 closed (duplicate)

create_update of generic view cannot be use for models which bounded to request objects

Reported by: jasongreen Owned by: nobody
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


If a model has a field of user, just like creator, owner. And this field should automaticlly assigned by request.user. there also is some models fields are bound to request boject , just like last_modifier,last_ip, and so on. Although, we can do this in views functions ,but should it be done at form layer?

def is_valid(self,request=None):
def clean(self,request=None):

alternativly, sovle the problem of that models which bounded to request object can't use generic view create_update as well as others models ,in another way.

Change History (2)

comment:1 Changed 6 years ago by lukeplant

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

Decoupling forms from the request object is a deliberate design decision.

As for your alternative request, I'm pretty sure it's the same as #12392. The comments on that ticket provide an example of what you want.

comment:2 Changed 4 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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