Created
August 27, 2021 13:32
-
-
Save krishnaglodha/80549e781f8b2537ae7b8c985e51b038 to your computer and use it in GitHub Desktop.
saving jsPDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.contrib.auth.models import User | |
# Create your models here. | |
class receipt(models.Model): | |
title = models.CharField(max_length=50) | |
date_created = models.DateField(auto_now=True) | |
customer = models.OneToOneField(User, on_delete=models.CASCADE) | |
pdf = models.FileField(upload_to='receipts/') #pdf will be stored in receipts folder in media folder | |
def __str__(self): | |
return self.title |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MEDIA_DIR = os.path.join(BASE_DIR, 'media') | |
MEDIA_ROOT = MEDIA_DIR | |
MEDIA_URL = '/media/' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment