Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Bugs/issue11 #12

Merged
merged 6 commits into from

2 participants

@amenasse

this is the fix for #11, it also includes the previous fixes for #5,#6,#7

amenasse added some commits
@amenasse amenasse peg version of python-dateutils. Fixes #5
workaround for issue where vobjects setup.py is installing an incompatible
version of python-dateutils
a596526
@amenasse amenasse accept additional args and keyword args to save method. Fixes #6 83b5909
@amenasse amenasse change default ordering for EventVariationBase. Fixes #7
EventVariationBase no longer orders on a field which may not exist on
the concrete model (title).
baaeb34
@amenasse amenasse peg python-dateutil version in setup file. Fixes #5
versions of python-dateutil >=2.0 are incompatible with python2.x
6ba0e5b
@amenasse amenasse Merge branch 'bugs/issue7' into bugs/issue11 a370d5a
@amenasse amenasse variations_count() no longer crashes if 'varied_by' is not defined. F…
…ixes #11
4596ac1
@glamkit glamkit merged commit 545f11a into glamkit:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 1, 2011
  1. @amenasse

    peg version of python-dateutils. Fixes #5

    amenasse authored
    workaround for issue where vobjects setup.py is installing an incompatible
    version of python-dateutils
  2. @amenasse
  3. @amenasse

    change default ordering for EventVariationBase. Fixes #7

    amenasse authored
    EventVariationBase no longer orders on a field which may not exist on
    the concrete model (title).
Commits on Jul 4, 2011
  1. @amenasse

    peg python-dateutil version in setup file. Fixes #5

    amenasse authored
    versions of python-dateutil >=2.0 are incompatible with python2.x
Commits on Jul 12, 2011
  1. @amenasse
  2. @amenasse
This page is out of date. Refresh to see the latest.
View
2  eventtools/models/events.py
@@ -291,7 +291,7 @@ def variations_count(self):
"""
returns the number of variations that this event has
"""
- if self.__class__.varied_by:
+ if getattr(self.__class__,'varied_by',None):
try:
return self.variations.count()
except: # if none have been created, there is no such thing as self.variations, so return 0
View
2  eventtools/models/eventvariations.py
@@ -64,4 +64,4 @@ def __unicode__(self):
class Meta:
abstract = True
- ordering = ['unvaried_event__title', 'reason']
+ ordering = ['unvaried_event', 'reason']
View
4 eventtools/models/occurrencegenerators.py
@@ -382,7 +382,7 @@ def occurrences_after(self, after=None):
next = generator.next()
yield occ_replacer.get_occurrence(next)
- def save(self):
+ def save(self,*args,**kwargs):
# if the occurrence generator changes, we must not break the link with persisted occurrences
if self.id: # must already exist
saved_self = self.__class__.objects.get(pk=self.id)
@@ -411,5 +411,5 @@ def save(self):
occ.unvaried_end_time = unvaried_end.time()
occ.save()
- super(OccurrenceGeneratorBase, self).save()
+ super(OccurrenceGeneratorBase, self).save(*args,**kwargs)
View
21 eventtools/tests/test_models.py
@@ -514,3 +514,24 @@ def _test_combo(result, first_start_date, repeat_until=None, rule=weekly):
rule=None,
result=0
)
+
+
+ def test_clean_with_variation(self):
+ """ a model with variations defined can be cleaned """
+
+ evt = BroadcastEvent.objects.create(presenter = "Jimmy McBigmouth", studio=2)
+
+ #have we got the FKs in place
+ self.assertTrue(hasattr(BroadcastEventVariation, 'unvaried_event'))
+ self.assertTrue(hasattr(evt, 'variations'))
+ # let's try it out
+ var_event = evt.create_variation(presenter = "Amy Sub")
+ evt.full_clean()
+
+ def test_clean_with_no_varied_event_defined(self):
+ """ a model with no variations defined can be cleaned """
+
+ subject = 'Effective Time Management for Django Programmers'
+ lesson = LessonEvent.objects.create(subject=subject)
+ self.assertFalse(hasattr(lesson,'variations'))
+ lesson.full_clean()
View
4 requirements.txt
@@ -1,2 +1,4 @@
django-countries==1.0.3
-vobject==0.8.1c
+# need to use python-dateutil <2.x for python2.x
+python-dateutil==1.5
+vobject==0.8.1c
View
2  setup.py
@@ -20,7 +20,7 @@
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Utilities'],
- install_requires=['setuptools', 'vobject', 'python-dateutil'],
+ install_requires=['setuptools', 'vobject', 'python-dateutil==1.5'],
license='BSD',
test_suite = "eventtools.tests",
)
Something went wrong with that request. Please try again.