diff --git a/upe/settings.py.template b/upe/settings.py.template deleted file mode 100644 index 5cdab44..0000000 --- a/upe/settings.py.template +++ /dev/null @@ -1,109 +0,0 @@ -""" -Django settings for upe project. - -For more information on this file, see -https://docs.djangoproject.com/en/1.6/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/1.6/ref/settings/ -""" - -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) -import os -BASE_DIR = os.path.dirname(os.path.dirname(__file__)) - -# Address for Docker setups -MYSQL_IP = os.getenv('MYSQL_PORT_3306_TCP_ADDR', '127.0.0.1') - -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ - -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = '9+!w(w9&qra8zp)k(^xq%i!3flgnipy4m_84&o8bf7#&&4nvl!' - -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True -TEMPLATE_DEBUG = False - - - -LOGIN_URL = '/login/' - -# Application definition - -INSTALLED_APPS = ( - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'website', - 'upe_calendar', - 'users' -) - -MIDDLEWARE_CLASSES = ( - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', -) - -ROOT_URLCONF = 'upe.urls' - -WSGI_APPLICATION = 'upe.wsgi.application' - - -# Database -# https://docs.djangoproject.com/en/1.6/ref/settings/#databases - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.mysql', - 'NAME': 'upe', - 'USER': 'admin', - 'PASSWORD': 'littlewhale', - 'HOST': MYSQL_IP, - 'PORT': '3306', - } -} - -# Static files (CSS, JavaScript) -# https://docs.djangoproject.com/en/1.6/howto/static-files/ -STATIC_ROOT = os.path.join(BASE_DIR, 'static') -STATIC_URL = '/static/' - -# Media files (Images, Downloads, Files) -MEDIA_ROOT = os.path.join(BASE_DIR, 'media') -MEDIA_URL = '/media/' - -# Internationalization -# https://docs.djangoproject.com/en/1.6/topics/i18n/ - -LANGUAGE_CODE = 'en-us' - -TIME_ZONE = 'America/Los_Angeles' - -USE_I18N = True - -USE_L10N = True - -USE_TZ = True - -AUTHENTICATION_BACKENDS = ('users.backends.CustomBackend',) - -from django.conf import global_settings -TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + ("website.processor.populate_footer",) - -EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' -EMAIL_HOST = 'localhost' -EMAIL_HOST_PASSWORD = '' -EMAIL_HOST_USER = '' -EMAIL_PORT = 25 -EMAIL_USE_TLS = False -DEFAULT_FROM_EMAIL = 'Do-Not-Reply ' - - diff --git a/users/admin.py b/users/admin.py index 3909ac4..6644fea 100644 --- a/users/admin.py +++ b/users/admin.py @@ -12,3 +12,5 @@ class OfficerAdmin(admin.ModelAdmin): admin.site.register(UserProfile) admin.site.register(OfficerProfile, OfficerAdmin) +admin.site.register(OfficeHour) +admin.site.register(BerkeleyClass) \ No newline at end of file diff --git a/users/models.py b/users/models.py index 760380b..4968c22 100644 --- a/users/models.py +++ b/users/models.py @@ -37,7 +37,7 @@ class UserProfile(models.Model): approved = models.BooleanField(default=False) candidate_profile = models.ForeignKey('CandidateProfile', blank=True, null=True) officer_profile = models.ForeignKey('OfficerProfile', blank=True, null=True) - + gives_office_hours = models.BooleanField(default=False) def __str__(self): return self.user.first_name + " " + self.user.last_name @@ -130,11 +130,10 @@ class OfficeHour(models.Model): day_of_week = models.IntegerField(max_length=1, choices=DAY_OF_WEEK_CHOICES, default=1) hour = models.IntegerField(max_length=2, choices=TIME_OF_DAY_CHOICES, default=11) - officer_username = models.CharField(max_length=30, - help_text='Please enter a valid officer username as this is used for website queries.') + user = models.ForeignKey('UserProfile', blank=True, null=True) def __str__(self): - return self.name() + " " + self.officer_username + return self.user.user.first_name + " " + self.user.user.last_name + " : " + self.name() def name(self): return self.day_dict[self.day_of_week] + " " + self.time_dict[self.hour] @@ -213,10 +212,10 @@ class BerkeleyClass(models.Model): class_dict = dict(CLASS_CHOICES) class_name = models.IntegerField(max_length=5, choices=CLASS_CHOICES) - officers = models.ManyToManyField('OfficerProfile', through='OfficerClass') + user = models.ForeignKey('UserProfile', blank=True, null=True) def __str__(self): - return self.class_dict[self.class_name] + return self.user.user.first_name + " " + self.user.user.last_name + " : " + self.name() def name(self): return self.class_dict[self.class_name]