楷模:
from django.db import models
class Image(models.Model):
advertisement = models.ForeignKey('Advertisement')
image = ImageWithThumbsField(upload_to=store_path, blank=True)
class Advertisement(models.Model):
#some code here
class AdvertOne(Advertisement):
#some code again
class AdvertTwo(Advertisement):
#and again
形式:
from models import Advertisement
from django.forms import *
class AdvertisementForm(ModelForm):
message = CharField(max_length=400, widget=Textarea)
image = ImageField(required=False)
问:我应该如何形成上传视图?