Skip to content

Commit

Permalink
implemented general meeting slides on resources page
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissprague committed Apr 5, 2015
1 parent c5d0e39 commit d888065
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
3 changes: 2 additions & 1 deletion csc_new/pages/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.contrib import admin
from pages.models import ExamReview, Photo
from pages.models import ExamReview, Photo, GeneralMeetingSlides

# Register your models here.
admin.site.register(ExamReview)
admin.site.register(Photo)
admin.site.register(GeneralMeetingSlides)
17 changes: 17 additions & 0 deletions csc_new/pages/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ def delete(self, *args, **kwargs):
super(ExamReview, self).delete(*args, **kwargs)


class GeneralMeetingSlides(models.Model):
date = models.DateField()
pdf = models.FileField(upload_to="general_meeting_slides", verbose_name="PDF")

class Meta:
verbose_name = "General Meeting Slides"
verbose_name_plural = verbose_name

def __str__(self):
return self.date.__str__()

def delete(self, *args, **kwargs):
# this is broken (the delete doesn't work; the file lingers in MEDIA_ROOT)

This comment has been minimized.

Copy link
@khipkin

khipkin Apr 5, 2015

Member

don't check in broken code.

This comment has been minimized.

Copy link
@chrissprague

chrissprague Apr 5, 2015

Author Member

It was added to remain consistent. The other models are currently implementing this delete method the same way. They're actually all broken, so perhaps those shouldn't have been checked in either. Please see #15

os.remove(os.path.join(settings.MEDIA_ROOT, str(self.pdf)))
super(GeneralMeetingSlides, self).delete(*args, **kwargs)


class Photo(models.Model):
title = models.CharField(max_length=100)
desc = models.CharField(max_length=255)
Expand Down
11 changes: 11 additions & 0 deletions csc_new/pages/templates/pages/resources.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ <h2>Exam Reviews</h2>
</div>
{% endfor %}

<h2 id="gm_slides">General Meeting Slides</h2>
{% for week in slides %}
<div class="slides">
<span> <a href="media/{{ week.pdf }}"> {{ week.date }} </a> </span>
</div>
{% empty %}
<div>
General Meeting Slides will be posted as the meetings occur throughout the semester.
</div>
{% endfor %}

<h2>Other Resources</h2>
<div class="exam">
<a href="http://cs.rit.edu/~ritcsc-workshop/resources/">Workshop Resources</a>
Expand Down
1 change: 1 addition & 0 deletions csc_new/pages/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def resources(request):
'exams': ExamReview.objects.all(),
'MEDIA_URL': settings.MEDIA_URL,
'img_list': Photo.objects.values_list('src', flat=True),
'slides': GeneralMeetingSlides.objects.all(),
})
return HttpResponse(template.render(context))

Expand Down
8 changes: 8 additions & 0 deletions csc_new/staticfiles/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ p.footnote {
margin-left: 1in;
}

.slides > span {
margin-right: 20px;
}

/* CSS3 negation psuedo-class (@see stackoverflow.com/questions/2573544) */
.slides:not(:last-child) {
margin-bottom: 10px;
}


/* ----------------- FOR PICTURES.HTML ----------------- */
Expand Down

0 comments on commit d888065

Please sign in to comment.