django pull from google sheets

Solutions on MaxInterview for django pull from google sheets by the best coders in the world

showing results for - "django pull from google sheets"
Eric
18 Jan 2020
1from django.db import models
2from gsheets import mixins
3from uuid import uuid4
4
5class Person(mixins.SheetPullableMixin, models.Model):
6    spreadsheet_id = '18F_HLftNtaouHgA3fmfT2M1Va9oO-YWTBw2EDsuz8V4'
7    model_id_field = 'guid'
8
9    guid = models.CharField(primary_key=True, max_length=255, default=uuid4)
10
11    first_name = models.CharField(max_length=127)
12    last_name = models.CharField(max_length=127)
13    email = models.CharField(max_length=127, null=True, blank=True, default=None)
14    phone = models.CharField(max_length=127, null=True, blank=True, default=None)
15
16    def __str__(self):
17        return f'{self.first_name} {self.last_name} // {self.email} ({self.guid})'