summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--workshop_app/admin.py3
-rw-r--r--workshop_app/models.py11
-rw-r--r--workshop_app/templates/workshop_app/index.html24
-rw-r--r--workshop_app/views.py11
4 files changed, 38 insertions, 11 deletions
diff --git a/workshop_app/admin.py b/workshop_app/admin.py
index c1c706a..3eec8af 100644
--- a/workshop_app/admin.py
+++ b/workshop_app/admin.py
@@ -5,7 +5,7 @@ from .models import (
Profile, WorkshopType,
Workshop, ProposeWorkshopDate,
RequestedWorkshop, BookedWorkshop,
- Testimonial, ProfileComments
+ Testimonial, ProfileComments, Banner
)
try:
from StringIO import StringIO as string_io
@@ -205,3 +205,4 @@ admin.site.register(RequestedWorkshop, RequestedWorkshopAdmin)
admin.site.register(BookedWorkshop, BookedWorkshopAdmin)
admin.site.register(Testimonial, TestimonialAdmin)
admin.site.register(ProfileComments, ProfileCommentAdmin)
+admin.site.register(Banner)
diff --git a/workshop_app/models.py b/workshop_app/models.py
index 680e075..4d589bf 100644
--- a/workshop_app/models.py
+++ b/workshop_app/models.py
@@ -292,3 +292,14 @@ class ProfileComments(models.Model):
self.coordinator_profile,
self.instructor_profile
)
+
+class Banner(models.Model):
+ """
+ Add HTML for banner display on homepage
+ """
+ title = models.CharField(max_length=500)
+ html = models.TextField()
+ active = models.BooleanField()
+
+ def __str__(self):
+ return self.title
diff --git a/workshop_app/templates/workshop_app/index.html b/workshop_app/templates/workshop_app/index.html
index 12a6562..4880a2a 100644
--- a/workshop_app/templates/workshop_app/index.html
+++ b/workshop_app/templates/workshop_app/index.html
@@ -67,13 +67,23 @@ $(document).ready(function(){
</head>
<body>
- <!--
- <center>
- <a href="https://fossee.in/fellowship/2019"><img
- src="https://static.fossee.in/fossee/banners/fellowship_2019_3.gif"/>
- </a>
- </center>
- -->
+ <div>
+ {% if banners %}
+ {% for banner in banners %}
+ {% if banner.active %}
+ {{ banner.html | safe}}
+ {% endif %}
+
+ <!--
+ <center>
+ <a href="https://fossee.in/fellowship/2019"><img
+ src="https://static.fossee.in/fossee/banners/fellowship_2019_3.gif"/>
+ </a>
+ </center>
+ -->
+ {% endfor %}
+ {% endif %}
+ </div>
<nav class="navbar navbar-expand-sm navbar-custom">
<a class="navbar-brand">FOSSEE Python Workshops</a>
<ul class=" nav navbar-nav ml-auto">
diff --git a/workshop_app/views.py b/workshop_app/views.py
index 772615b..1a9b7a7 100644
--- a/workshop_app/views.py
+++ b/workshop_app/views.py
@@ -8,7 +8,7 @@ from .models import (
has_profile, Workshop,
WorkshopType, RequestedWorkshop,
BookedWorkshop, ProposeWorkshopDate,
- Testimonial, ProfileComments
+ Testimonial, ProfileComments, Banner
)
from teams.models import Team
from datetime import datetime, date
@@ -72,8 +72,13 @@ def index(request):
return redirect('/manage/')
return redirect('/book/')
- return render(request, "workshop_app/index.html", {"form": form,
- "testimonials": testimonials })
+ return render(request, "workshop_app/index.html",
+ {
+ "form": form,
+ "testimonials": testimonials,
+ "banners": Banner.objects.all(),
+ }
+ )
def is_instructor(user):