Exemplo n.º 1
0
    def create(self, validated_data):
        url_key = validated_data.pop('url_key', None)
        if url_key is not None and len(url_key) != 0:  # Let an empty string be null for the uniqueness constraint
            validated_data['url_key'] = url_key

        speaker = super().create(validated_data)

        if url_key is None:
            populate_url_keys([speaker])

        return speaker
Exemplo n.º 2
0
    def create(self, validated_data):
        url_key = validated_data.pop('url_key', None)
        if url_key is not None and len(url_key) != 0:  # Let an empty string be null for the uniqueness constraint
            validated_data['url_key'] = url_key

        adj = super().create(validated_data)

        if url_key is None:  # If explicitly null (and not just an empty string)
            populate_url_keys([adj])

        if adj.institution is not None:
            adj.adjudicatorinstitutionconflict_set.get_or_create(institution=adj.institution)

        return adj