-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from DaemonLab/server-trishant
Server trishant
- Loading branch information
Showing
7 changed files
with
54 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,6 +174,7 @@ class about_Admin(admin.ModelAdmin): | |
{ | ||
"fields": ( | ||
"name", | ||
"email", | ||
"upper_description", | ||
"sheet_url", | ||
"lower_description", | ||
|
@@ -609,29 +610,21 @@ class about_Admin(ImportExportModelAdmin, admin.ModelAdmin): | |
|
||
@admin.action(description="Send mail to the caterer") | ||
def send_mail(self, request, queryset): | ||
""" | ||
Send mail action available in the admin page | ||
""" | ||
from datetime import date | ||
today = date.today() | ||
text = "<li> {name} with {allocation_id} has applied from {start_date} to {end_date}</li>" | ||
messageKanaka="" | ||
messageGauri="" | ||
messageAjay="" | ||
date = queryset[0].date | ||
for obj in queryset: | ||
allocation=obj.allocation_id | ||
if(obj.Caterer == "Kanaka"): | ||
messageKanaka +=(text.format(allocation_id=allocation.student_id,name=allocation.email.name, start_date=obj.start_date, end_date=obj.end_date)) | ||
elif(obj.Caterer == "Gauri"): | ||
messageGauri +=(text.format(allocation_id=allocation.student_id,name=allocation.email.name, start_date=obj.start_date, end_date=obj.end_date)) | ||
elif(obj.Caterer == "Ajay"): | ||
messageAjay +=(text.format(allocation_id=allocation.student_id,name=allocation.email.name, start_date=obj.start_date, end_date=obj.end_date)) | ||
obj.delete() | ||
print(messageKanaka) | ||
print(messageGauri) | ||
print(messageAjay) | ||
if(messageAjay): caterer_mail(messageAjay, "Ajay","[email protected]", date) | ||
if(messageKanaka): caterer_mail(messageKanaka, "Kanaka","[email protected]",date) | ||
if(messageGauri): caterer_mail(messageGauri, "Gauri","[email protected]",date) | ||
for caterer in Caterer.objects.all(): | ||
print(caterer.name) | ||
message_caterer = "" | ||
date = today | ||
for obj in queryset: | ||
print(obj.Caterer) | ||
if(obj.Caterer != caterer.name): continue | ||
allocation=obj.allocation_id | ||
message_caterer +=(text.format(allocation_id=allocation.student_id,name=allocation.email.name, start_date=obj.start_date, end_date=obj.end_date)) | ||
obj.delete() | ||
print(message_caterer) | ||
if(message_caterer): caterer_mail(message_caterer, caterer.name,caterer.email, date) | ||
|
||
|
||
rebate_fields={"fields": ( | ||
|
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 |
---|---|---|
|
@@ -11,4 +11,6 @@ class HomeConfig(AppConfig): | |
|
||
def ready(self): | ||
import home.signals | ||
from .schedulers import start | ||
start() | ||
|
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,10 @@ | ||
from django_apscheduler.jobstores import DjangoJobStore, register_events | ||
from apscheduler.schedulers.background import BackgroundScheduler | ||
from .utils.django_email_server import __send__rebate__email__ | ||
|
||
def start(): | ||
scheduler = BackgroundScheduler() | ||
scheduler.add_jobstore(DjangoJobStore(), "default") | ||
scheduler.add_job(__send__rebate__email__, 'cron', hour=23, minute=59, second=0) | ||
register_events(scheduler) | ||
scheduler.start() |
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