I've been searching around for how to do this an di think i broke my table
I tried adding
dealership = models.ForeignKey('Employee', null=True)
To the field to the models.py, since I noticed thats where my other column fields were, and now the entire table is gone.
After some more research I saw that its supposed to be added to the migrations location and then run
$ python models.py migrations
Heres the model I want to add it to
## Gate access log - receives from RPi via API
##
class Eventlog(models.Model):
ENTRY = 1
EXIT = 2
EVENT_CHOICES = (
(ENTRY, 'Entry'),
(EXIT, 'Exit'),
)
event = models.PositiveSmallIntegerField(choices=EVENT_CHOICES)
employee = models.ForeignKey('Employee', null=True)
timestamp = models.DateTimeField(auto_now_add=True)
status = models.BooleanField(default=True, help_text="Whether the employee was granted access")
def __unicode__(self):
return self.timestamp
def __str__(self):
return self.timestamp
and as the comment suggests, it pulls the from a raspberry pi through an api
My question is how do I properly add the column, the db already has the information for the column data I can't imagine it's that difficult to simply pull that info and how do I get my table back? The table seems to have vanished after I added to the models.py manually and when I tried undoing it just never came back.