コード例 #1
0
    def save(self, *args, **kwargs):
        self.path = Subsection.build_path(self.key, self.section)
        self.uri = get_uri_prefix(self) + '/questions/' + self.path

        super(Subsection, self).save(*args, **kwargs)

        for entity in self.entities.all():
            entity.save()
コード例 #2
0
    def save(self, *args, **kwargs):
        self.path = Section.build_path(self.key, self.catalog)
        self.uri = get_uri_prefix(self) + '/questions/' + self.path

        super(Section, self).save(*args, **kwargs)

        for subsection in self.subsections.all():
            subsection.save()
コード例 #3
0
    def save(self, *args, **kwargs):
        try:
            self.path = QuestionEntity.build_path(self.key, self.subsection,
                                                  self.parent)
        except AttributeError:
            self.path = QuestionEntity.build_path(self.key, self.subsection)

        self.uri = get_uri_prefix(self) + '/questions/' + self.path

        super(QuestionEntity, self).save(*args, **kwargs)

        for question in self.questions.all():
            question.save()

        # invalidate the cache so that changes appear instantly
        caches['api'].clear()
コード例 #4
0
ファイル: models.py プロジェクト: skelligan/rdmo
    def save(self, *args, **kwargs):
        self.path = AttributeEntity.build_path(self.key, self.parent)
        self.uri = get_uri_prefix(self) + '/domain/' + self.path
        self.is_attribute = self.is_attribute or False

        # loop over parents to find parent collection
        self.parent_collection = None
        parent = self.parent
        while parent:
            # set parent_collection if it is not yet set and if parent is a collection
            if not self.parent_collection and parent.is_collection:
                self.parent_collection = parent
                break

            parent = parent.parent

        super(AttributeEntity, self).save(*args, **kwargs)

        # recursively save children
        for child in self.children.all():
            child.save()
コード例 #5
0
 def build_uri(self):
     return get_uri_prefix(self) + '/tasks/' + self.key
コード例 #6
0
 def build_uri(self):
     return get_uri_prefix(self) + '/conditions/' + self.key
コード例 #7
0
    def save(self, *args, **kwargs):
        self.uri = get_uri_prefix(self) + '/questions/%s' % self.key
        super(Catalog, self).save(*args, **kwargs)

        for section in self.sections.all():
            section.save()
コード例 #8
0
    def save(self, *args, **kwargs):
        self.uri = get_uri_prefix(self) + '/options/' + self.label
        super(OptionSet, self).save(*args, **kwargs)

        for option in self.options.all():
            option.save()
コード例 #9
0
    def save(self, *args, **kwargs):
        self.path = Option.build_path(self.key, self.optionset)
        self.uri = get_uri_prefix(self) + '/options/' + self.path

        super(Option, self).save(*args, **kwargs)