@@ -0,0 +1,1973 @@
+# Copyright (C) 2011, Valentin Lorentz%0A#%0A# This program is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as%0A# published by the Free Software Foundation, either version 3 of the%0A# License, or (at your option) any later version.%0A#%0A# This program is distributed in the hope that it will be useful,%0A# but WITHOUT ANY WARRANTY; without even the implied warranty of%0A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A# GNU Affero General Public License for more details.%0A#%0A# You should have received a copy of the GNU Affero General Public License%0A# along with this program.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A%0Afrom django import forms%0Afrom django.db import models%0A%0Aclass PeopleField(forms.ModelChoiceField):%0A    def to_python(self, value):%0A        from wididitserver.models import get_people%0A        return get_people(value)%0A%0Aclass TagField(forms.ModelChoiceField):%0A    def to_python(self, value):%0A        from wididitserver.models import Tag%0A        return Tag.objects.get_or_create_from_path(value)%0A%0Aclass EntryField(forms.ModelChoiceField):%0A    def validate(self, value):%0A        from wididitserver.models import Entry%0A        if isinstance(value, Entry):%0A            return%0A        if not isinstance(value, unicode):%0A            raise forms.ValidationError(value.__class__)%0A        splitted = value.split('/')%0A        if len(splitted) != 2:%0A            raise forms.ValidationError('An entry field must be in the '%0A                    'format %3Cuserid%3E/%3Centryid%3E')%0A    def to_python(self, value):%0A        from wididitserver.models import Entry, get_people%0A        if isinstance(value, Entry):%0A            return value%0A        splitted = value.split('/')%0A        userid, entryid = splitted%0A        try:%0A            return Entry.objects.get(author=get_people(userid), id2=entryid)%0A        except Entry.DoesNotExist:%0A            raise forms.ValidationError('This entry does not exist.')%0A

Add forgotten file.