I have a class with a variable called available and other isActive

I'm just starting in django. I have a class with a variable called available = models.CharField(max_length=20) and other isActive = models.BooleanField(default=True). I'd like to be able to get the word "unavailable" in the available field if isActive is False. thanks

listingData = Listing.objects.get(pk=id)    
if listingData.isActive == False:
    Listing.available = "unavailable"
listingData = Listing.objects.get(pk=id)    
if listingData.isActive == False:
    listingData.available = "unavailable"
    listingData.save()
Back to Top