diff --git a/README.md b/README.md index b9c21eb6..5c8b7d02 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # TEC PA & Lighting - PyRIGS # -[![wercker status](https://app.wercker.com/status/b26100ecccdfb46a9a9056553daac5b7/m/master "wercker status")](https://app.wercker.com/project/bykey/b26100ecccdfb46a9a9056553daac5b7) +[![wercker status](https://app.wercker.com/status/2dbe0517c3d83859c985ffc5a55a2802/m "wercker status")](https://app.wercker.com/project/bykey/2dbe0517c3d83859c985ffc5a55a2802) Welcome to TEC PA & Lightings PyRIGS program. This is a reimplementation of the existing Rig Information Gathering System (RIGS) that was developed using Ruby on Rails. @@ -75,4 +75,4 @@ python manage.py runserver Please refer to Django documentation for a full list of options available here. ### Committing, pushing and testing ### -Feel free to commit as you wish, on your own branch. On my branch (master for development) do not commit code that you either know doesn't work or don't know works. If you must commit this code, please make sure you say in the commit message that it isn't working, and if you can why it isn't working. If and only if you absolutely must push, then please don't leave it as the HEAD for too long, it's not much to ask but when you are done just make sure you haven't broken the HEAD for the next person. \ No newline at end of file +Feel free to commit as you wish, on your own branch. On my branch (master for development) do not commit code that you either know doesn't work or don't know works. If you must commit this code, please make sure you say in the commit message that it isn't working, and if you can why it isn't working. If and only if you absolutely must push, then please don't leave it as the HEAD for too long, it's not much to ask but when you are done just make sure you haven't broken the HEAD for the next person. diff --git a/RIGS/migrations/0024_auto_20160229_2042.py b/RIGS/migrations/0024_auto_20160229_2042.py new file mode 100644 index 00000000..163ff8e4 --- /dev/null +++ b/RIGS/migrations/0024_auto_20160229_2042.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('RIGS', '0023_auto_20150529_0048'), + ] + + operations = [ + migrations.AlterField( + model_name='event', + name='based_on', + field=models.ForeignKey(related_name='future_events', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='RIGS.Event', null=True), + ), + ] diff --git a/RIGS/models.py b/RIGS/models.py index 09b3080a..fc06911f 100644 --- a/RIGS/models.py +++ b/RIGS/models.py @@ -301,7 +301,7 @@ class Event(models.Model, RevisionMixin): status = models.IntegerField(choices=EVENT_STATUS_CHOICES, default=PROVISIONAL) dry_hire = models.BooleanField(default=False) is_rig = models.BooleanField(default=True) - based_on = models.ForeignKey('Event', related_name='future_events', blank=True, null=True) + based_on = models.ForeignKey('Event', on_delete=models.SET_NULL, related_name='future_events', blank=True, null=True) # Timing start_date = models.DateField() diff --git a/RIGS/rigboard.py b/RIGS/rigboard.py index 42a79b3b..a6ccde09 100644 --- a/RIGS/rigboard.py +++ b/RIGS/rigboard.py @@ -37,6 +37,12 @@ class RigboardIndex(generic.TemplateView): class WebCalendar(generic.TemplateView): template_name = 'RIGS/calendar.html' + def get_context_data(self, **kwargs): + context = super(WebCalendar, self).get_context_data(**kwargs) + context['view'] = kwargs.get('view','') + context['date'] = kwargs.get('date','') + return context + class EventDetail(generic.DetailView): model = models.Event diff --git a/RIGS/templates/RIGS/calendar.html b/RIGS/templates/RIGS/calendar.html index 23a0b1b8..f6891d84 100644 --- a/RIGS/templates/RIGS/calendar.html +++ b/RIGS/templates/RIGS/calendar.html @@ -14,8 +14,28 @@ diff --git a/RIGS/test_functional.py b/RIGS/test_functional.py index 7fad8fc0..f37bf0bc 100644 --- a/RIGS/test_functional.py +++ b/RIGS/test_functional.py @@ -420,8 +420,9 @@ class EventTest(LiveServerTestCase): e.send_keys(Keys.ENTER) # See redirected to success page + successTitle = self.browser.find_element_by_xpath('//h1').text event = models.Event.objects.get(name='Test Event Name') - self.assertIn("N0000%d | Test Event Name"%event.pk, self.browser.find_element_by_xpath('//h1').text) + self.assertIn("N0000%d | Test Event Name"%event.pk, successTitle) def testEventDuplicate(self): testEvent = models.Event.objects.create(name="TE E1", status=models.Event.PROVISIONAL, start_date=date.today() + timedelta(days=6), description="start future no end") @@ -608,9 +609,10 @@ class EventTest(LiveServerTestCase): save.click() # See redirected to success page + successTitle = self.browser.find_element_by_xpath('//h1').text event = models.Event.objects.get(name='Test Event Name') - self.assertIn("N0000%d | Test Event Name"%event.pk, self.browser.find_element_by_xpath('//h1').text) - + self.assertIn("N0000%d | Test Event Name"%event.pk, successTitle) + def testRigNonRig(self): self.browser.get(self.live_server_url + '/event/create/') # Gets redirected to login and back diff --git a/RIGS/urls.py b/RIGS/urls.py index 93028bb2..4338df08 100644 --- a/RIGS/urls.py +++ b/RIGS/urls.py @@ -69,6 +69,8 @@ urlpatterns = patterns('', # Rigboard url(r'^rigboard/$', login_required(rigboard.RigboardIndex.as_view()), name='rigboard'), url(r'^rigboard/calendar/$', login_required()(rigboard.WebCalendar.as_view()), name='web_calendar'), + url(r'^rigboard/calendar/(?P(month|week|day))/$', login_required()(rigboard.WebCalendar.as_view()), name='web_calendar'), + url(r'^rigboard/calendar/(?P(month|week|day))/(?P(\d{4}-\d{2}-\d{2}))/$', login_required()(rigboard.WebCalendar.as_view()), name='web_calendar'), url(r'^rigboard/archive/$', RedirectView.as_view(permanent=True,pattern_name='event_archive')), url(r'^rigboard/activity/$', permission_required_with_403('RIGS.view_event')(versioning.ActivityTable.as_view()), diff --git a/db.sqlite3 b/db.sqlite3 index d0e8fed8..07462b3f 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ