예제 #1
0
파일: logic.py 프로젝트: he1mdallr/the-tale
def create_restriction(group, external_id, name):
    model = models.Restriction.objects.create(group=group,
                                              external_id=external_id,
                                              name=name)
    restriction = objects.Restriction.from_model(model)
    restrictions_storage.add_item(restriction.id, restriction)
    restrictions_storage.update_version()
    return restriction
예제 #2
0
def sync_restriction(group, external_id, name):
    restriction = restrictions_storage.get_restriction(group, external_id)

    if restriction is None:
        return create_restriction(group, external_id, name)

    restriction.name = name
    models.Restriction.objects.filter(id=restriction.id).update(name=name)
    restrictions_storage.update_version()

    return restriction
예제 #3
0
파일: logic.py 프로젝트: he1mdallr/the-tale
def sync_restriction(group, external_id, name):
    restriction = restrictions_storage.get_restriction(group, external_id)

    if restriction is None:
        return create_restriction(group, external_id, name)

    restriction.name = name
    models.Restriction.objects.filter(id=restriction.id).update(name=name)
    restrictions_storage.update_version()

    return restriction
예제 #4
0
def create_restriction(group, external_id, name):
    model = models.Restriction.objects.create(group=group, external_id=external_id, name=name)
    restriction = objects.Restriction.from_model(model)
    restrictions_storage.add_item(restriction.id, restriction)
    restrictions_storage.update_version()
    return restriction