-
Notifications
You must be signed in to change notification settings - Fork 23
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 #757 from dotKom/event-mail
Event mail
- Loading branch information
Showing
6 changed files
with
190 additions
and
0 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
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,24 @@ | ||
from apps.events.models import Event | ||
|
||
def get_group_restricted_events(user): | ||
""" Returns a queryset of events with attendance_event that a user has access to """ | ||
types_allowed = [] | ||
|
||
groups = user.groups.all() | ||
|
||
if 'Hovedstyret' or 'dotKom' in groups: | ||
return Event.objects.filter(attendance_event__isnull=False) | ||
|
||
for group in groups: | ||
if group.name == 'arrKom': | ||
types_allowed.append(1) | ||
types_allowed.append(4) | ||
|
||
if group.name == 'bedKom': | ||
types_allowed.append(2) | ||
|
||
if group.name == 'fagKom': | ||
types_allowed.append(3) | ||
|
||
|
||
return Event.objects.filter(attendance_event__isnull=False, type__in=types_allowed) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
<section> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<div class="page-header"> | ||
<h2>Send epost til påmeldte for «{{ event.title }}»</h2> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-md-4"> | ||
<div class="page-header"> | ||
<h3>Alle påmeldte</h3> | ||
</div> | ||
{% if all_attendees %} | ||
{% for attendee in all_attendees.all %} | ||
{{ attendee.user.email }}, | ||
{% endfor %} | ||
{% else %} | ||
Ingen er påmeldt dette arrangementet. | ||
{% endif %} | ||
|
||
</div> | ||
<div class="col-md-4"> | ||
<div class="page-header"> | ||
<h3>Påmeldte som er på venteliste</h3> | ||
</div> | ||
{% if attendees_on_waitlist %} | ||
{% for attendee in attendees_on_waitlist.all %} | ||
{{ attendee.user.email }}, | ||
{% endfor %} | ||
{% else %} | ||
Ingen er på venteliste. | ||
{% endif %} | ||
</div> | ||
<div class="col-md-4"> | ||
<div class="page-header"> | ||
<h3>Påmeldte som ikke har betalt</h3> | ||
</div> | ||
{% if attendees_not_paid %} | ||
{% for attendee in attendees_not_paid.all %} | ||
{{ attendee.user.email }}, | ||
{% endfor %} | ||
{% else %} | ||
Alle som er meldt på har betalt | ||
{% endif %} | ||
</div> | ||
</div> | ||
<div class="row" style="margin-top:30px"> | ||
<div class="col-md-6"> | ||
<h3>Send epost direkte</h3> | ||
<form method="post" onsubmit="return confirm('Har du dobbeltsjekket informasjonen og vil sende denne eposten?');"> | ||
{% csrf_token %} | ||
<div class="form-group"> | ||
<label for="to_email">Fra epost</label> | ||
<select id="to_email" name="to_email" class="form-control"> | ||
<option value="1">Alle påmeldte</option> | ||
<option value="2">Påmeldte på venteliste</option> | ||
<option value="3">Påmeldte som ikke har betalt</option> | ||
</select> | ||
</div> | ||
<div class="form-group"> | ||
<label for="from_email">Fra epost</label> | ||
<select id="from_email" name="from_email" class="form-control"> | ||
<option value="1">arrkom@online.ntnu.no</option> | ||
<option value="2">bedkom@online.ntnu.no</option> | ||
<option value="3">fagkom@online.ntnu.no</option> | ||
<option value="4">kontakt@online.ntnu.no</option> | ||
</select> | ||
</div> | ||
<div class="form-group"> | ||
<label for="subject">Emne</label> | ||
<input type="text" class="form-control" name="subject" id="subject" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="message">Melding</label> | ||
<textarea id="message" name="message" class="form-control" rows="5"></textarea> | ||
</div> | ||
<p style="padding:10px; text-align:center" class="alert-warning">Vi legger automatisk på signatur for deg, skriv BARE din beskjed.</p> | ||
<input name="submit" class="btn btn-success" type="submit" value="Send" /> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
{% endblock %} |