diff --git a/RIGS/migrations/0002_modelcomment_person.py b/RIGS/migrations/0002_modelcomment_person.py
new file mode 100644
index 00000000..346d46f0
--- /dev/null
+++ b/RIGS/migrations/0002_modelcomment_person.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+from django.conf import settings
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('RIGS', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='ModelComment',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('postedAt', models.DateTimeField(auto_now=True)),
+ ('message', models.TextField()),
+ ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
+ ],
+ options={
+ },
+ bases=(models.Model,),
+ ),
+ migrations.CreateModel(
+ name='Person',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('name', models.CharField(max_length=50)),
+ ('phone', models.CharField(max_length=15, null=True, blank=True)),
+ ('email', models.EmailField(max_length=75, null=True, blank=True)),
+ ('address', models.TextField(null=True, blank=True)),
+ ('comments', models.ManyToManyField(to='RIGS.ModelComment')),
+ ],
+ options={
+ },
+ bases=(models.Model,),
+ ),
+ ]
diff --git a/RIGS/migrations/0003_auto_20141031_0219.py b/RIGS/migrations/0003_auto_20141031_0219.py
new file mode 100644
index 00000000..3bb2f635
--- /dev/null
+++ b/RIGS/migrations/0003_auto_20141031_0219.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('RIGS', '0002_modelcomment_person'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='modelcomment',
+ name='user',
+ ),
+ migrations.RemoveField(
+ model_name='person',
+ name='comments',
+ ),
+ migrations.DeleteModel(
+ name='ModelComment',
+ ),
+ migrations.AddField(
+ model_name='person',
+ name='notes',
+ field=models.TextField(null=True, blank=True),
+ preserve_default=True,
+ ),
+ ]
diff --git a/RIGS/models.py b/RIGS/models.py
index 705b6ba5..3a08fcf1 100644
--- a/RIGS/models.py
+++ b/RIGS/models.py
@@ -16,12 +16,6 @@ class Profile(AbstractUser):
url = "https://www.gravatar.com/avatar/" + hashlib.md5(self.email).hexdigest() + "?d=identicon&s=500"
return url
-class ModelComment(models.Model):
- user = models.ForeignKey(settings.AUTH_USER_MODEL)
- postedAt = models.DateTimeField(auto_now=True)
-
- message = models.TextField()
-
@reversion.register
class Person(models.Model):
name = models.CharField(max_length=50)
@@ -30,10 +24,10 @@ class Person(models.Model):
address = models.TextField(blank=True, null=True)
- comments = models.ManyToManyField('ModelComment', blank=True)
+ notes = models.TextField(blank=True, null=True)
def __unicode__(self):
string = self.name
- if self.comments.count() > 0:
+ if len(self.notes) > 0:
string += "*"
return string
\ No newline at end of file
diff --git a/RIGS/templates/RIGS/person_detail.html b/RIGS/templates/RIGS/person_detail.html
index 5548b60b..a126e198 100644
--- a/RIGS/templates/RIGS/person_detail.html
+++ b/RIGS/templates/RIGS/person_detail.html
@@ -6,8 +6,10 @@
{% block content %}
{{ object.name }}
+
@@ -23,6 +25,9 @@
Address
{{ object.address|linebreaksbr }}
+
+ Notes
+ {{ object.notes|linebreaksbr }}
diff --git a/RIGS/templates/RIGS/person_form.html b/RIGS/templates/RIGS/person_form.html
index 7266e013..f1161571 100644
--- a/RIGS/templates/RIGS/person_form.html
+++ b/RIGS/templates/RIGS/person_form.html
@@ -37,6 +37,13 @@
+
+
diff --git a/RIGS/templates/RIGS/person_list.html b/RIGS/templates/RIGS/person_list.html
index d76117d8..46093097 100644
--- a/RIGS/templates/RIGS/person_list.html
+++ b/RIGS/templates/RIGS/person_list.html
@@ -16,7 +16,7 @@
Name |
Email |
Phone |
- Comments |
+ Notes |
|
@@ -27,7 +27,7 @@
{{ person.name }} |
{{ person.email }} |
{{ person.phone }} |
- {{ person.comment_list|length }} |
+ {{ person.notes|yesno|capfirst }} |
Add buttons |
{% empty %}
diff --git a/RIGS/urls.py b/RIGS/urls.py
index a5a933f7..4cc829e4 100644
--- a/RIGS/urls.py
+++ b/RIGS/urls.py
@@ -5,17 +5,24 @@ from RIGS import views
from PyRIGS.decorators import permission_required_with_403
urlpatterns = patterns('',
- # Examples:
- # url(r'^$', 'PyRIGS.views.home', name='home'),
- # url(r'^blog/', include('blog.urls')),
+ # Examples:
+ # url(r'^$', 'PyRIGS.views.home', name='home'),
+ # url(r'^blog/', include('blog.urls')),
+ url(r'^closemodal/$', views.CloseModal.as_view(), name='closemodal'),
- url('^user/login/$', 'RIGS.views.login', name='login'),
+ url('^user/login/$', 'RIGS.views.login', name='login'),
- # People
- url(r'^people/$', permission_required_with_403('RIGS.view_person')(views.PersonIndex.as_view()), name='person_list'),
- url(r'^people/(?P\d+)/$', permission_required_with_403('RIGS.view_person')(views.PersonDetail.as_view()),
- name='person_detail'),
- url(r'^people/add/$', permission_required_with_403('RIGS.add_person')(views.PersonCreate.as_view()), name='person_add'),
- url(r'^people/(?P\d+)/edit/$', permission_required_with_403('RIGS.change_person')(views.PersonUpdate.as_view()), name='person_update'),
+ # People
+ url(r'^people/$', permission_required_with_403('RIGS.view_person')(views.PersonIndex.as_view()),
+ name='person_list'),
+ url(r'^people/(?P\d+)/$',
+ permission_required_with_403('RIGS.view_person')(views.PersonDetail.as_view()),
+ name='person_detail'),
+ url(r'^people/add/$',
+ permission_required_with_403('RIGS.add_person')(views.PersonCreate.as_view()),
+ name='person_add'),
+ url(r'^people/(?P\d+)/edit/$',
+ permission_required_with_403('RIGS.change_person')(views.PersonUpdate.as_view()),
+ name='person_update'),
)
diff --git a/RIGS/views.py b/RIGS/views.py
index 718a07f1..a8a43daa 100644
--- a/RIGS/views.py
+++ b/RIGS/views.py
@@ -12,6 +12,18 @@ def login(request, **kwargs):
from django.contrib.auth.views import login
return login(request)
+"""
+Called from a modal window (e.g. when an item is submitted to an event/invoice).
+May optionally also include some javascript in a success message to cause a load of
+the new information onto the page.
+"""
+class CloseModal(generic.TemplateView):
+ template_name = 'closemodal.html'
+
+ def get_context_data(self, **kwargs):
+ from django.contrib import messages
+ return {'messages', messages.get_messages(self.request)}
+
class PersonIndex(generic.ListView):
model = models.Person
diff --git a/db.sqlite3 b/db.sqlite3
index 9a039e37..e437d91f 100644
Binary files a/db.sqlite3 and b/db.sqlite3 differ
diff --git a/templates/base.html b/templates/base.html
index 6a35aa9d..69688764 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -116,6 +116,8 @@
+
+
+
{% block js %}
{% endblock %}