Advertisement
Mochinov

Untitled

Dec 10th, 2021
815
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.30 KB | None | 0 0
  1.  
  2. """ Вьюшка для обновления настройки таблицы тамбова """
  3. class PacientSettingsTableUpdate(UpdateView):
  4.     """ Обновление настроек таблицы пациентов пользователя"""
  5.  
  6.     form_class = SpisSettingsForm
  7.     success_url = reverse_lazy('users:pacient_list')
  8.     template_name = 'users/update_settings.html'
  9.  
  10.  
  11.     def get_object(self, queryset=None):
  12.         obj, created = SpisSettings.objects.get_or_create(doctor=self.request.user)
  13.         return obj
  14.  
  15.  
  16.  
  17.  
  18.  
  19. ------------------------------------------------------------------------------------------------------------
  20.  
  21. """ Форма настройки пациента """
  22.  
  23. class SpisSettingsForm(forms.ModelForm):
  24.     """ Форма настройки пациента """
  25.  
  26.     class Meta:
  27.         model = SpisSettings
  28.         exclude = ['doctor']
  29.  
  30.  
  31. ------------------------------------------------------------------------------------------------------------
  32.  
  33. """ Таблица для редактирования настройки """
  34.  
  35. class SpisSettings(models.Model):
  36.     doctor = models.OneToOneField(CustomUser, on_delete = models.CASCADE, default=None, verbose_name='Врач')
  37.     fam = models.BooleanField(verbose_name = "Фамилия", blank=True, null=True, default=True)
  38.     im = models.BooleanField(verbose_name = "Имя", blank=True, null=True, default=True)
  39.     otc = models.BooleanField(verbose_name = "Отчество", blank=True, null=True, default=True)
  40.     adr = models.BooleanField(verbose_name = "Улица", blank=True, null=True, default=True)
  41.     dom = models.BooleanField(verbose_name = "Дом", blank=True, null=True, default=True)
  42.     kor = models.BooleanField(verbose_name = "Корпус", blank=True, null=True, default=True)
  43.     kw = models.BooleanField(verbose_name = "Квартира", blank=True, null=True, default=True)
  44.     pol =  models.BooleanField(verbose_name="Пол", blank=True, null=True, default=True)
  45.     sot_tel = models.BooleanField(verbose_name="Сотовый телефон", blank=True, null=True, default=True)
  46.     dat = models.BooleanField(verbose_name="Дата рождения", blank=True, null=True, default=True)
  47.     ss = models.BooleanField(verbose_name="СНИЛС", blank=True, null=True, default=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement