lundi 23 septembre 2019

How to store user files in django that are internally downloaded

So i am making a website where people can download and visualize some data that is downloaded from another website, and I can't figure out how to store this data in Django .Also the data should be stored separately for every user. And is in a folder format. Maybe i may have to make a model for it or something else. Pls help me

I havent tried to use the file system because i dont know how to store data that is internally downloaded from another website(isnt uploaded by the user).

from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import UserManager
from django.db import models
from django.contrib.auth import get_user_model
User_auth = get_user_model()

............

class GoogleFile(models.Model):
    user =  models.ForeignKey(User_auth, on_delete=models.CASCADE, 
    null=True)
    data = models.FileField(upload_to='user_google_data')

class FacebookFile(models.Model):
     user =  models.ForeignKey(User_auth, on_delete=models.CASCADE, 
     null=True)
     data = models.FileField(upload_to='user_facebook_data')



Aucun commentaire:

Enregistrer un commentaire