Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
31 changes: 14 additions & 17 deletions clatoolkit_project/clatoolkit/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import re

class UserForm(forms.ModelForm):
first_name = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'}))
last_name = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'}))
first_name = forms.CharField(required=False, widget=forms.TextInput(attrs={'class': 'form-control'}))
last_name = forms.CharField(required=False, widget=forms.TextInput(attrs={'class': 'form-control'}))
username = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'}))
password = forms.CharField(widget=forms.PasswordInput(attrs={'class': 'form-control'}))
email = forms.CharField(widget=forms.EmailInput(attrs={'class': 'form-control'}))
Expand Down Expand Up @@ -35,15 +35,15 @@ class RegisterClientAppForm(forms.ModelForm):
app_name = forms.CharField(label='Client application name registered on your LRS', widget=forms.TextInput(attrs={'class': 'form-control'}))
domain = forms.CharField(label='Domain (e.g. my.lrsdomain.com)', widget=forms.TextInput(attrs={'class': 'form-control'}))
port = forms.IntegerField(label='Port number', widget=forms.TextInput(attrs={'class': 'form-control'}))
auth_request_path = forms.CharField(label='Auth request path (e.g. /OAuth/initiate)',
auth_request_path = forms.CharField(label='Auth request path (e.g. /OAuth/initiate)',
widget=forms.TextInput(attrs={'class': 'form-control'}))
access_token_path = forms.CharField(label='Access token path (e.g. /OAuth/token)',
access_token_path = forms.CharField(label='Access token path (e.g. /OAuth/token)',
widget=forms.TextInput(attrs={'class': 'form-control'}))
authorization_path = forms.CharField(label='Authorization path (e.g. /OAuth/authorize)',
authorization_path = forms.CharField(label='Authorization path (e.g. /OAuth/authorize)',
widget=forms.TextInput(attrs={'class': 'form-control'}))
xapi_statement_path = forms.CharField(label='xAPI statement path (e.g. /xapi/statements)',
xapi_statement_path = forms.CharField(label='xAPI statement path (e.g. /xapi/statements)',
widget=forms.TextInput(attrs={'class': 'form-control'}))
reg_lrs_account_path = forms.CharField(label='LRS account registeration path (e.g. /regclatoolkitu/)',
reg_lrs_account_path = forms.CharField(label='LRS account registeration path (e.g. /regclatoolkitu/)',
widget=forms.TextInput(attrs={'class': 'form-control'}))

protocol_choice = (
Expand All @@ -54,19 +54,18 @@ class RegisterClientAppForm(forms.ModelForm):

class Meta:
model = ClientApp
fields = ("provider", "app_name", "i", "s", "protocol", "domain", "port",
"auth_request_path", "access_token_path", "authorization_path",
fields = ("provider", "app_name", "i", "s", "protocol", "domain", "port",
"auth_request_path", "access_token_path", "authorization_path",
"xapi_statement_path", "reg_lrs_account_path")


class CreateOfferingForm(forms.ModelForm):
code = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'}))
name = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'}))
semester = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'}))
provider = forms.CharField(label='LRS', widget=forms.TextInput(attrs={'class': 'form-control'}))
start_date = forms.DateField(label='Start Date',
start_date = forms.DateField(label='Start Date',
widget=forms.DateInput(attrs={'class': 'form-control'}), input_formats=['%d / %m / %Y'])
end_date = forms.DateField(label='End Date',
end_date = forms.DateField(label='End Date',
widget=forms.DateInput(attrs={'class': 'form-control'}), input_formats=['%d / %m / %Y'])
co_analysis = forms.BooleanField(label='Content Analysis Dashboard ON/OFF', required=False, initial={'co_analysis':True})
sn_analysis = forms.BooleanField(label='Social Network Analysis Dashboard ON/OFF', required=False, initial={'sn_analysis':True})
Expand All @@ -92,7 +91,6 @@ def clean(self):

return self.cleaned_data


class SocialMediaUpdateForm(forms.ModelForm):
fb_id = forms.CharField(required=False, widget=forms.TextInput(attrs={'class': 'form-control'}))
twitter_id = forms.CharField(required=False, widget=forms.TextInput(attrs={'class': 'form-control'}))
Expand All @@ -118,7 +116,6 @@ class Meta:
model = UserProfile
fields = ('fb_id', 'twitter_id', 'forum_id', 'google_account_name', 'diigo_username', 'blog_id', 'github_account_name', 'trello_account_name')


class UserProfileForm(forms.ModelForm):
fb_id = forms.CharField(required=False, widget=forms.TextInput(attrs={'class': 'form-control'}))
twitter_id = forms.CharField(required=False, widget=forms.TextInput(attrs={'class': 'form-control'}))
Expand All @@ -130,9 +127,9 @@ class UserProfileForm(forms.ModelForm):
trello_account_name = forms.CharField(required=False, widget=forms.TextInput(attrs={'class': 'form-control'}))

def clean(self):
if not ((self.cleaned_data.get('fb_id'))
or (self.cleaned_data.get('twitter_id')) or (self.cleaned_data.get('forum_id'))
or (self.cleaned_data.get('blog_id')) or (self.cleaned_data.get('google_account_name'))
if not ((self.cleaned_data.get('fb_id'))
or (self.cleaned_data.get('twitter_id')) or (self.cleaned_data.get('forum_id'))
or (self.cleaned_data.get('blog_id')) or (self.cleaned_data.get('google_account_name'))
or (self.cleaned_data.get('diigo_username')) or (self.cleaned_data.get('github_account_name'))
or (self.cleaned_data.get('trello_account_name'))
):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

from django.db import models, migrations
import django_pgjson.fields
import datetime
from django.utils.timezone import utc
from django.conf import settings


Expand Down Expand Up @@ -227,4 +229,28 @@ class Migration(migrations.Migration):
name='unit',
field=models.ForeignKey(to='clatoolkit.UnitOffering'),
),
migrations.AddField(
model_name='dashboardreflection',
name='unit',
field=models.ForeignKey(default=1, to='clatoolkit.UnitOffering'),
preserve_default=False,
),
migrations.AddField(
model_name='learningrecord',
name='datetimestamp',
field=models.DateTimeField(default=datetime.datetime(2017, 2, 6, 5, 21, 4, 225460, tzinfo=utc)),
preserve_default=False,
),
migrations.AddField(
model_name='unitoffering',
name='end_date',
field=models.DateField(default=datetime.datetime(2017, 2, 6, 5, 21, 8, 763640, tzinfo=utc)),
preserve_default=False,
),
migrations.AddField(
model_name='unitoffering',
name='start_date',
field=models.DateField(default=datetime.datetime(2017, 2, 6, 5, 21, 13, 373698, tzinfo=utc)),
preserve_default=False,
),
]
Loading