Ignore:
Timestamp:
Jul 6, 2012, 2:49:11 AM (13 years ago)
Author:
Alex Dehnert <adehnert@…>
Branches:
master, space-access, stable, stage
Children:
cbdbd1f
Parents:
cd98e17
git-author:
Alex Dehnert <adehnert@…> (07/06/12 02:33:16)
git-committer:
Alex Dehnert <adehnert@…> (07/06/12 02:49:11)
Message:

Forbid commas in FYSM display names (ASA Trac #40)

This is perhaps overenthusiastic, especially since groups can't opt out. On
the other hand, we do actually have a handful of groups with commas that
aren't ", MIT" or ", The" that shouldn't have the comma in their display
name, and I sorta want to catch them too. Also, we have maybe one group
that should have a comma in their display name...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • asadb/forms/views.py

    rcd98e17 r3496370  
    1717from django.forms import ModelForm
    1818from django.forms import ModelChoiceField, ModelMultipleChoiceField
     19from django.forms import ValidationError
    1920from django.db import connection
    2021from django.db.models import Q, Count
     
    149150        )
    150151
     152    def clean_display_name(self, ):
     153        name = self.cleaned_data['display_name']
     154        if ',' in name:
     155            raise ValidationError("""In general, commas in a display name are a mistake and will look bad (group names like "Punctuation Society, MIT" should probably be "Punctuation Society"). If you do want a comma, contact asa-fysm@mit.edu and we'll put it in for you.""")
     156        return name
     157
    151158@login_required
    152159def fysm_manage(request, group, ):
Note: See TracChangeset for help on using the changeset viewer.