Commit 8d450bce479f3f196a1418a27437bbcdd74a1884

Authored by fbormann
2 parents b98e303f 9f674276

Merge branch 'dev' of https://github.com/amadeusproject/amadeuslms into dev

exam/migrations/0002_auto_20161013_2047.py 0 → 100644
... ... @@ -0,0 +1,50 @@
  1 +# -*- coding: utf-8 -*-
  2 +# Generated by Django 1.10 on 2016-10-13 23:47
  3 +from __future__ import unicode_literals
  4 +
  5 +from django.db import migrations, models
  6 +import django.db.models.deletion
  7 +
  8 +
  9 +class Migration(migrations.Migration):
  10 +
  11 + dependencies = [
  12 + ('courses', '0005_file'),
  13 + ('exam', '0001_initial'),
  14 + ]
  15 +
  16 + operations = [
  17 + migrations.RemoveField(
  18 + model_name='exam',
  19 + name='beginDate',
  20 + ),
  21 + migrations.RemoveField(
  22 + model_name='exam',
  23 + name='endDate',
  24 + ),
  25 + migrations.RemoveField(
  26 + model_name='exam',
  27 + name='id',
  28 + ),
  29 + migrations.RemoveField(
  30 + model_name='exam',
  31 + name='name',
  32 + ),
  33 + migrations.AddField(
  34 + model_name='exam',
  35 + name='activity_ptr',
  36 + field=models.OneToOneField(auto_created=True, default=None, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='courses.Activity'),
  37 + preserve_default=False,
  38 + ),
  39 + migrations.AddField(
  40 + model_name='exam',
  41 + name='begin_date',
  42 + field=models.DateField(default=None, verbose_name='Begin of Course Date'),
  43 + preserve_default=False,
  44 + ),
  45 + migrations.AlterField(
  46 + model_name='answer',
  47 + name='answer',
  48 + field=models.CharField(max_length=300, verbose_name='Answer'),
  49 + ),
  50 + ]
... ...
links/forms.py
... ... @@ -3,11 +3,12 @@ from .models import Link
3 3 import validators
4 4  
5 5 class CreateLinkForm(forms.ModelForm):
6   - def validate_link(self,link):
  6 +
  7 + def clean_link(self):
  8 + link = self.cleaned_data['link']
7 9 if not validators.url(link):
8 10 raise forms.ValidationError(_('Please enter a valid URL'))
9   - else:
10   - return link
  11 + return link
11 12  
12 13 class Meta:
13 14 model = Link
... ...
links/templates/links/create_link.html 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +<!--MODAL CREATE LINK-->
  2 +<div class="modal fade" id="createLinksModal" tabindex="-1" role="dialog" aria-labelledby="createLink" style="display: none;">
  3 + <div class="modal-dialog" role="document">
  4 + <div class="modal-content">
  5 + <div class="modal-header">
  6 + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
  7 + <h4 class="modal-title" id="createLink">Create a New Link</h4>
  8 + </div>
  9 + <div class="modal-body">
  10 + <!-- Card -->
  11 + <div class="form-group is-empty">
  12 + <label class="control-label" for="inputDefault">Name</label>
  13 + <input type="text" class="form-control" id="inputDefault">
  14 + </div>
  15 + <div class="form-group is-empty">
  16 + <label class="control-label" for="inputDefault">Url</label>
  17 + <input type="text" class="form-control" id="inputDefault">
  18 + </div>
  19 + <div class="form-group is-empty">
  20 + <label class="control-label" for="inputDefault">Descrição</label>
  21 + <textarea class="form-control" rows="3"></textarea>
  22 + </div>
  23 + <div class="form-group">
  24 + <a href="javascript:void(0)" class="btn btn-raised btn-default">Cancel</a>
  25 + <a href="javascript:void(0)" class="btn btn-raised btn-primary">Submit</a>
  26 + </div>
  27 + <!-- .end Card -->
  28 + </div>
  29 + </div>
  30 + </div>
  31 +</div>
  32 +<!-- EndModal -->
... ...
links/templates/links/delete_link.html 0 → 100644
links/templates/links/link_modal.html
... ... @@ -1,35 +0,0 @@
1   -{% extends 'base.html'%}
2   -
3   -{% for link in links%}
4   -<!-- <h1> TESTE {{link.name}} </h1> -->
5   -{% block content%}
6   -
7   -<div class="modal-content">
8   - <div class="modal-header">
9   - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
10   - <h4 class="modal-title" id="createLink">Create a New Link</h4>
11   - </div>
12   - <div class="modal-body">
13   -
14   - <!-- Card -->
15   - <div class="form-group is-empty">
16   - <label class="control-label" for="inputDefault">Name</label>
17   - <input type="text" class="form-control" id="inputDefault">
18   - </div>
19   - <div class="form-group is-empty">
20   - <label class="control-label" for="inputDefault">Url</label>
21   - <input type="text" class="form-control" id="inputDefault">
22   - </div>
23   - <div class="form-group is-empty">
24   - <label class="control-label" for="inputDefault">Descrição</label>
25   - <textarea class="form-control" rows="3"></textarea><grammarly-btn><div style="visibility: hidden; z-index: 2;" class="_9b5ef6-textarea_btn _9b5ef6-anonymous _9b5ef6-not_focused" data-grammarly-reactid=".i"><div class="_9b5ef6-transform_wrap" data-grammarly-reactid=".i.0"><div title="Protected by Grammarly" class="_9b5ef6-status" data-grammarly-reactid=".i.0.0">&nbsp;</div></div><span class="_9b5ef6-btn_text" data-grammarly-reactid=".i.1">Not signed in</span></div></grammarly-btn>
26   - </div>
27   - <div class="form-group">
28   - <a href="javascript:void(0)" class="btn btn-raised btn-default">Cancel</a>
29   - <a href="javascript:void(0)" class="btn btn-raised btn-primary">Submit</a>
30   - </div>
31   - <!-- .end Card -->
32   - </div>
33   - </div>
34   -{% endblock %}
35   -{%endfor%}
links/templates/links/update_link.html 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +<!-- MODAL LINK EDIT-->
  2 +<div class="modal fade" id="linksModalEdit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  3 + <div class="modal-dialog" role="document">
  4 + <div class="modal-content">
  5 + <div class="modal-header">
  6 + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
  7 + <h4 class="modal-title" id="myModalLabel">Links</h4>
  8 + </div>
  9 + <div class="modal-body">
  10 + <!-- Card -->
  11 + <div class="form-group">
  12 + <label class="control-label" for="inputDefault">Name</label>
  13 + <input value="Python" type="text" class="form-control" id="inputDefault">
  14 + </div>
  15 + <div class="form-group">
  16 + <label class="control-label" for="inputDefault">Url</label>
  17 + <input value="https://www.python.org/" type="text" class="form-control" id="inputDefault">
  18 + </div>
  19 + <div class="form-group is-empty">
  20 + <label class="control-label" for="inputDefault">Descrição</label>
  21 + <textarea class="form-control" rows="3"></textarea>
  22 + </div>
  23 + <div class="form-group">
  24 + <a href="javascript:void(0)" class="btn btn-raised btn-default">Cancel</a>
  25 + <a href="javascript:void(0)" class="btn btn-raised btn-primary">Submit</a>
  26 + </div>
  27 + <!-- .end Card -->
  28 + </div>
  29 + </div>
  30 + </div>
  31 +</div>
  32 +<!-- EndModal -->
... ...
links/views.py
... ... @@ -10,7 +10,7 @@ from .forms import *
10 10  
11 11 # Create your views here.
12 12 class CreateLink(generic.CreateView):
13   - template_name = 'links/link_modal.html'
  13 + template_name = 'links/create_link.html'
14 14 form_class = CreateLinkForm
15 15 success_url = reverse_lazy('course:manage')
16 16 context_object_name = 'links'
... ... @@ -22,16 +22,18 @@ class CreateLink(generic.CreateView):
22 22 def get_context_data(self, **kwargs):
23 23 context = {}
24 24 context['links'] = Link.objects.all()
  25 +
25 26 return context
26 27  
27 28  
28 29 def deleteLink(request,linkname):
29 30 link = get_object_or_404(Link,name = linkname)
30 31 link.delete()
  32 + template_name = 'links/delete_link.html'
31 33 messages.success(request,_("Link deleted Successfully!"))
32 34 return redirect('course:manage')
33 35 class UpdateLink(generic.UpdateView):
34   - template_name = 'links/'
  36 + template_name = 'links/update_link.html'
35 37 form_class = UpdateLinkForm
36 38 success_url = reverse_lazy()
37 39 def form_valid(self, form):
... ...