From e29783687b992216bcd757db7f2bfa8a652d2e4d Mon Sep 17 00:00:00 2001 From: Akshen Date: Mon, 25 Mar 2019 11:33:50 +0530 Subject: Search Bar working - Search Bar is working - Category wise selection is possible via dropdown --- fossee_manim/admin.py | 29 +++++++++- fossee_manim/forms.py | 3 +- fossee_manim/models.py | 1 + fossee_manim/static/css/sticky-footer.css | 14 ----- fossee_manim/templates/fossee_manim/base.html | 14 ++--- .../templates/fossee_manim/categorical_list.html | 29 ++++++---- .../templates/fossee_manim/edit_proposal.html | 6 +- .../templates/fossee_manim/search_results.html | 28 ++++++++-- fossee_manim/templates/fossee_manim/video.html | 62 +++++++++++++++++---- fossee_manim/views.py | 64 ++++++++++++++++------ 10 files changed, 182 insertions(+), 68 deletions(-) (limited to 'fossee_manim') diff --git a/fossee_manim/admin.py b/fossee_manim/admin.py index 35bf57b..121c487 100644 --- a/fossee_manim/admin.py +++ b/fossee_manim/admin.py @@ -46,5 +46,32 @@ class CategoryAdmin(admin.ModelAdmin): list_filter = ['name'] +class AnimationAdmin(admin.ModelAdmin): + list_display = ['title', 'status', 'contributor'] + list_filter = ['category'] + actions = ['download_data'] + + def download_data(self, request, queryset): + openfile = string_io() + response = HttpResponse(content_type='text/csv') + response['Content-Disposition'] = 'attachment;\ + filename=animations_data.csv' + + writer = csv.writer(response) + writer.writerow(['title', 'contributor', 'reviewer', 'description', + 'status', 'github link', 'category']) + + for q in queryset: + writer.writerow([q.title, q.contributor.get_full_name(), + q.reviewer.get_full_name(), q.description, q.status, q.github, + q.category]) + + openfile.seek(0) + response.write(openfile.read()) + return response + + download_data.short_description = "Download data CSV file." + admin.site.register(Category, CategoryAdmin) -admin.site.register(Profile, ProfileAdmin) \ No newline at end of file +admin.site.register(Profile, ProfileAdmin) +admin.site.register(Animation, AnimationAdmin) \ No newline at end of file diff --git a/fossee_manim/forms.py b/fossee_manim/forms.py index b3b33eb..72e5c83 100644 --- a/fossee_manim/forms.py +++ b/fossee_manim/forms.py @@ -263,7 +263,8 @@ class CommentForm(forms.ModelForm): class Meta: model = Comment - exclude = ['animation', 'created_date', 'commentor'] + exclude = ['animation', 'created_date', 'commentor', + 'animation_status'] widgets = { 'comments': forms.CharField(), } diff --git a/fossee_manim/models.py b/fossee_manim/models.py index 75f03da..240ec1b 100644 --- a/fossee_manim/models.py +++ b/fossee_manim/models.py @@ -179,6 +179,7 @@ class Comment(models.Model): commentor = models.ForeignKey(User, on_delete=models.CASCADE) animation = models.ForeignKey(Animation, on_delete=models.CASCADE) created_date = models.DateTimeField(default=timezone.now) + animation_status = models.CharField(max_length=255) def __str__(self): return u"{1} | {0}".format( diff --git a/fossee_manim/static/css/sticky-footer.css b/fossee_manim/static/css/sticky-footer.css index ea445db..d0054bd 100644 --- a/fossee_manim/static/css/sticky-footer.css +++ b/fossee_manim/static/css/sticky-footer.css @@ -70,17 +70,3 @@ margin-left: .1rem; margin-right: .1rem; } - - -/** - * Footer Styles - */ - -.footer { - position: fixed; - right: 0; - bottom: 0; - left: 0; - background-color: #efefef; - text-align: center; -} \ No newline at end of file diff --git a/fossee_manim/templates/fossee_manim/base.html b/fossee_manim/templates/fossee_manim/base.html index c9d6242..3fdd977 100644 --- a/fossee_manim/templates/fossee_manim/base.html +++ b/fossee_manim/templates/fossee_manim/base.html @@ -43,10 +43,11 @@ Categories +
@@ -93,10 +94,5 @@ {% endblock %}