Browse Source

filter inly active admins

devel
Dmitry Novikov 7 years ago
parent
commit
c2f49238b1
  1. 2
      msg_app/forms.py
  2. 2
      msg_app/models.py
  3. 2
      taskapp/forms.py
  4. 2
      taskapp/models.py

2
msg_app/forms.py

@ -7,7 +7,7 @@ from accounts_app.models import UserProfile
class ConversationForm(forms.ModelForm): class ConversationForm(forms.ModelForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(ConversationForm, self).__init__(*args, **kwargs) super(ConversationForm, self).__init__(*args, **kwargs)
user_profile_queryset = UserProfile.objects.filter(is_admin=True)
user_profile_queryset = UserProfile.objects.filter(is_admin=True, is_active=True)
if user_profile_queryset is not None: if user_profile_queryset is not None:
self.fields['participants'].choices = [(up.pk, up.get_full_name()) for up in user_profile_queryset] self.fields['participants'].choices = [(up.pk, up.get_full_name()) for up in user_profile_queryset]

2
msg_app/models.py

@ -209,7 +209,7 @@ class Conversation(models.Model):
attachment=attachment, author=author attachment=attachment, author=author
) )
if with_status: if with_status:
for participant in self.participants.all():
for participant in self.participants.filter(is_active=True):
if participant == author: if participant == author:
continue continue
MessageStatus.objects.create(msg=msg, user=participant) MessageStatus.objects.create(msg=msg, user=participant)

2
taskapp/forms.py

@ -11,7 +11,7 @@ class TaskFrm(forms.ModelForm):
'out_date': delta_add_days().strftime("%Y-%m-%d") 'out_date': delta_add_days().strftime("%Y-%m-%d")
}}) }})
super(TaskFrm, self).__init__(*args, **kwargs) super(TaskFrm, self).__init__(*args, **kwargs)
self.fields['recipients'].queryset = UserProfile.objects.filter(is_admin=True)
self.fields['recipients'].queryset = UserProfile.objects.filter(is_admin=True, is_active=True)
if initial_abon is not None: if initial_abon is not None:
# fetch profiles that has been attached on group of selected subscriber # fetch profiles that has been attached on group of selected subscriber

2
taskapp/models.py

@ -103,7 +103,7 @@ class Task(models.Model):
def send_notification(self): def send_notification(self):
task_handle( task_handle(
self, self.author, self, self.author,
self.recipients.all()
self.recipients.filter(is_active=True)
) )
def get_attachment_fname(self): def get_attachment_fname(self):

Loading…
Cancel
Save