Permalink
Browse files

enabled de/active locations

  • Loading branch information...
CarlFK committed Mar 29, 2011
1 parent 2b6b142 commit 54fa5d22b4d3335365b6db307a020817970864c2
Showing with 12 additions and 9 deletions.
  1. +1 −0 archive/pycon2010.json
  2. +7 −5 dj/main/models.py
  3. +4 −4 dj/main/views.py
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -44,8 +44,8 @@ class Meta:
class Location(models.Model):
sequence = models.IntegerField(default=1)
- ## hostname because dvs-mon defaults to saving data in the same dirname
- # active = models.BooleanField(help_text="Turn off to hide from UI.")
+ hostname because dvs-mon defaults to saving data in the same dirname
+ active = models.BooleanField(help_text="Turn off to hide from UI.")
default = models.BooleanField(default=True,
help_text="Adds this loc to new Clients.")
name = models.CharField(max_length=135,
@@ -113,13 +113,14 @@ def __unicode__(self):
class Episode(models.Model):
show = models.ForeignKey(Show)
location = models.ForeignKey(Location, null=True)
+ active = models.BooleanField(help_text="Turn off to hide from UI.")
state = models.IntegerField(null=True, blank=True,
choices=STATES, default=STATES[1][0],
help_text="2=ready to encode, 4=ready to post, 5=tweet" )
locked = models.DateTimeField(null=True, blank=True,
- help_text="clear this to unlock")
+ help_text="clear this to unlock")
locked_by = models.CharField(max_length=35, blank=True,
- help_text="user/process that locked." )
+ help_text="user/process that locked." )
sequence = models.IntegerField(null=True,blank=True,
help_text="process order")
start = models.DateTimeField(blank=True, null=True,
@@ -226,7 +227,7 @@ class Log(models.Model):
ready = models.DateTimeField()
start = models.DateTimeField(null=True, blank=True)
end = models.DateTimeField(null=True, blank=True)
- # user = models.CharField(max_length=50)
+ user = models.CharField(max_length=50)
result = models.CharField(max_length=250)
def set_slug(sender, instance, **kwargs):
@@ -244,6 +245,7 @@ def set_end(sender, instance, **kwargs):
pre_save.connect(set_slug,sender=Location)
pre_save.connect(set_slug,sender=Episode)
+
pre_save.connect(set_end,sender=Episode)
pre_save.connect(set_end,sender=Raw_File)
View
@@ -526,7 +526,7 @@ class Meta:
pass
# print form.errors
else:
- locations=Location.objects.filter(default=True).order_by('sequence')
+ locations=Location.objects.filter(active=True).order_by('sequence')
form=Show_Form(
initial={'client':client.id, 'sequence':1,
'locations': [o.pk for o in locations] })
@@ -558,10 +558,10 @@ def show_stats(request, show_id, ):
show=get_object_or_404(Show,id=show_id)
client=show.client
- episodes=Episode.objects.filter(show=show,location__default=True)
+ episodes=Episode.objects.filter(show=show,location__active=True)
locked=Episode.objects.filter(show=show, locked__isnull=False).order_by('locked')
raw_files=Raw_File.objects.filter(show=show)
- locations=show.locations.filter(default=True).order_by('sequence')
+ locations=show.locations.filter(active=True).order_by('sequence')
empty_stat = {'count':0,'minutes':0,
'start':None, 'end':None, 'states':[0]*len(STATES),
@@ -720,7 +720,7 @@ def episodes(request, client_slug=None, show_slug=None, location_slug=None,
# start_day = request.REQUEST.get('start_day')
# state = request.REQUEST.get('state')
# raise Exception((client_slug, show_slug, state, start_day, location_slug))
- locations=show.locations.filter(default=True).order_by('sequence')
+ locations=show.locations.filter(active=True).order_by('sequence')
episodes=Episode.objects.filter(show=show).order_by('sequence')
kwargs = {'location': location_slug, 'start__day':start_day, 'state':state}

0 comments on commit 54fa5d2

Please sign in to comment.