Advertisement
VssA

Untitled

Jan 14th, 2023
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.76 KB | None | 0 0
  1. from django.db import models
  2.  
  3.  
  4. class Profession(models.Model):
  5.     title = models.CharField('Название', max_length=50)
  6.     description = models.TextField('Описание', blank=True)
  7.     image = models.ImageField('Изображение', blank=True, upload_to='profession_img/')
  8.  
  9.     def __str__(self):
  10.         return self.title
  11.  
  12.     class Meta:
  13.         verbose_name = 'Профессия'
  14.         verbose_name_plural = 'Профессии'
  15.  
  16.  
  17. class RelevancePage(models.Model):
  18.  
  19.     def __str__(self):
  20.         return 'Востребованность'
  21.  
  22.     class Meta:
  23.         verbose_name = 'Востребованность'
  24.         verbose_name_plural = 'Востребованность'
  25.  
  26.  
  27. class GeoPage(models.Model):
  28.  
  29.     def __str__(self):
  30.         return 'География'
  31.  
  32.     class Meta:
  33.         verbose_name = 'География'
  34.         verbose_name_plural = 'География'
  35.  
  36.  
  37. class SkillPage(models.Model):
  38.  
  39.     def __str__(self):
  40.         return 'Навыки'
  41.  
  42.     class Meta:
  43.         verbose_name = 'Навыки'
  44.         verbose_name_plural = 'Навыки'
  45.  
  46.  
  47. class Element(models.Model):
  48.     title = models.CharField('Заголовок', max_length=100)
  49.     csv_file = models.FileField('Файл .csv', upload_to='csv/')
  50.     img_file = models.ImageField('График', upload_to='charts/')
  51.  
  52.     relevance_id = models.ForeignKey(RelevancePage, on_delete=models.DO_NOTHING, null=True)
  53.     geo_id = models.ForeignKey(GeoPage, on_delete=models.DO_NOTHING, null=True)
  54.     skill_id = models.ForeignKey(SkillPage, on_delete=models.DO_NOTHING, null=True)
  55.  
  56.     class Meta:
  57.         verbose_name = 'Элемент'
  58.         verbose_name_plural = 'Элементы'
  59.  
  60.     def __str__(self):
  61.         return self.title
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement