Example #1
0
  def apply(self, applier):
    """Apply this edit to the song to which it is attached, setting it as applied by applier"""
    if not (self.applied or self.denied):
      for edit in self.field_edits.all():
        if edit.field == "artist":
          self.song.artist = getObj(Artist, edit.new_value)
        elif edit.field == "album":
          self.song.album = getObj(Album, edit.new_value)
        else:
          setattr(self.song, edit.field, edit.new_value)

      self.song.save()
      self.applied = True
      self.actioned_by = applier
      self.actioned_at = datetime.datetime.today()
      self.save()
Example #2
0
File: models.py Project: ewe2/G2
    def apply(self, applier):
        """Apply this edit to the song to which it is attached, setting it as applied by applier"""
        if not (self.applied or self.denied):
            for edit in self.field_edits.all():
                if edit.field == "artist":
                    self.song.artist = getObj(Artist, edit.new_value)
                elif edit.field == "album":
                    self.song.album = getObj(Album, edit.new_value)
                else:
                    setattr(self.song, edit.field, edit.new_value)

            self.song.save()
            self.applied = True
            self.actioned_by = applier
            self.actioned_at = datetime.datetime.today()
            self.save()
Example #3
0
 def clean(self, value):
     if not isinstance(value, self.model):
         return getObj(self.model, value)
     return value
Example #4
0
 def to_python(self, value):
     value = super(forms.CharField, self).to_python(value)
     return getObj(self.model, value)
Example #5
0
File: forms.py Project: ggreer/G2
 def clean(self, value):
   if not isinstance(value, self.model):
     return getObj(self.model, value)
   return value
Example #6
0
File: forms.py Project: ggreer/G2
 def to_python(self, value):
   value = super(forms.CharField, self).to_python(value)
   return getObj(self.model, value)