Revision 97896995 snf-astakos-app/astakos/im/models.py

b/snf-astakos-app/astakos/im/models.py
69 69
    DEFAULT_USER_LEVEL, INVITATIONS_PER_LEVEL,
70 70
    AUTH_TOKEN_DURATION, BILLING_FIELDS,
71 71
    EMAILCHANGE_ACTIVATION_DAYS, LOGGING_LEVEL,
72
    GROUP_CREATION_SUBJECT
72
    GROUP_CREATION_SUBJECT, SITENAME
73 73
)
74 74
from astakos.im.endpoints.qh import (
75 75
    register_users, send_quota, register_resources
......
1212 1212
        if commit:
1213 1213
            application.save()
1214 1214
            application.definition.resource_policies = resource_policies
1215
            # better implementation ???
1216
            if precursor_application:
1217
                try:
1218
                    precursor = ProjectApplication.objects.get(id=precursor_application_id)
1219
                except:
1220
                    pass
1221
                precursor.state = REPLACED
1222
                precursor.save()
1223
                application.precursor_application_id = precursor
1224
                application.save()
1225 1215
        else:
1226 1216
            notification = build_notification(
1227 1217
                settings.SERVER_EMAIL,
......
1258 1248
            project.application = self
1259 1249
            project.last_approval_date = datetime.now()
1260 1250
            project.save()
1251
            self.precursor_application.state = REPLACED
1261 1252
        self.state = APPROVED
1262 1253
        self.save()
1263 1254

  
......
1380 1371
        m, created = ProjectMembership.objects.get_or_create(
1381 1372
            person=user, project=self
1382 1373
        )
1383
        m.accept(user, delete_on_failure=created, request_user=None)
1374
        m.accept(delete_on_failure=created, request_user=None)
1384 1375

  
1385 1376
    def reject_member(self, user, request_user=None):
1386 1377
        """
......
1502 1493
            project=self.project,
1503 1494
            request_date=self.request_date,
1504 1495
            rejection_date=datetime.now()
1505
        ).save()
1496
        )
1506 1497
        self.delete()
1498
        history_item.save()
1507 1499
        notification = build_notification(
1508 1500
            settings.SERVER_EMAIL,
1509 1501
            [self.person.email],
......
1553 1545
        self.project.membership_dirty = True
1554 1546
        self.project.save()
1555 1547
        
1556
        rejected = self.project.sync(specific_members=[self])
1548
        rejected = self.project.sync(specific_members=[self.person])
1557 1549
        if not rejected:
1558 1550
            # if syncing was successful unset membership_dirty flag
1559 1551
            self.membership_dirty = False
......
1716 1708

  
1717 1709

  
1718 1710
def check_auto_accept_join_membership_policy(sender, instance, created, **kwargs):
1711
    if not created:
1712
        return
1719 1713
    if created:
1720 1714
        join_policy = instance.project.application.definition.member_join_policy
1721 1715
        if join_policy == get_auto_accept_join():

Also available in: Unified diff