app/soc/views/models/request.py
changeset 512 aae25d2b4464
parent 507 3603fdafabf7
child 514 55bd39dab49c
equal deleted inserted replaced
511:52557918ec8f 512:aae25d2b4464
    66       help_text=soc.models.request.Request.to.help_text,
    66       help_text=soc.models.request.Request.to.help_text,
    67       widget=helper.widgets.ReadOnlyInput())
    67       widget=helper.widgets.ReadOnlyInput())
    68 
    68 
    69   def clean_user(self):
    69   def clean_user(self):
    70     self.cleaned_data['requester'] =  user_logic.logic.getForFields(
    70     self.cleaned_data['requester'] =  user_logic.logic.getForFields(
    71         {'link_name': self.cleaned_data['user']}, unique=True)
    71         {'link_id': self.cleaned_data['user']}, unique=True)
    72     return self.cleaned_data['user']
    72     return self.cleaned_data['user']
    73 
    73 
    74   def clean_group(self):
    74   def clean_group(self):
    75     self.cleaned_data['to'] = sponsor_logic.logic.getFromFields(
    75     self.cleaned_data['to'] = sponsor_logic.logic.getFromFields(
    76         link_name=self.cleaned_data['group'])
    76         link_id=self.cleaned_data['group'])
    77     return self.cleaned_data['group']
    77     return self.cleaned_data['group']
    78 
    78 
    79 
    79 
    80 class EditForm(CreateForm):
    80 class EditForm(CreateForm):
    81   """Django form displayed when Developer edits a Request.
    81   """Django form displayed when Developer edits a Request.
   147   def _editGet(self, request, entity, form):
   147   def _editGet(self, request, entity, form):
   148     """See base.View._editGet().
   148     """See base.View._editGet().
   149     """
   149     """
   150 
   150 
   151     # fill in the email field with the data from the entity
   151     # fill in the email field with the data from the entity
   152     form.fields['user'].initial = entity.requester.link_name
   152     form.fields['user'].initial = entity.requester.link_id
   153     form.fields['group'].initial = entity.to.link_name 
   153     form.fields['group'].initial = entity.to.link_id 
   154 
   154 
   155   def _editPost(self, request, entity, fields):
   155   def _editPost(self, request, entity, fields):
   156     """See base.View._editPost().
   156     """See base.View._editPost().
   157     """
   157     """
   158 
   158 
   159     # fill in the account field with the user created from email
   159     # fill in the account field with the user created from email
   160     fields['user_ln'] = fields['requester'].link_name
   160     fields['user_ln'] = fields['requester'].link_id
   161     fields['group_ln'] = fields['to'].link_name
   161     fields['group_ln'] = fields['to'].link_id
   162 
   162 
   163 
   163 
   164 view = View()
   164 view = View()
   165 
   165 
   166 create = view.create
   166 create = view.create