我想根据复选框选择添加多个复选框以过滤视图中的花朵。我对 Django 非常陌生。如何修改我的 models.py ?
from django.db import models
class Flower(models.Model):
name = models.CharField(max_length = 30)
price = models.DecimalField(max_digits=6, decimal_places=2)
details = models.TextField()
def __unicode__(self):
return self.name
def my_upload_to(instance, filename):
return 'static/media/' + instance.name + '.jpg'
image = models.ImageField(upload_to=my_upload_to)