Diverse Code Cleanups

*Code wurde PEP-8 gerecht formatiert
* Kleine Fehler die der PyCharm Inspector beanstandet wurden korrigiert
This commit is contained in:
Christian Berg
2014-11-26 16:04:52 +01:00
committed by Christian Berg
parent f34281089d
commit 86a0db050d
76 changed files with 619 additions and 528 deletions

View File

@@ -1,16 +1,17 @@
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand
from django.utils.datetime_safe import datetime
from events.models import Event, Location
import xlrd # @UnresolvedImport
import xlrd
class Command(BaseCommand):
help = "Importiert die alten Events" # @ReservedAssignment
def __init__(self):
self.author = User.objects.get(username="xeniac")
self.author = get_user_model().objects.get(username="xeniac")
super(Command, self).__init__()
def handle(self, *args, **options):
try:
@@ -22,16 +23,15 @@ class Command(BaseCommand):
table = xls_file.sheet_by_index(0)
for row in xrange(1, table.nrows):
name = table.cell_value(row, 0)
print name
start = xlrd.xldate_as_tuple(table.cell_value(row, 1),
xls_file.datemode)
xls_file.datemode)
start = datetime(start[0], start[1], start[2], 0, 0, 0)
end = xlrd.xldate_as_tuple(table.cell_value(row, 2),
xls_file.datemode)
xls_file.datemode)
end = datetime(end[0], end[1], end[2], 23, 59, 59)
location = Location.objects.get(pk=table.cell_value(row, 3))