'Django form class Variables not updating from signals
I'm having a strange issue where it looks like my form is initially built on startup. I've got a variable that changes within it called location, and I can't get it to update properly. I have confirmed that the variable is updated properly via signals, so I just need to get the form to update somehow. Here's the code of the class based form:
class Post(models.Model):
Priority_Upload = models.FileField(default='priority', upload_to=Profile.location, blank=True, null=True)
date_posted = models.DateTimeField(default=timezone.now)
author = models.ForeignKey(User, on_delete=models.CASCADE, related_name='+')
def __str__(self):
return self.title
def get_absolute_url(self):
return reverse('post-detail', kwargs={'pk': self.pk})
The variable that I have changed is Profile.location. It is initialized in profile as an empty string, "". I change it when the user logs in and on post updates, and in other parts of the code the variable is confirmed to be different. It just looks like when I define my class Post, it does it once and I can't figure out how to update it. Any help would be greatly appreciated. Thank you for your time in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|