Exemplo n.º 1
0
def _validate_name(value):
    name = value.strip()
    link = uslugify(name)
    if len(link) < 3:
        raise ValidationError(_("ERROR_NAME_TO_SHORT"))
    if link in _RESERVED_NAMES:
        raise ValidationError(_("ERROR_NAME_RESERVED"))
    if bool(len(Team.objects.filter(link=link))):
        raise ValidationError(_("ERROR_NAME_USED"))
    if bool(len(Team.objects.filter(name=name))):
        raise ValidationError(_("ERROR_NAME_USED"))
Exemplo n.º 2
0
def _validate_name(value):
    name = value.strip()
    link = uslugify(name)
    if len(link) < 3:
        raise ValidationError(_("ERROR_NAME_TO_SHORT"))
    if link in _RESERVED_NAMES:
        raise ValidationError(_("ERROR_NAME_RESERVED"))
    if bool(len(Team.objects.filter(link=link))):
        raise ValidationError(_("ERROR_NAME_USED"))
    if bool(len(Team.objects.filter(name=name))):
        raise ValidationError(_("ERROR_NAME_USED"))
Exemplo n.º 3
0
def create(account, team, name, content, order):
    assert_member(account, team)
    page = Page()
    page.team = team
    page.name = name
    page.link = uslugify(name)
    page.content = content
    page.order = order
    page.created_by = account
    page.updated_by = account
    page.save()
    return page
Exemplo n.º 4
0
def create(account, team, name, content, order):
    assert_member(account, team)
    page = Page()
    page.team = team
    page.name = name
    page.link = uslugify(name)
    page.content = content
    page.order = order
    page.created_by = account
    page.updated_by = account
    page.save()
    return page
Exemplo n.º 5
0
 def clean(self):
     cleaned_data = super(EditPageForm, self).clean()
     name = cleaned_data.get("name").strip()
     link = uslugify(name)
     if len(link) < 3:
         raise forms.ValidationError(_("ERROR_NAME_TO_SHORT"))
     if link in _RESERVED_NAMES:
         raise forms.ValidationError(_("ERROR_NAME_RESERVED"))
     if len(Page.objects.filter(name=name, team=self.page.team)) > 1:
         raise forms.ValidationError(_("ERROR_NAME_USED"))
     if len(Page.objects.filter(link=link, team=self.page.team)) > 1:
         raise forms.ValidationError(_("ERROR_NAME_USED"))
     return cleaned_data
Exemplo n.º 6
0
 def clean(self):
     cleaned_data = super(EditPageForm, self).clean()
     name = cleaned_data.get("name").strip()
     link = uslugify(name)
     if len(link) < 3:
         raise forms.ValidationError(_("ERROR_NAME_TO_SHORT"))
     if link in _RESERVED_NAMES:
         raise forms.ValidationError(_("ERROR_NAME_RESERVED"))
     if len(Page.objects.filter(name=name, team=self.page.team)) > 1:
         raise forms.ValidationError(_("ERROR_NAME_USED"))
     if len(Page.objects.filter(link=link, team=self.page.team)) > 1:
         raise forms.ValidationError(_("ERROR_NAME_USED"))
     return cleaned_data
Exemplo n.º 7
0
def create(account, name, country, logo, application):
    team = None
    with transaction.commit_on_success():
        team = Team()
        team.name = name
        team.link = uslugify(name)
        team.country = country
        team.logo = logo
        team.application = application
        team.created_by = account
        team.updated_by = account
        team.save()
        team.members.add(account)
    signals.team_created.send(sender=create, team=team, creator=account)
    return team
Exemplo n.º 8
0
def create(account, name, country, logo, application):
    team = None
    with transaction.commit_on_success():
        team = Team()
        team.name = name
        team.link = uslugify(name)
        team.country = country
        team.logo = logo
        team.application = application
        team.created_by = account
        team.updated_by = account
        team.save()
        team.members.add(account)
    signals.team_created.send(sender=create, team=team, creator=account)
    return team