Ejemplo n.º 1
0
    # Inherited from vera.BaseReport:
    #   event = models.ForeignKey(Event)
    #   entered = models.DateTimeField()
    #   user = models.ForeignKey('auth.User')
    #   status = models.ForeignKey('vera.ReportStatus')


class Parameter(vera.BaseParameter):
    campaign = models.ForeignKey(Campaign, related_name='parameters')
    description = models.TextField()

    # Inherited from vera.BaseParameter:
    #   name = models.CharField()
    #   is_numeric = models.BooleanField()
    #   units = models.CharField()

    class Meta:
        ordering = ['pk']


# Other vera models (not overridden in this project):
#    vera.Site
#    vera.ReportStatus
#    vera.Result

EventResult = vera.create_eventresult_model(Event, vera.Result)

reversion.register(patterns.Identifier)
reversion.register(Parameter, follow=['identifiers'])
reversion.register(Campaign, follow=['parameters'])
Ejemplo n.º 2
0
class Event(BaseEvent):
    type = models.CharField(max_length=10, null=True, blank=True)
    date = models.DateField()

    def __str__(self):
        return "%s on %s%s" % (
            self.site, self.date, "(%s)" % self.type if self.type else ""
        )

    class Meta:
        unique_together = ("site", "date", "type")
        ordering = ('-date', 'type')


EventResult = create_eventresult_model(Event, Result)


@receiver(import_complete)
def on_import_complete(sender, instance=None, status=None, **kwargs):
    if not instance:
        return
    instance.completed = now()
    instance.save()


@receiver(new_metadata)
def on_new_metadata(sender, instance=None, object=None, identifier=None,
                    **kwargs):
    if not instance or not object or not identifier:
        return
Ejemplo n.º 3
0

class Event(BaseEvent):
    type = models.CharField(max_length=10, null=True, blank=True)
    date = models.DateField()

    def __str__(self):
        return "%s on %s%s" % (self.site, self.date,
                               "(%s)" % self.type if self.type else "")

    class Meta:
        unique_together = ("site", "date", "type")
        ordering = ('-date', 'type')


EventResult = create_eventresult_model(Event, Result)


@receiver(import_complete)
def on_import_complete(sender, instance=None, status=None, **kwargs):
    if not instance:
        return
    instance.completed = now()
    instance.save()


@receiver(new_metadata)
def on_new_metadata(sender,
                    instance=None,
                    object=None,
                    identifier=None,