I have a class Video whose structure is as below:
class Video(models.Model):
video = models.FileField(upload_to="media_items/video", blank=True)
video_mp4 = models.CharField(blank=True, max_length=500)
def __unicode__(self):
return unicode(self.video.name) or u''
and signals.py is as
@receiver(post_save, sender = Video)
def insert_video_mp4(sender, instance, created, **kwargs):
if os.path.exists(created_path):
#some code
else:
#some code to insert value in video_mp4 column
I want to update the value of video_mp4 as explained above in post_save signals. Please let me know how to achieve this. I am getting the below error
RuntimeError at /admin/blog/video/8/change/
maximum recursion depth exceeded while calling a Python object
Request Method: POST
Request URL: http://localhost:8000/admin/blog/video/8/change/
Django Version: 1.10.5
Exception Type: RuntimeError
Exception Value:
maximum recursion depth exceeded while calling a Python object
Exception Location: /Users/anaconda2/lib/python2.7/site-packages/django/db/models/fields/__init__.py in __eq__, line 462
Python Executable: /Users/anaconda2/bin/python
Python Version: 2.7.15
Python Path:
['/Users/TechnopleSolutions/Desktop/matrix-server-master',
'/Users/anaconda2/lib/python27.zip',
'/Users/anaconda2/lib/python2.7',
'/Users/anaconda2/lib/python2.7/plat-darwin',
'/Users/anaconda2/lib/python2.7/plat-mac',
'/Users/anaconda2/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/anaconda2/lib/python2.7/lib-tk',
'/Users/anaconda2/lib/python2.7/lib-old',
'/Users/anaconda2/lib/python2.7/lib-dynload',
'/Users/anaconda2/lib/python2.7/site-packages',
'/Users/anaconda2/lib/python2.7/site-packages/aeosa']