Skip to content

Commit

Permalink
Add site to new incident email, order orgs, fix MR admin pane (#707)
Browse files Browse the repository at this point in the history
Co-authored-by: Trevor Skaggs <[email protected]>
  • Loading branch information
trevorskaggs and Trevor Skaggs authored Apr 3, 2024
1 parent b513a1f commit 2474f5b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion incident/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from datetime import datetime
from django.contrib.sites.models import Site
from django.core.mail import send_mail
from django.template.loader import render_to_string
from rest_framework import permissions, viewsets
Expand Down Expand Up @@ -35,6 +36,7 @@ def perform_create(self, serializer):
if not inc.training:
emails = [user.email for user in ShelterlyUser.objects.filter(is_superuser=True)]
message_data = {
'site': Site.objects.get_current(),
'user_email': self.request.user.email,
'organization_name': inc.organization.name,
'organization_slug': inc.organization.slug,
Expand Down Expand Up @@ -83,7 +85,7 @@ class OrganizationViewSet(viewsets.ModelViewSet):
serializer_class = OrganizationSerializer

def get_queryset(self):
queryset = Organization.objects.filter(id__in=self.request.user.organizations.all())
queryset = Organization.objects.filter(id__in=self.request.user.organizations.all()).order_by('name')

if self.request.GET.get('slug'):
queryset = queryset.filter(slug=self.request.GET.get('slug'))
Expand Down
2 changes: 1 addition & 1 deletion templates/new_incident_email.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<html>
<head></head>
<body>
{{ user_email }} from the {{ organization_name }} has created a new incident: {{ incident_name }}. Click <h1><a href="{{ site }}/{{ organization_slug }}/{{ incident_slug }}">here</a></h1> to open the incident.
{{ user_email }} from {{ organization_name }} has created a new incident: {{ incident_name }}. Click <h1><a href="{{ site }}/{{ organization_slug }}/{{ incident_slug }}">here</a></h1> to open the incident.
</body>
</html>
2 changes: 1 addition & 1 deletion templates/new_incident_email.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{ user_email }} from the {{ organization_name }} has created a new incident: {{ incident_name }}. Click <h1><a href="{{ site }}/{{ organization_slug }}/{{ incident_slug }}">here</a></h1> to open the incident.
{{ user_email }} from the {{ organization_name }} has created a new incident: {{ incident_name }}. Click <a href="{{ site }}/{{ organization_slug }}/{{ incident_slug }}">here</a> to open the incident.
2 changes: 1 addition & 1 deletion vet/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ExamQuestionAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'default',)

class MedicalRecordAdmin(admin.ModelAdmin):
list_display = ('id', 'patient', 'exam',)
list_display = ('id', 'patient',)

class VetRequestAdmin(admin.ModelAdmin):
list_display = ('id', 'requested_by', 'medical_record',)
Expand Down

0 comments on commit 2474f5b

Please sign in to comment.