how to update image in django

Solutions on MaxInterview for how to update image in django by the best coders in the world

showing results for - "how to update image in django"
Marie
23 Nov 2019
1from __future__ import unicode_literals
2
3from django.db import models
4from django.core.urlresolvers import reverse
5
6class Server(models.Model):
7    name = models.CharField(max_length=200)
8ip = models.GenericIPAddressField()
9order = models.IntegerField()
10image = models.FileField(upload_to='pics/',default='download.jpg') 
11
12def __unicode__(self):
13    return self.name
14
15def get_absolute_url(self):
16    return reverse('server_edit', kwargs={'pk': self.pk})