File diff cadd69061f18 → 3cccc3bdd90e
conservancy/usethesource/admin.py
Show inline comments
 
from django.contrib import admin
 

	
 
from .emails import make_candidate_email
 
from .models import Candidate, Comment
 

	
 

	
...
 
@@ -25,3 +26,11 @@ class CandidateAdmin(admin.ModelAdmin):
 
    ]
 
    inlines = [CommentInline]
 
    prepopulated_fields = {'slug': ['name']}
 

	
 
    def save_model(self, request, obj, form, change):
 
        send_email = obj.id is None
 
        super().save_model(request, obj, form, change)
 
        if send_email:
 
            # Announce the new candidate
 
            email = make_candidate_email(obj, request.user)
 
            email.send()