def save(self, software=None): data = self.cleaned_data software = Software() name = self.cleaned_data['group_name'] software.group, _ = Group.objects.get_or_create(name=name) software = super(AddPackageForm, self).save(software) version = SoftwareVersion( software=software, version=data['version'], module=data['module'], ) version.save() version.machines = data['machines'] version.save() if data['license_text']: SoftwareLicense.objects.create( software=software, version=data['license_version'], date=data['license_date'], text=data['license_text'], ) software.save() return software
def save(self, package=None): data = self.cleaned_data package = super(self.__class__, self).save() version = SoftwareVersion( package=package, version=data['version'], module=data['module'], ) version.save() version.machines = data['machines'] version.save() if data['license_text']: SoftwareLicense.objects.create( package=package, version=data['license_version'], date=data['license_date'], text=data['license_text'], ) package.save() return package