Overloading Django Form Fields
pydanny.com
pydanny.com
from django.db import models
+from django.core.exceptions import ValidationError
+def not_empty(value):
+ if value == u'': raise ValidationError(u'Empty value')
class MyModel(models.Model):
- name = models.CharField(max_length=50, blank=True)
+ name = models.CharField(max_length=50, blank=True, validators=[not_empty])https://docs.djangoproject.com/en/dev/ref/models/fields/#bla...
Have you tested other pricing strategies? Like $13.99 or $14.99? I think $14.99 would net you a slight bigger sale without a loss of sales. Though $13.99 might have them drop due to how people perceive the number 13 to be an undesirable number.
This looks nice for when the fields in a form and model are identical, but in my experience that doesn't happen all that often.
class Meta:
fields = ('only', 'whitelisted', 'fields')
which defaults the form to exposing all the model fields for modification, allowing naughtyness not unlike the Rails mass-assignment issues that cropped up a while back.Or maybe the name field having blank=True, but no default value?
Also, blank fields don't require defaults.