Property class on AppEngine does not support a tuple for choices
Google AppEngine does not allow one to set the choices field of a model property to a tuple; this workaround will have have a form give the user the choices with the user friendly items but have the backend store the non-user friendly version.
# Set up our non-user friendly and user friendly choices REDIRECT_CHOICES = ( (301, "301 - Permanent Redirect"), (302, "302 - Temporary Redirect"), (403, "403 - Access Denied"), (404, "404 - File Not Found"), (500, "500 - Internal Server Error") ) # Sample model that has the required Property with the choices set to the non-user friendly values class Shorturl(db.Model): uripath = db.StringProperty(verbose_name="Path", required=True) httpcode = db.IntegerProperty(verbose_name="HTTP code", required=True, default=301, choices=[x[0] for x in REDIRECT_CHOICES]) location = db.StringProperty(verbose_name="Location") # This is our djangoform that has the choices set as required so that the user gets the user friendly version and not just simply # the numbers. class ShorturlForm(djangoforms.ModelForm): httpcode = forms.IntegerField(widget=forms.Select(choices=REDIRECT_CHOICES), required=True, label='HTTP code') class Meta: model = Shorturl
Given the above tuple it will set the choices in the model for Google AppEngine and pass it to the field on the Django form allowing user friendly output. This will allow the user to pick the right redirect choice without having to know that various different redirect codes or have to look them up.