-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nilanchal Panigrahy
committed
Dec 26, 2023
1 parent
4221499
commit 948e4aa
Showing
47 changed files
with
337 additions
and
221 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"updates": { | ||
"heading": "In the news this week..", | ||
"list": [ | ||
{ | ||
"title": "Project Lombok-Is it Still Relevant in 2023?", | ||
"thumbnail": "https://media.stacktips.com/media/uploads/posts/Project_Lombok.jpg", | ||
"link": "https://stacktips.com/articles/project-lombok-is-it-still-relevant-in-2023", | ||
"excerpt": "What is Project Lombok? Have you used this magical library? With the new Java Records feature, you might wonder if Lombok is still relevant. Let's weigh the pros and cons and see if this is suitable for you." | ||
}, | ||
{ | ||
"title": "Notes to Crack CLF-C01 AWS Certified Cloud Practitioner Exam on First Attempt", | ||
"thumbnail": "https://media.stacktips.com/media/uploads/articles/crack-clfc01-aws-certified-cloud-practitioner-in-first-attempt.jpeg", | ||
"link": "https://stacktips.com/articles/crack-clfc01-aws-certified-cloud-practitioner-on-first-attempt", | ||
"excerpt": "A quick guide to CLF-C01 AWS Certified Cloud Practitioner Practice exam notes covers the introduction to all the services provided by AWS." | ||
}, | ||
{ | ||
"title": "Replace Embedded Tomcat with Jetty or Undertow Server in Spring Boot 3", | ||
"thumbnail": "https://i3.ytimg.com/vi/1gEoiMVULt4/maxresdefault.jpg", | ||
"link": "https://youtu.be/1gEoiMVULt4", | ||
"excerpt": "This video explains how to replace the default embedded Tomcat with Jetty or Undertow servers" | ||
}, | ||
{ | ||
"title": "Schedule Task in Spring Boot Using @Scheduled Annotation", | ||
"thumbnail": "", | ||
"link": "https://stacktips.com/articles/schedule-task-in-spring-boot-using-scheduled-annotation", | ||
"excerpt": "Scheduling task in Spring boot using @Scheduled annotation with examples showcasing fixed rate, fixed delay, and using cron expressions." | ||
} | ||
] | ||
}, | ||
|
||
"news": { | ||
"heading": "In the news this week..", | ||
"list": [ | ||
{ | ||
"title": "Elon Musk's 'Anti-Woke' AI Is Here, Snowflakes Need Not Apply", | ||
"link": "#" | ||
}, | ||
{ | ||
"title": "Channel 4 and Snapchat extend and enhance partnership with 'Snap-first' programming", | ||
"link": "#" | ||
}, | ||
{ | ||
"title": "TikTok adds comment filtering tools to better handle Israel-Hamas war content", | ||
"link": "#" | ||
}, | ||
{ | ||
"title": "GTA trailer dropped early after leak and breaks all records.", | ||
"link": "#" | ||
} | ||
] | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from django.core.management.base import BaseCommand | ||
from bloggy import settings | ||
from bloggy.models.subscriber import Subscribers | ||
from bloggy.services import email_service | ||
from bloggy.models import User | ||
from itertools import chain | ||
|
||
|
||
class Command(BaseCommand): | ||
help = 'Send wish card to users' | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument('--content', type=str, required=True, help='URL of the card') | ||
parser.add_argument('--subject', type=str, required=True, help='Email subject') | ||
|
||
def handle(self, *args, **options): | ||
content = options['content'] | ||
subject = options['subject'] | ||
|
||
if content is None or subject is None: | ||
self.stdout.write( | ||
self.style.ERROR(f"Missing mandatory arguments --content or --subject")) | ||
|
||
else: | ||
users = chain( | ||
User.objects.all(), | ||
Subscribers.objects.all(), | ||
) | ||
|
||
email_count = 0 | ||
for user in users: | ||
args = { | ||
"user_name": user.name, | ||
"email_subject": subject, | ||
"app_name": settings.SITE_TITLE, | ||
"updates": "" | ||
} | ||
|
||
try: | ||
email_service.send_custom_email(subject, [user.email], "email/wish_card_email.html", args) | ||
print('Success: Card sent to {}', user.email) | ||
except Exception as ex: | ||
print('Error sending card to {}: {}', user.email, ex) | ||
finally: | ||
email_count = email_count + 1 | ||
|
||
self.stdout.write(self.style.SUCCESS(f"Reminder sent to {email_count} users")) |
28 changes: 28 additions & 0 deletions
28
bloggy/migrations/0005_page_template_type_alter_post_post_type_and_more.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 4.2.7 on 2023-12-22 15:55 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('bloggy', '0004_remove_redirectrule_is_regx'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='page', | ||
name='template_type', | ||
field=models.CharField(blank=True, choices=[('naked', 'Naked'), ('default', 'Default'), ('wide', 'Wide')], default='default', help_text='Template type', max_length=20, null=True, verbose_name='Template type'), | ||
), | ||
migrations.AlterField( | ||
model_name='post', | ||
name='post_type', | ||
field=models.CharField(blank=True, choices=[['post', 'Post']], default='article', help_text='Post type', max_length=20, null=True, verbose_name='Post type'), | ||
), | ||
migrations.AlterField( | ||
model_name='vote', | ||
name='post_type', | ||
field=models.CharField(choices=[['post', 'Post']], help_text='Select content type', max_length=20, verbose_name='Content type'), | ||
), | ||
] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.2.7 on 2023-12-22 16:53 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('bloggy', '0005_page_template_type_alter_post_post_type_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='page', | ||
name='template_type', | ||
field=models.CharField(blank=True, choices=[('newsletter', 'Newsletter'), ('naked', 'Naked'), ('default', 'Default')], default='default', help_text='Template type', max_length=20, null=True, verbose_name='Template type'), | ||
), | ||
] |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" | ||
xmlns:o="urn:schemas-microsoft-com:office:office" lang="en"> | ||
{% block content %} | ||
<div class="t204" style="margin: 1rem;background-color: #038bea;border: 2px solid #e6e6e682;overflow: hidden;text-align: center;line-height: 36px;border-radius: 8px 8px 8px 8px;position: absolute;padding: 0.07rem 1rem;"> | ||
<a class="t210" href="https://stacktips.com/" | ||
style="display: block;margin: 0;font-family: 'Albert Sans', BlinkMacSystemFont,Segoe UI,Helvetica Neue,Arial,sans-serif !important;line-height: 36px;font-weight: 600;font-style: normal;font-size: 13px;text-decoration: none;direction: ltr;color: #fff;text-align: center;text-transform: uppercase;" | ||
target="_blank">← Back to home</a> | ||
</div> | ||
{{ page.content |safe }} | ||
{% endblock %} |
This file contains 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
This file contains 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
Oops, something went wrong.