Revision 2553efae snf-astakos-app/astakos/im/models.py

b/snf-astakos-app/astakos/im/models.py
1097 1097
        through='ProjectResourceGrant'
1098 1098
    )
1099 1099
    
1100
    def save(self):
1101
        self.validate_name()
1102
        super(ProjectDefinition, self).save()
1103
        
1104 1100
    @property
1105 1101
    def violated_resource_grants(self):
1106 1102
        return False
......
1212 1208
        if commit:
1213 1209
            application.save()
1214 1210
            application.definition.resource_policies = resource_policies
1211
            # better implementation ???
1212
            if precursor_application:
1213
                try:
1214
                    precursor = ProjectApplication.objects.get(id=precursor_application_id)
1215
                except:
1216
                    pass
1217
                application.precursor_application = precursor
1218
                application.save()
1215 1219
        else:
1216 1220
            notification = build_notification(
1217 1221
                settings.SERVER_EMAIL,
......
1226 1230
        """
1227 1231
        If approval_user then during owner membership acceptance
1228 1232
        it is checked whether the request_user is eligible.
1233
        
1234
        Raises:
1235
            ValidationError: if there is other alive project with the same name
1236
            
1229 1237
        """
1230 1238
        if self.state != PENDING:
1231 1239
            return
......
1249 1257
            project.last_approval_date = datetime.now()
1250 1258
            project.save()
1251 1259
            self.precursor_application.state = REPLACED
1260
        self.definition.validate_name()
1252 1261
        self.state = APPROVED
1253 1262
        self.save()
1254 1263

  

Also available in: Unified diff