Пример #1
0
class AdImage(models.Model):
    ad = models.ForeignKey(
        Ad,
        on_delete=models.CASCADE,
        verbose_name=_('Ad'),
        related_name='images')
    device = models.CharField(
        verbose_name=_('Device'), max_length=2, choices=settings.ADS_DEVICES)
    image = models.ImageField(
        upload_to='ad-images',
        verbose_name=_('Image'),
        max_length=255)
    zone = models.CharField(
        verbose_name=_('Zone'), max_length=50, null=True, blank=True, choices=get_zones_choices())
Пример #2
0
 class Meta:
     fields = '__all__'
     widgets = {
         'zone': forms.Select(choices=get_zones_choices())
     }