示例#1
0
 def create(self, creator):
     if self._instance is not None:
         message = "Failed to create group: this form is bound to an existing group."
         raise ProgrammingError(message)
     if not self.is_valid():
         raise InvalidFormError(self.errors)
     instance = Group.create(creator=creator, **self.cleaned_data)
     instance.save()
     return instance