Esempio n. 1
0
        abstract = True

    def __unicode__(self):
        return self.cf

    class Meta:
        verbose_name = _('skilled worker')
        verbose_name_plural = _('skilled workers')

def update_item(instance, raw, created, **kwargs):
    if isinstance(instance, SkilledWorker):
        if created:
            item = Worker()
            item.cf = instance.cf
            item.content_type = ContentType.objects.get_for_model(type(instance))
            item.object_id = instance.id
        else:
            item = instance.item.all()[0]
        item.save()

post_save.connect(update_item)

class SkillGroup(AbstractSchema):
    class Meta:
        verbose_name = _('skill group')
        verbose_name_plural = _('skill groups')

register(
    schema = SkillGroup,
    entity = SkilledWorker,
)