django-admin2/example/files/models.py
yarbelk 690401d604 Fix missing enctype="multipart/form-data" when needed
- add app example.files with tests, based on example2.
- add check in base update template which checks if
  form.is_multitype and adds the encoding for it
- update gitignore to ignore the uploaded media folder
- add test to blog to ensure that the create form is not
  multipart encoded
2013-09-11 22:20:38 +08:00

28 lines
852 B
Python

# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
class CaptionedFile(models.Model):
caption = models.CharField(max_length=200, verbose_name=_('caption'))
publication = models.FileField(upload_to='media', verbose_name=_('Uploaded File'))
def __unicode__(self):
return self.caption
class Meta:
verbose_name = _('Captioned File')
verbose_name_plural = _('Captioned Files')
class UncaptionedFile(models.Model):
publication = models.FileField(upload_to='media', verbose_name=_('Uploaded File'))
def __unicode__(self):
return unicode(self.publication)
class Meta:
verbose_name = _('Uncaptioned File')
verbose_name_plural = _('Uncaptioned Files')