-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
annoucement handled in just one commit! :)
- Loading branch information
Khedesh
committed
Aug 4, 2016
1 parent
af89d30
commit 5f680d5
Showing
6 changed files
with
93 additions
and
6 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 |
---|---|---|
@@ -1,8 +1,30 @@ | ||
from django.shortcuts import render | ||
from django.http import HttpResponse | ||
from django.http import HttpResponse, Http404 | ||
from shamsi.templatetags.shamsi_template_tags import pdatetime | ||
|
||
from .models import Announcement | ||
|
||
|
||
# Create your views here. | ||
|
||
def show_announcements(request): | ||
return HttpResponse("Annoucments is under construction...") | ||
def all_announcements(request): | ||
announcements = Announcement.objects.order_by('-id') | ||
for an in announcements: | ||
an.date = pdatetime(an.date) | ||
|
||
return render(request, 'announcements/announcements.html', { | ||
'announcements': announcements, | ||
}) | ||
|
||
|
||
def show_announcement(request, announcement_id): | ||
try: | ||
announcement = Announcement.objects.get(pk=announcement_id) | ||
announcement.date = pdatetime(announcement.date) | ||
|
||
except Announcement.DoesNotExist: | ||
raise Http404("Announcement does not exist") | ||
|
||
return render(request, 'announcements/announcement.html', { | ||
'announcement': announcement, | ||
}) |
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,29 @@ | ||
{% extends 'base.html' %} | ||
{% load static %} | ||
{% load gravatar %} | ||
{% load shamsi_template_tags %} | ||
{% block title %} اطلاعیه - {{ announcement.title }}{% endblock title %} | ||
|
||
{% block size0 %}col-lg-10 col-md-10{% endblock %} | ||
{% block size1 %}col-lg-6 col-md-6{% endblock %} | ||
{% block size2 %}col-lg-6 col-md-6{% endblock %} | ||
{% block size3 %}col-lg-6 col-md-6{% endblock %} | ||
|
||
{% block body %} | ||
<div class="panel panel-default panel-background-color"> | ||
<div class="panel-heading dir-rtl"> | ||
<span class="request-id glyphicon glyphicon-tag"></span> | ||
<span class="panel-title"> {{ announcement.title }} </span> | ||
<span id="announcement-countdown-{{ announcement.id }}" class="pull-left poll-countdown"> | ||
{{ announcement.date }} | ||
</span> | ||
</div> | ||
|
||
<div class="panel-body dir-rtl"> | ||
{{ announcement.body|safe }} | ||
|
||
</div> | ||
|
||
|
||
</div> | ||
{% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{% extends 'base.html' %} | ||
{% load static %} | ||
{% load gravatar %} | ||
{% load shamsi_template_tags %} | ||
{% block title %} اطلاعیهها {% endblock title %} | ||
|
||
{% block size0 %}col-lg-10 col-md-10{% endblock %} | ||
{% block size1 %}col-lg-6 col-md-6{% endblock %} | ||
{% block size2 %}col-lg-6 col-md-6{% endblock %} | ||
{% block size3 %}col-lg-6 col-md-6{% endblock %} | ||
|
||
{% block body %} | ||
<div class="panel panel-primary panel-background-color"> | ||
<div class="panel-heading dir-rtl"> اطلاعیهها</div> | ||
<div class="panel-body"> | ||
{% for announcement in announcements %} | ||
<div class="panel panel-default dir-rtl"> | ||
<div class="panel-heading"> | ||
<a href="{% url 'show-announcement' announcement.id %}" target="_self" class="permanent link event-link" | ||
data-id={{ announcement.id }}> | ||
<span class="request-id glyphicon glyphicon-tag"></span> | ||
<span class="panel-title"> | ||
{{ announcement.title }} | ||
</span> | ||
</a> | ||
<span id="announcement-countdown-{{ announcement.id }}" class="pull-left poll-countdown"> | ||
{{ announcement.date }} | ||
</span> | ||
|
||
</div> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
{% 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