React ts - Mailer models#212
Open
Bhavishya-Chaturvedi wants to merge 8 commits intoSpoken-tutorial:react-tsfrom
Open
React ts - Mailer models#212Bhavishya-Chaturvedi wants to merge 8 commits intoSpoken-tutorial:react-tsfrom
Bhavishya-Chaturvedi wants to merge 8 commits intoSpoken-tutorial:react-tsfrom
Conversation
ankitamk14
requested changes
Oct 23, 2025
Comment on lines
13
to
21
| status = models.CharField( | ||
| max_length=20, | ||
| choices=[ | ||
| ('pending'), | ||
| ('sent',), | ||
| ('failed',), | ||
| ], | ||
| default='pending' | ||
| ) |
Collaborator
There was a problem hiding this comment.
Define choices in tuple, and then use it in choices.
STATUS_CHOICES = [
('pending', 'Pending'),
('sent', 'Sent'),
('failed', 'Failed'),
]
| Stores individual email addresses and their sending status. | ||
| Each row corresponds to one email address from the uploaded CSV file. | ||
| """ | ||
| email_address = models.EmailField(unique=True) |
Collaborator
There was a problem hiding this comment.
remove unique constrained as multiple mails can be sent to the same email
| related_name='email_contents' | ||
| ) | ||
| created_at = models.DateTimeField(auto_now_add=True) | ||
| user_id = models.ForeignKey( |
Collaborator
There was a problem hiding this comment.
The field name should be user, not user_id. Django automatically creates _id in the database column.
| ) | ||
| created_at = models.DateTimeField(auto_now_add=True) | ||
| user_id = models.ForeignKey( | ||
| 'auth.User', |
Collaborator
There was a problem hiding this comment.
Import explicitly
from django.contrib.auth.models import User
and then user User as fk
| Stores individual email addresses and their sending status. | ||
| Each row corresponds to one email address from the uploaded CSV file. | ||
| """ | ||
| email_address = models.EmailField(unique=True) |
Collaborator
There was a problem hiding this comment.
Consider adding for faster lookups by email.:
class Meta:
indexes = [models.Index(fields=['email_address'])]
…ployer-Recommendation-System into react-ts Updating changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added two models in the mailer app. The structure of the models are listed below:
EmailRecord:
id = auto generated
email_address = charater
created_at = DateTimeField(auto_now_add=True)
status = CharField(max_length=20, choices=[('pending'), ('sent',), ('failed',), ], default='pending') # status of the mail
sent_at = DateTimeField(null=True, blank=True)
error_message = extField(null=True, blank=True) # optional for better error handling
EmailContent:
id = auto generated
subject = CharField(max_length=255)
mail_body = TextField()
email_records = ManyToManyField( EmailRecord,) #Foreign key for EmailRecord table
created_at = DateTimeField(auto_now_add=True)
user_id = ForeignKey( 'auth.User', on_delete=models.CASCADE,) #Foreign key for auth users