Skip to content
This repository has been archived by the owner on Jan 13, 2019. It is now read-only.

oh update #62

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19,177 changes: 19,177 additions & 0 deletions get-pip.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
taeklklej

109 changes: 109 additions & 0 deletions upe/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
"""
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 <[email protected]>'


1 change: 1 addition & 0 deletions upe/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
url(r'^', include('website.urls')),

url(r'^officers/$', 'users.views.officers', name='officers'),
url(r'^officehours/$', 'users.views.officers2', name='officehours'),
url(r'^members/$', 'users.views.members', name='members'),
url(r'^members/filter/$', 'users.views.members_filter', name='members_filter'),
url(r'^interest/$', 'users.views.interest', name='interest'),
Expand Down
2 changes: 2 additions & 0 deletions users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class OfficerProfile(models.Model):
position_dict = dict(OFFICER_POSITION_CHOICES)
position = models.IntegerField(max_length=1, choices=OFFICER_POSITION_CHOICES, default=1)
term = models.CharField(max_length=5, choices=TERM, default='S15', verbose_name='Officer term')
ohtime = models.TextField(default = 'n/a')
ohclasses = models.TextField(default = 'n/a')
bio = models.TextField(default='Check back soon!')

#office_hours = models.ManyToManyField('OfficeHour', blank=True)
Expand Down
2 changes: 1 addition & 1 deletion users/templates/users/officers.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h2 class="position-email">
<span class="year">Computer Science, {{ user.get_grad_year_display }}</span>


<span class="email">{{position.email}}</span>
<span class="email"><b>Email: </b>{{position.email}}</span>

<ul class="social">
{% if user.linkedin %}
Expand Down
86 changes: 86 additions & 0 deletions users/templates/users/officers2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{% extends "website/header_footer.html" %}
{% load staticfiles %}
{% load custom_filters %}
{% block stylesheets %}
<link rel="stylesheet" href="{% static "website/css/reset.css" %}" type="text/css" media="screen" />
<link rel="stylesheet" href="{% static "website/css/full_style.css" %}" type="text/css" media="screen" />
<link rel="stylesheet" href="{% static "website/css/main_style.css" %}" type="text/css" media="screen" />
<link rel="stylesheet" href="{% static "website/css/header_style.css" %}" type="text/css" media="screen" />
<link rel="stylesheet" href="{% static "website/css/footer_style.css" %}" type="text/css" media="screen" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="{% static "website/css/hover.css" %}" type="text/css" media="screen" />
<link rel="stylesheet" href="{% static "users/css/officers_members.css" %}" type="text/css" media="screen" />
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css">
<link rel='stylesheet' href='http://fonts.googleapis.com/css?family=Arimo:400,700' type='text/css'>
<link rel="stylesheet" href="{% static "website/css/bootstrap.modals.css" %}" type="text/css" media="screen"/>
{% endblock %}
{% block javascript %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="{% static "website/js/bootstrap.modals.js" %}"></script>
{% endblock %}
{% block content %}
<div class="content-container">
<div class="officer-sidebar">
<h1>{{ title }}</h1>
<ul id="archive">
<li>{{ current_semester }}</li>
{% for position in positions %}
<li><a href="#{{position.email_name}}">{{position.full_name}}</a></li>
{% endfor %}
</ul>
</div>
<div id="officer-member-container" >
<div id="officer-members">
{% for position in positions %}
<!--
<h2 class="position-container">
<h2 class="position-label" id="{{position.email_name}}">{{position.full_name}}
<h2 class="position-email">
(<a href="mailto:{{position.email}}">{{position.email}}</a>)
</h2>
</h2>
</h2>
!-->
<a name="{{position.email_name}}"></a>
{% for user in position.users %}
<div class='officer-position grow'>
<div class="officer-member">
{% if user.picture %}
<img class="officer-member-picture" src="/media/{{user.picture}}">
{% else %}
{% if not user.picture %}
<img class="officer-member-picture" src="/media/profile_images/spock.jpg">
{% endif %}
{% endif %}


<span class="name"><b>{{ user }}</b></span>
<p>{{user.officer_profile.ohtime}}</p>
{{user.officer_profile.ohclasses}}

</div>
</div>
{% endfor %}
{% endfor %}
</div>
</div>
</div>
{% for position in positions %}
{% for user in position.users %}
<div id={{ user.user|cut:"."|cut:"@" }} class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">{{ user }}</h4>
</div>
<div class="modal-body">
<p>{{user.officer_profile.bio|linebreaksbr}}</p>
</div>
</div>
</div>
</div>
{% endfor %}
{% endfor %}
{% endblock %}

50 changes: 50 additions & 0 deletions users/templates/users/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,49 @@ <h4 class="modal-title" id="myModalLabel">Edit your Officer Bio</h4>

</a>
</div>

</div>
</div>
<div class="modal fade" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Edit your Office Hour Times</h4>
</div>
<form action="{% url "myprofile" %}" method="post" >
{% csrf_token %}
<p><textarea rows="4" cols="50" name ="value" >
{{ up.officer_profile.ohtime }}</textarea></p>
<input type="submit" name = "name" value ="Submit OHtimes">
</form>

</a>
</div>

</div>
</div>
<div class="modal fade" id="myModal4" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Edit your Officer Hour Classes</h4>
</div>
<form action="{% url "myprofile" %}" method="post" >
{% csrf_token %}
<p><textarea rows="4" cols="50" name ="value" >
{{ up.officer_profile.ohclasses }}</textarea></p>
<input type="submit" name = "name" value ="Submit OHclasses">
</form>

</a>
</div>

</div>
</div>



</div>
<div class="personal-info-container">
Expand Down Expand Up @@ -138,6 +179,15 @@ <h4 class="modal-title" id="myModalLabel">Edit your Officer Bio</h4>
<li><i class="fa fa-comment"></i> Officer Bio: <a href = "#" data-toggle="modal" data-target="#myModal2">
Edit
</a> </i></li>
<li><i class="fa fa-comment"></i> Office Hours: <a href = "#" data-toggle="modal" data-target="#myModal3">
Edit
</a> </i></li>

<li><i class="fa fa-comment"></i> Office Hour classes: <a href = "#" data-toggle="modal" data-target="#myModal4">
Edit
</a> </i></li>


{% endif %}
<!-- <button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#resume-modal">
Upload New Resume
Expand Down
34 changes: 34 additions & 0 deletions users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,30 @@ def officers(request):
'logged_in': request.user.is_authenticated()})
return HttpResponse(template.render(context))

def officers2(request):
template = loader.get_template('users/officers2.html')
officers = UserProfile.objects.filter(user_type=3, approved=True)
for position in OfficerPosition.positions.values():
position.users = []

for officer in officers:
officer_profile_list = OfficerProfile.objects.filter(user=officer.user, term=CURRENT_SEMESTER[0])
if len(officer_profile_list) != 0:
OfficerPosition.positions[officer_profile_list[0].position].users.append(officer)

context = RequestContext(request,
{'positions': OfficerPosition.positions.values(),
'title': 'Officers',
'current_semester': CURRENT_SEMESTER[1],
'logged_in': request.user.is_authenticated()})
return HttpResponse(template.render(context))







def members(request):
template = loader.get_template('users/members.html')
members = UserProfile.objects.filter(user_type=2, approved=True)
Expand Down Expand Up @@ -243,6 +267,16 @@ def myprofile(request):
#bio_form = ChangeBioForm(request.POST)
up.officer_profile.bio = request.POST['value']
up.officer_profile.save()

elif request.POST['name'] == 'Submit OHtimes':
#bio_form = ChangeBioForm(request.POST)
up.officer_profile.ohtime = request.POST['value']
up.officer_profile.save()
elif request.POST['name'] == 'Submit OHclasses':
#bio_form = ChangeBioForm(request.POST)
up.officer_profile.ohclasses = request.POST['value']
up.officer_profile.save()

elif request.POST['name'] == 'email':
user.email = request.POST['value']
user.save()
Expand Down
Loading