From eed46efdccfb2821cb07b6a189f439ba6f7bb3f2 Mon Sep 17 00:00:00 2001 From: Akshen Date: Fri, 22 Feb 2019 12:49:43 +0530 Subject: Basic Feature Working - Register - Sendmail - Login/Logout - Index page - View profile - NavBar fixed --- fossee_manim/admin.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 fossee_manim/admin.py (limited to 'fossee_manim/admin.py') diff --git a/fossee_manim/admin.py b/fossee_manim/admin.py new file mode 100644 index 0000000..f076a3c --- /dev/null +++ b/fossee_manim/admin.py @@ -0,0 +1,46 @@ +from django.contrib import admin +import csv +from django.http import HttpResponse +from .models import ( + Profile + ) +# Register your models here. +try: + from StringIO import StringIO as string_io +except ImportError: + from io import BytesIO as string_io + +#Custom Classes +class ProfileAdmin(admin.ModelAdmin): + list_display = ['title','user', 'institute','location','department', + 'phone_number','position'] + list_filter = ['position', 'department'] + actions = ['download_csv'] + + def download_csv(self, request, queryset): + openfile = string_io() + response = HttpResponse(content_type='text/csv') + response['Content-Disposition'] = 'attachment;\ + filename=profile_data.csv' + + writer = csv.writer(response) + writer.writerow(['email_id', 'title','username', 'first_name', 'last_name', + 'institute', 'location', 'department', + 'phone_number', 'position']) + + for q in queryset: + writer.writerow([q.user.email, q.title, q.user, q.user.first_name, + q.user.last_name, q.institute, + q.location, q.department, q.phone_number, + q.position]) + + openfile.seek(0) + response.write(openfile.read()) + return response + + download_csv.short_description = "Download CSV file for selected stats." + + + + +admin.site.register(Profile, ProfileAdmin) -- cgit From efda4b675ab162346a72abf0ceee29cfc0f99001 Mon Sep 17 00:00:00 2001 From: Akshen Date: Tue, 5 Mar 2019 11:33:41 +0530 Subject: Major Update 1 - User can register/login/logout - Contributor can send proposal and comment on it - Reviewer can comment/approve/reject proposals --- fossee_manim/admin.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'fossee_manim/admin.py') diff --git a/fossee_manim/admin.py b/fossee_manim/admin.py index f076a3c..35bf57b 100644 --- a/fossee_manim/admin.py +++ b/fossee_manim/admin.py @@ -1,16 +1,16 @@ from django.contrib import admin import csv from django.http import HttpResponse -from .models import ( - Profile - ) +from .models import (Category, Profile, User, Animation, Comment, + AnimationStats) # Register your models here. try: - from StringIO import StringIO as string_io + from StringIO import StringIO as string_io except ImportError: - from io import BytesIO as string_io + from io import BytesIO as string_io -#Custom Classes + +# Custom Classes class ProfileAdmin(admin.ModelAdmin): list_display = ['title','user', 'institute','location','department', 'phone_number','position'] @@ -41,6 +41,10 @@ class ProfileAdmin(admin.ModelAdmin): download_csv.short_description = "Download CSV file for selected stats." +class CategoryAdmin(admin.ModelAdmin): + list_display = ['name', 'created', 'description'] + list_filter = ['name'] -admin.site.register(Profile, ProfileAdmin) +admin.site.register(Category, CategoryAdmin) +admin.site.register(Profile, ProfileAdmin) \ No newline at end of file -- cgit