From e68cc2dcde079233595d0b00f19015c55d2a4213 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Mon, 25 Sep 2017 19:54:01 +0530 Subject: [PATCH] Fixed flake8 errors (#224) * Fixed flake8 errors and fixed build #219 * Fixed flake8 errors --- notices/admin.py | 6 ++---- wifi/admin.py | 3 +-- wifi/forms.py | 2 +- wifi/models.py | 7 ++----- wifi/views.py | 6 ++---- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/notices/admin.py b/notices/admin.py index 876f0f0..52a39a3 100644 --- a/notices/admin.py +++ b/notices/admin.py @@ -4,7 +4,7 @@ class NoticeAdmin(ImportExportModelAdmin): - list_display = ('id','faculty', 'title', 'course_branch_year', 'created', 'modified', 'visible_for_student', + list_display = ('id', 'faculty', 'title', 'course_branch_year', 'created', 'modified', 'visible_for_student', 'visible_for_faculty', 'visible_for_hod', 'visible_for_others', 'visible_for_management' ) list_display_links = ('title', 'faculty') @@ -15,9 +15,7 @@ class NoticeAdmin(ImportExportModelAdmin): fieldsets = ( (None, { 'classes': ('wide', 'extrapretty'), - 'fields': ('faculty', 'category', 'title', 'description', 'file_attached', 'course_branch_year', - 'visible_for_student', 'visible_for_faculty', 'visible_for_hod', - 'visible_for_others', 'visible_for_management', ), + 'fields': ('faculty', 'category', 'title', 'description', 'file_attached', 'course_branch_year', 'visible_for_student', 'visible_for_faculty', 'visible_for_hod', 'visible_for_others', 'visible_for_management', ), }), ) diff --git a/wifi/admin.py b/wifi/admin.py index 661e6c5..a2a7e96 100644 --- a/wifi/admin.py +++ b/wifi/admin.py @@ -3,8 +3,7 @@ class WifiAdmin(admin.ModelAdmin): - list_display = ('__unicode__', 'email', 'name', 'old_laptop_mac_address', - 'new_laptop_mac_address', 'branch', 'mac_registered','created', 'modified') + list_display = ('__unicode__', 'email', 'name', 'old_laptop_mac_address', 'new_laptop_mac_address', 'branch', 'mac_registered', 'created', 'modified') search_fields = ('old_laptop_mac_address', 'new_laptop_mac_address', 'user__username',) diff --git a/wifi/forms.py b/wifi/forms.py index 1faa473..ee8fdad 100644 --- a/wifi/forms.py +++ b/wifi/forms.py @@ -6,5 +6,5 @@ class WifiForm(forms.ModelForm): class Meta: model = WifiDetail - fields = ['old_laptop_mac_address', 'new_laptop_mac_address',] + fields = ['old_laptop_mac_address', 'new_laptop_mac_address', ] exclude = ['user', ] diff --git a/wifi/models.py b/wifi/models.py index 8b3506f..6e959b5 100644 --- a/wifi/models.py +++ b/wifi/models.py @@ -13,17 +13,14 @@ class WifiDetail(models.Model): blank=False, null=False, default=None, - validators=[RegexValidator(regex='^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$', - message='Enter MAC Address in Given Format.'), ]) + validators=[RegexValidator(regex='^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$', message='Enter MAC Address in Given Format.'), ]) new_laptop_mac_address = models.CharField(max_length=200, blank=True, null=True, default=None, - validators=[RegexValidator(regex='^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$', - message='Enter MAC Address in Given Format.'), ]) + validators=[RegexValidator(regex='^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$', message='Enter MAC Address in Given Format.'), ]) mac_registered = models.BooleanField(default=False) - created = models.DateTimeField("Created", null=True, auto_now_add=True) modified = models.DateTimeField("Last Modified", null=True, auto_now=True) diff --git a/wifi/views.py b/wifi/views.py index 50af03e..50bb6a8 100644 --- a/wifi/views.py +++ b/wifi/views.py @@ -1,4 +1,3 @@ -from django.shortcuts import render from .models import WifiDetail from profiles.models import StudentDetail, FacultyDetail from django.contrib.auth.models import User @@ -10,7 +9,7 @@ from django.utils.decorators import method_decorator from django.contrib import messages from django.http import HttpResponse -from django.shortcuts import render, get_object_or_404, redirect +from django.shortcuts import render from .forms import WifiForm import xlsxwriter @@ -26,8 +25,7 @@ def get(self, request): try: mac_address = WifiDetail.objects.get(user=user) if mac_address: - return render(request, 'wifi/studentwifiform.html', - {"user": user, "details": details, "mac_address": mac_address}) + return render(request, 'wifi/studentwifiform.html', {"user": user, "details": details, "mac_address": mac_address}) except: return render(request, 'wifi/studentwifiform.html', {"user": user, "details": details})