Django condition in save method

I got storage places which have the field amount and article. If I call save() on one place I want to set the article field to None. What is the best approach for this?

I already tried this:

    def save(self, *args, **kwargs):
    if self.amount == 0:
        self.article = None
    super(LagerPlace, self).save(*args, **kwargs)


from Recent Questions - Stack Overflow https://ift.tt/3ynx6hw
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation