old_contents: # -*- coding: utf-8 -*-
  from atom.ext.guardian.forms import TranslatedUserObjectPermissionsForm
  from atom.ext.crispy_forms.forms import SingleButtonMixin
  from braces.forms import UserKwargModelFormMixin
  from django import forms
  from django.utils.translation import ugettext as _
  from dal import autocomplete
  from .models import Monitoring
  from feder.users.models import User
  
  
  class MonitoringForm(SingleButtonMixin, UserKwargModelFormMixin, forms.ModelForm):
      def __init__(self, *args, **kwargs):
          super(MonitoringForm, self).__init__(*args, **kwargs)
          self.instance.user = self.user
  
      class Meta:
          model = Monitoring
          fields = ['name', 'description', 'notify_alert', 'subject', 'template']
  
  
  class SelectUserForm(forms.Form):
      user = forms.ModelChoiceField(
          queryset=User.objects.all(),
          widget=autocomplete.ModelSelect2(url='users:autocomplete'),
          label=_("User")
      )
  
  
  class SaveTranslatedUserObjectPermissionsForm(SingleButtonMixin,
                                                TranslatedUserObjectPermissionsForm):
      pass
  
new_contents: # -*- coding: utf-8 -*-
  from atom.ext.guardian.forms import TranslatedUserObjectPermissionsForm
  from atom.ext.crispy_forms.forms import SingleButtonMixin
  from braces.forms import UserKwargModelFormMixin
  from django import forms
  from django.utils.translation import ugettext as _
  from dal import autocomplete
  from .models import Monitoring
  from feder.users.models import User
  from crispy_forms.layout import Layout, Fieldset
  
  
  class MonitoringForm(SingleButtonMixin, UserKwargModelFormMixin, forms.ModelForm):
      def __init__(self, *args, **kwargs):
          super(MonitoringForm, self).__init__(*args, **kwargs)
          if not self.instance.pk:  # disable fields for create
              del self.fields['notify_alert']
          self.instance.user = self.user
          self.helper.layout = Layout(
              Fieldset(_("Monitoring"), 'name', 'description', 'notify_alert'),
              Fieldset(_("Template"), 'subject', 'template')
          )
  
      class Meta:
          model = Monitoring
          fields = ['name', 'description', 'notify_alert', 'subject', 'template']
  
  
  class SelectUserForm(forms.Form):
      user = forms.ModelChoiceField(
          queryset=User.objects.all(),
          widget=autocomplete.ModelSelect2(url='users:autocomplete'),
          label=_("User")
      )
  
  
  class SaveTranslatedUserObjectPermissionsForm(SingleButtonMixin,
                                                TranslatedUserObjectPermissionsForm):
      pass
  
subject: Add fieldset in MonitoringForm