Added expert review/edit document
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
from django.contrib import admin
|
||||
from .models import EmailConfirmation
|
||||
from .models import EmailConfirmation, ExpertAnalysisEmails
|
||||
|
||||
|
||||
class EmailConfirmationAdmin(admin.ModelAdmin):
|
||||
list_display= ['email', 'uuid', 'created_at']
|
||||
|
||||
class ExpertAnalysisEmailsAdmin(admin.ModelAdmin):
|
||||
list_display = ['email', 'created_at']
|
||||
|
||||
|
||||
admin.site.register(EmailConfirmation, EmailConfirmationAdmin)
|
||||
admin.site.register(ExpertAnalysisEmails, ExpertAnalysisEmailsAdmin)
|
||||
|
||||
21
backend/accounts/migrations/0003_expertanalysisemails.py
Normal file
21
backend/accounts/migrations/0003_expertanalysisemails.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 5.1.3 on 2025-08-17 15:39
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('accounts', '0002_emailconfirmation_confirmed'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ExpertAnalysisEmails',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('email', models.EmailField(max_length=254, unique=True)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
],
|
||||
),
|
||||
]
|
||||
@@ -10,4 +10,11 @@ class EmailConfirmation(models.Model):
|
||||
confirmed = models.BooleanField(default=False)
|
||||
|
||||
def is_expired(self):
|
||||
return now() > (self.created_at + timedelta(days=1))
|
||||
return now() > (self.created_at + timedelta(days=1))
|
||||
|
||||
class ExpertAnalysisEmails(models.Model):
|
||||
email = models.EmailField(unique=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.email
|
||||
@@ -43,6 +43,26 @@ def send_payment_email(email):
|
||||
fail_silently=False,
|
||||
)
|
||||
|
||||
def send_documet_to_expert(email, document):
|
||||
subject = "Document for Expert Analysis"
|
||||
document_link = f"{site_domain}{reverse('core:document', args=[document.id])}"
|
||||
edit_link = f"{site_domain}{reverse('admin:core_document_change', args=[document.id])}"
|
||||
|
||||
message = f"""
|
||||
You have been assigned a document for expert analysis.
|
||||
Document ID: {document.id}
|
||||
Document Link: {document_link}
|
||||
Edit Document: {edit_link}
|
||||
"""
|
||||
|
||||
send_mail(
|
||||
subject=subject,
|
||||
message=message,
|
||||
from_email=settings.DEFAULT_FROM_EMAIL,
|
||||
recipient_list=[email],
|
||||
fail_silently=False,
|
||||
)
|
||||
|
||||
def send_document_email(email, document_link, document):
|
||||
image_io = generate_first_page_image(document)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user