Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mentor application system #9

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
db9da26
Change placeholder width
Sep 19, 2019
cf0341c
Add animation to the voting UI
Sep 20, 2019
a386297
Fixed a bug that the placeholder don't have enough width in method on…
Sep 21, 2019
41b95ac
Create a new app mentors
Oct 21, 2019
6563745
Add a new css file for form submission
Oct 21, 2019
242c5fc
Add a new column for mentor application
Oct 21, 2019
21d7369
Add matching simulation
Nov 10, 2019
b72e8c2
change css
Nov 10, 2019
f3ab2cc
Fix bugs in the simualtion round
Nov 11, 2019
8773fff
Fix bugs in the simualtion round
Nov 12, 2019
afe7e87
bug fixed
Nov 13, 2019
f665a64
bug fixed
Nov 13, 2019
8ef8037
fix bugs of form
Nov 13, 2019
c112c6b
Redirect the matching result to the HTML page
Nov 14, 2019
976c131
Add feature sliders that can be modified by the prof
Nov 16, 2019
c16058a
Change the student application form to multipage
Nov 16, 2019
2e54887
add new js for mentor system
Nov 19, 2019
3e462ce
add new css for mentor system
Nov 19, 2019
8024e84
Visual Changes & Time slots
Nov 21, 2019
76c0cf3
changes
Nov 21, 2019
ebd6d5f
changes
Nov 21, 2019
72e294b
Add new app crispy form
Nov 22, 2019
999bb88
updated readme
starwarswii Nov 22, 2019
a31a5c2
Update README.md
starwarswii Nov 22, 2019
694db98
added a basic banner on the main page
starwarswii Nov 22, 2019
425fd28
Merge branch 'master' of https://github.com/ReedyChen/opra
starwarswii Nov 22, 2019
30572e3
Link mentor app to each account
Nov 23, 2019
01f1ede
Link mentor app to each account
Nov 23, 2019
11f76f2
Merge branch 'master' of https://github.com/ReedyChen/opra
Nov 23, 2019
2867b1b
Reverse Changes
Nov 23, 2019
5bf17c3
Visual Changes
Nov 23, 2019
c4ff16a
change cache
Nov 23, 2019
740e64d
changes
Nov 23, 2019
a607483
Add page lock to prevent form crash
Nov 24, 2019
52dfd9c
Bugs fix
Nov 24, 2019
7930935
Change csv file update from local
Nov 25, 2019
d4e9e5c
Bug fixed
Nov 25, 2019
19574cf
Finalize
Nov 25, 2019
1636005
Finalize
Nov 25, 2019
7d4569d
Add junming to admin
Nov 25, 2019
8e796b0
Merge branch 'master' into master
tomjmwang Nov 25, 2019
a700b9b
Make new migrations
Nov 25, 2019
ad184ca
Make new migrations
Nov 25, 2019
67f0805
Make another migrations
Nov 25, 2019
015796b
Migration change
Nov 25, 2019
f19cff7
change admin
Nov 25, 2019
5a37ef9
updated match.py to fix bug
starwarswii Dec 18, 2019
86ce88c
removed match_change.py
starwarswii Dec 18, 2019
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
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@ The web app is built on Django, and uses an SQLite database. [Click here](https:

5. Clone this project from Github

6. Copy settings.py from opra_dependencies to compsocsite/compsocsite. Copy opra_crypto.py from opra_dependencies to compsocsite/polls.
6. ~~Copy settings.py from opra_dependencies to compsocsite/compsocsite.~~ (an updated settings.py is now included.) Copy opra_crypto.py from opra_dependencies to compsocsite/polls.

6.5. For testing locally, edit compsocsite/appauth/views.py and find-replace `https://opra.cs.rpi.edu` with `http://127.0.0.1:8000`

7. Open command line (terminal), change to OPRA's directory, and then enter the following commands:

<code>cd composcite</code>

<code>python manage.py migrate</code>

<code>python manage.py createcachetable</code>
```
cd composcite
python manage.py migrate
python manage.py createcachetable
```

Then run the server by entering:

Expand All @@ -58,6 +60,7 @@ The web app is built on Django, and uses an SQLite database. [Click here](https:
* **scipy**:
* **numpy**:
* **networkx**:
* **django-crispy-forms**:
* **django-mathfilters**:
* **matplotlib**:

Expand Down
Empty file modified compsocsite/appauth/migrations/0004_userprofile_showhint.py
100644 → 100755
Empty file.
Empty file modified compsocsite/appauth/migrations/0005_auto_20170306_1628.py
100644 → 100755
Empty file.
Empty file modified compsocsite/appauth/migrations/0007_userprofile_code.py
100644 → 100755
Empty file.
Empty file modified compsocsite/appauth/migrations/0008_userprofile_comments.py
100644 → 100755
Empty file.
Empty file modified compsocsite/appauth/migrations/0009_auto_20171204_1448.py
100644 → 100755
Empty file.
Empty file modified compsocsite/appauth/migrations/0010_auto_20171216_1342.py
100644 → 100755
Empty file.
Empty file modified compsocsite/appauth/migrations/0011_auto_20171224_2353.py
100644 → 100755
Empty file.
Empty file modified compsocsite/appauth/migrations/0012_auto_20171224_2356.py
100644 → 100755
Empty file.
Empty file modified compsocsite/appauth/migrations/0013_auto_20171229_1132.py
100644 → 100755
Empty file.
Empty file modified compsocsite/appauth/migrations/0014_auto_20171229_1135.py
100644 → 100755
Empty file.
Empty file modified compsocsite/appauth/migrations/0015_userprofile_finished.py
100644 → 100755
Empty file.
Empty file modified compsocsite/appauth/migrations/0016_userprofile_numq.py
100644 → 100755
Empty file.
Empty file modified compsocsite/appauth/migrations/0017_userprofile_exp_data.py
100644 → 100755
Empty file.
25 changes: 25 additions & 0 deletions compsocsite/appauth/migrations/0018_auto_20191125_0156.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 2.2 on 2019-11-25 06:56

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('mentors', '0001_initial'),
('appauth', '0017_userprofile_exp_data'),
]

operations = [
migrations.AddField(
model_name='userprofile',
name='mentor_applied',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='userprofile',
name='mentor_profile',
field=models.OneToOneField(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='mentors.Mentor'),
),
]
11 changes: 10 additions & 1 deletion compsocsite/appauth/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import datetime
import django

from mentors.models import Mentor
from django import forms
from django.db import models
from django.utils import timezone
Expand All @@ -10,7 +12,7 @@

class UserProfile(models.Model):
# This line is required. Links UserProfile to a User model instance.
user = models.OneToOneField(User,on_delete=models.CASCADE,)
user = models.OneToOneField(User, on_delete = models.CASCADE,)
time_creation = models.DateTimeField()
displayPref = models.IntegerField(default=1)
emailInvite = models.BooleanField(default=False)
Expand All @@ -27,6 +29,13 @@ class UserProfile(models.Model):
finished = models.BooleanField(default=False)
numq= models.IntegerField(default=0)
exp_data = models.TextField(default="{}")

# Mentor Applicaton Profile
mentor_applied = models.BooleanField(default = False)

# Set mentor reference to SET_NULL here to protect the deletion of the user profile
mentor_profile = models.OneToOneField(Mentor, on_delete = models.SET_NULL, default = None, null = True)

# Override the __unicode__() method to return out something meaningful!
def __unicode__(self):
return self.user.username
Expand Down
2 changes: 1 addition & 1 deletion compsocsite/appauth/templates/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</fieldset>
<fieldset class="form-group">
<label for="email">Email</label>
<input type="text" class="form-control" id="email" name="email" value="{{ request.user.email }}">
<input type="text" class="form-control" id="email" name="email" value="{{ request.user.email }}" readonly>
</fieldset>
<input type="submit" class="btn btn-success" value="Save Changes">
</form>
Expand Down
192 changes: 192 additions & 0 deletions compsocsite/compsocsite/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
"""
Django settings for compsocsite project.

Generated by 'django-admin startproject' using Django 1.9.5.

For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '_'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['*']


# Application definition

INSTALLED_APPS = [
'polls.apps.PollsConfig',
'crispy_forms',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'compsocsite',
'appauth',
'groups',
'multipolls',
'mentors',
'django_mobile',
'mathfilters',
'sessions_local',
'corsheaders',
'qr_code',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'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',
'django_mobile.middleware.MobileDetectionMiddleware',
'django_mobile.middleware.SetFlavourMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
]

ROOT_URLCONF = 'compsocsite.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django_mobile.context_processors.flavour',
],
'loaders':(
('django_mobile.loader.CachedLoader', (
'django_mobile.loader.Loader',
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.app_directories.Loader',
)),
)
},
},
]

WSGI_APPLICATION = 'compsocsite.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'my_cache_table',
}
}


# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]

#CAS
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
#'cas.backends.CASBackend',
]
CAS_GATEWAY = True

CAS_RESPONSE_CALLBACKS = (
'module.callbackfunction',
)

# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'EST'

USE_I18N = True

USE_L10N = True

USE_TZ = True

#CAS
CAS_SERVER_URL = "https://cas-auth.rpi.edu/cas/"
CAS_LOGOUT_COMPLETELY = True
CAS_PROVIDE_URL_TO_LOGOUT = True
CAS_AUTO_CREATE_USERS = True
CAS_IGNORE_REFERER = True
CAS_REDIRECT_URL = '/polls/regular_polls'
#'https://opra.cs.rpi.edu'
# CAS_FORCE_SSL_SERVICE_URL = True

#################################################
# Email settings #
#################################################
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'ThisIsJustATestProgram'
EMAIL_PORT = 587


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/

STATIC_URL = '/static/'
LOGIN_URL = '/auth/login/'

STATICFILES_DIRS = (
'/static/',
os.path.join(os.path.abspath(BASE_DIR), 'static'),
)


# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# SESSION_COOKIE_SECURE = True
# CSRF_COOKIE_SECURE = True
# SECURE_HSTS_SECONDS = 3600
# SECURE_SSL_REDIRECT = False
1 change: 1 addition & 0 deletions compsocsite/compsocsite/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
url(r'^sessions/', include('sessions_local.urls')),
url(r'^static/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT, 'show_indexes':True}),
url(r'^multipolls/', include('multipolls.urls')),
url(r'^mentors/', include('mentors.urls')),
url(r'^GM2017$', GMView.as_view(), name='voting_demo'),
url(r'^message$', sendMessage, name='message'),
url(r'^GM2017$', GMView.as_view(), name='GM_2017'),
Expand Down
Empty file added compsocsite/mentors/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions compsocsite/mentors/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions compsocsite/mentors/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class MentorsConfig(AppConfig):
name = 'mentors'
Loading