GNOME-Nepal / site-server

Backend server for GNOME Nepal
MIT License
6 stars 7 forks source link

[REQUEST]: Enhance the NewsletterSubscriber Model with Additional Fields #7

Closed Sailesh-Singh closed 1 month ago

Sailesh-Singh commented 1 month ago

Feature Name

Newsletter

Feature Description

Right now, the NewsletterSubscriber model only stores basic information like email and timestamps for creation and updates. However, we want to improve the functionality of the newsletter subscription system. For example, we need to track if a user is active or not, when they subscribed, and when they last received a newsletter. We also need to make it easier for subscribers to opt-out with a unique unsubscribe token.

Benefits

  1. is_active: Easily manage active vs inactive subscribers. 2. name: Personalize newsletters for better engagement. 3. unsubscribe_token: Automate and simplify unsubscriptions. 4. subscription_date: Track subscription history for targeted campaigns. 5. last_sent: Monitor last contact and prevent over-sending. These features enhance subscriber control and optimize email campaign management.

Additional Notes

New Fields to Add:

  1. is_active Field: Tracks if a subscriber is active and receiving newsletters. Default is True.

    ('is_active', models.BooleanField(default=True)),
  2. name Field: Stores the subscriber’s name (optional, can be left blank).

    ('name', models.CharField(max_length=200, null=True, blank=True)),
  3. unsubscribe_token Field: Generates a unique token for creating unsubscribe links. Automatically generated.

    ('unsubscribe_token', models.CharField(default=uuid.uuid4, max_length=100, unique=True)),
  4. subscription_date Field: Records the date and time a user subscribed. Auto-populates on creation.

    ('subscription_date', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
  5. last_sent Field: Stores the date/time of the last newsletter sent. Can be left blank.

    ('last_sent', models.DateTimeField(null=True, blank=True)),

Custom Manager:

For querying active subscribers:

class ActiveSubscriberManager(models.Manager):
    def get_queryset(self):
        return super().get_queryset().filter(is_active=True)