From a77bc65d7b7276498f367962083cb6fd2120b631 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 29 Feb 2016 20:12:41 +0000 Subject: [PATCH 1/6] Changed delete condition to SET_NULL - closes #199 --- RIGS/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() From 1681ab8fee15a84d0a0f15764bd25752c8487595 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 29 Feb 2016 20:35:53 +0000 Subject: [PATCH 2/6] Allowed linking to specific views/dates on the calendar - closes #153 --- RIGS/rigboard.py | 6 +++++ RIGS/templates/RIGS/calendar.html | 37 ++++++++++++++++++++++++++++++- RIGS/urls.py | 2 ++ 3 files changed, 44 insertions(+), 1 deletion(-) 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/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()), From e3adfecd17036fd694e8ce762ff2860d97b0a247 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 29 Feb 2016 20:43:11 +0000 Subject: [PATCH 3/6] Added database migration --- RIGS/migrations/0024_auto_20160229_2042.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 RIGS/migrations/0024_auto_20160229_2042.py 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), + ), + ] From 67b2bc6d5428854f3a70eaeb0789f91e29a755f9 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 29 Feb 2016 20:44:09 +0000 Subject: [PATCH 4/6] Applied migration to development database --- db.sqlite3 | Bin 82944 -> 84992 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/db.sqlite3 b/db.sqlite3 index d0e8fed8d67a99e4d84aaca79726634d5103571e..07462b3f640fb99ec6f986f85dfa5d5315cc4d15 100644 GIT binary patch delta 753 zcmW-eZ%ET&5XYbU-EX?wM%vWOEtuuZQFH6(W=y5j%28W7^^HU_jABhn`=kA#0v~(f zs%>o^LG`v?1VLrLa8SK4U(}1Ds29=;Bg%;CMfE}?Fsxe#_u-B^zIV?(qY1<4HABW$ z(kF!IVXtOagaA`^Q@y)SxW5z`a7kG3F6JBX6E5O=e1~uGJ3hl{e1s42CH~^_?a8Da zJGdz0#E(c4n2VVmeMTR!0~{6N7ENtYz+yyY)r1s-3H=s=rZQt?2c*`jvqWnnN{YO%`Ly(`!gJ$Ulq;4pbi`&4`* zR?-zyTLmjtz=47O!PrprNIZ7De>grgc%oX+8&f$rADC6&DuePt;B(Ak1Z^CuaE7G$ zs(z=%r!+S@4Wg{6HLvdVYQAXy$na29^KNeNYFdB;pO#PDUd^oq9GbV$SKp}l>H
Tixzd8*|FrXJF_5ux2mgXi1cgh-SU9i*Ha~7JOu&ZM=(n*ot^?EjoP|P#) z2JHE>d#LnlK;Mxh-Zt*Jj&;TMIT&ewF`dg-ut=pumX_GJ`cJbb-2@TA{)2 z?7>LLar;LvLD5qn*%ddUhx9>vFvK3Lmmqu)@g<*RkwPcvaPNl;=L_d>bI-Nhv^MLh z>LY~2@%}H$3Uv+jeWZRHH26d8FbCMV3|p`dKj1rjg*DiNU08un@BtQJE?+S};|2Nh zn-=q9@}lTKBcdH`6=AelG@&73peIBP>Jyb{?KtA!b*x0a2^=LFY9aa0hy! z6CT0~SONpyL7Hu{U%*wBdx6Q#$_{;pRGU*{qXWszjgi50Hk%$El7{svw|l`SA6eVI zP6h_Oels=HKb#y)_m8ATF_I177`H{vQ~kY-Hy-8SA+QPs=)wmfoZgkf_C&pnG&1Q} zIxc_v{mK*FKJSDT0?bXAo5dlHU+|bMv*kjYSDwi^W$ugasE&4DYU|0L>ovJTA$tF` zDkWN}EG06m<+e;t`sD7^vDd44D!cPz97l!awaK9T`N~e47lYKwwFx>w_mpEgLFJVx zle+aL%${Wo+T#k@F>WF;f~Q35=u>84<7^8TZBVh9BAEX5HF8gxW)E8w|EO_gSv$O- vDn2u=%mZb8F+jQ5#%Y<*GJ60~5K7o~C>M6oDI*7Gi%m!9IxX^3^g#a$R|1mH From c6b45da72c980df39a08aed475d6103c847bceaf Mon Sep 17 00:00:00 2001 From: David Taylor Date: Wed, 16 Mar 2016 12:49:42 +0000 Subject: [PATCH 5/6] Made tests more reliable - wait for success page to load before checking item exists in database --- RIGS/test_functional.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 From 9964d33cc0752a294bdb689daf6de5f0b747f0d8 Mon Sep 17 00:00:00 2001 From: Tom Price Date: Wed, 16 Mar 2016 14:32:38 +0000 Subject: [PATCH 6/6] Update wercker in README.md [ci skip] --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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.