This commit is contained in:
Mohamed Nouffer
2022-03-23 12:13:30 +05:30
parent c28fdbe2b2
commit dc99a6bac3
2 changed files with 27 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import csv
import codecs
import sys
import time
import uuid
env = environ.Env(DEBUG=(bool, False))
environ.Env.read_env(env_file=".env")
@ -311,9 +312,15 @@ def getMappingforModel(tbl, shp):
return LayerMapping(Location_polygon, shp, location_polygon_mapping, transform=False)
def get_file_path(instance, filename):
ext = filename.split('.')[-1]
filename = "%s.%s" % (uuid.uuid4(), ext)
return os.path.join('uploads/logos', filename)
class ShapeLayers(models.Model):
name = models.CharField(_("Shape Layer"), max_length=255)
file = models.FileField(upload_to='%y%m%d', blank=True)
file = models.FileField(upload_to=get_file_path, blank=True)
uploaded_date = models.DateField(auto_now_add=True)
layerof = models.IntegerField(choices=LAYER_CHOICES, default=1)
table_name = models.CharField(_("Table name"), max_length=255, blank=True)