Changeset 51b384a
- Timestamp:
- Sep 10, 2012, 4:50:40 AM (13 years ago)
- Branches:
- master, space-access, stable, stage
- Children:
- 72a3d90
- Parents:
- 71e71e3
- git-author:
- Alex Dehnert <adehnert@…> (09/10/12 04:50:40)
- git-committer:
- Alex Dehnert <adehnert@…> (09/10/12 04:50:40)
- Location:
- asadb
- Files:
-
- 3 edited
-
groups/models.py (modified) (2 diffs)
-
groups/views.py (modified) (1 diff)
-
mit/__init__.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
asadb/groups/models.py
rc632b1c r51b384a 16 16 import settings 17 17 18 import mit 19 18 20 # Create your models here. 19 21 … … 33 35 group_funding = models.ForeignKey('GroupFunding', null=True, blank=True, db_index=True, ) 34 36 website_url = models.URLField() 35 constitution_url = models.CharField(max_length=200, blank=True )37 constitution_url = models.CharField(max_length=200, blank=True, validators=[mit.UrlOrAfsValidator]) 36 38 meeting_times = models.TextField(blank=True) 37 39 advisor_name = models.CharField(max_length=100, blank=True) -
asadb/groups/views.py
r71e71e3 r51b384a 128 128 for field in self.force_required: 129 129 self.fields[field].required = True 130 self.fields['constitution_url'].help_text = mark_safe(" Please put your current constitution URL, if you have one.<br>If your constitution is currently an AFS path, you can either use the corresponding web.mit.edu (e.g., http://web.mit.edu/locker/path/to/const.html) or stuff.mit.edu path, or just use http://asa.mit.edu/const/afs/your-afs-path.<br>If you don't currently know where your constitution is, put http://mit.edu/asa/start/constitution-req.html.<br>(In either of these last two cases, we'll get in touch with you later about putting something better in.)")130 self.fields['constitution_url'].help_text = mark_safe("""Please put your current constitution URL or AFS path.<br>If you don't currently know where your constitution is, put "http://mit.edu/asa/start/constitution-req.html" and draft a constitution soon.""") 131 131 132 132 exec_only_fields = [ -
asadb/mit/__init__.py
r7045dd8 r51b384a 10 10 from django.contrib import auth 11 11 from django.core.exceptions import ObjectDoesNotExist 12 from django.core.validators import URLValidator, ValidationError 13 12 14 import settings 13 15 … … 18 20 ) 19 21 proc.communicate(msg) 22 23 def UrlOrAfsValidator(value): 24 if value.startswith('/mit/') or value.startswith('/afs/'): 25 return 26 else: 27 try: 28 URLValidator()(value) 29 except ValidationError: 30 raise ValidationError('Provide a valid URL or AFS path') 20 31 21 32 class ScriptsRemoteUserMiddleware(RemoteUserMiddleware):
Note: See TracChangeset
for help on using the changeset viewer.