A calendar app for Django (inprogress refactor of https://github.com/thauber/django-schedule)
guys please help
i have to compare between 2 data models
STATUS_CHOICES = (
('P', 'Paid'),
('U', 'UNPAID'),
)
class Location(models.Model):
place = models.CharField(max_length=120 , null=True)
def str(self):
return self.place
class Users(models.Model):
# this function has to compare the date in updated and the date after 30 day
# if date in expery is greater than the date in updated >=30 days
# status have to change to unpaid
# the codes below are not correct of course
#def now_plus_30():
# return datetime.now() + timedelta(days = 30)
location = models.ForeignKey(Location , null=True)
name = models.CharField(max_length=60)
phone_number = models.IntegerField(default=0)
price = models.PositiveIntegerField(blank=True)
status = models.CharField(max_length=1, choices=STATUS_CHOICES , default="U")
descrition = models.TextField(help_text="just to try it with the get_description def")
timestamp = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(default=now)
expiry = models.DateTimeField(default=now_plus_30())
class AbstractEvent(models.Model):
jira_issue = models.CharField(max_length=20, default='NOTSYNCED')
Applying schedule.0006_auto_20171018_1520...Traceback (most recent call last):
File "/home/gonzalo/VirtualEnvs/apcela_web_project/lib/python3.5/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/home/gonzalo/VirtualEnvs/apcela_web_project/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 101, in execute
return self.cursor.execute(query, args)
File "/home/gonzalo/VirtualEnvs/apcela_web_project/lib/python3.5/site-packages/MySQLdb/cursors.py", line 250, in execute
self.errorhandler(self, exc, value)
File "/home/gonzalo/VirtualEnvs/apcela_web_project/lib/python3.5/site-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
raise errorvalue
File "/home/gonzalo/VirtualEnvs/apcela_web_project/lib/python3.5/site-packages/MySQLdb/cursors.py", line 247, in execute
res = self._query(query)
File "/home/gonzalo/VirtualEnvs/apcela_web_project/lib/python3.5/site-packages/MySQLdb/cursors.py", line 411, in _query
rowcount = self._do_query(q)
File "/home/gonzalo/VirtualEnvs/apcela_web_project/lib/python3.5/site-packages/MySQLdb/cursors.py", line 374, in _do_query
db.query(q)
File "/home/gonzalo/VirtualEnvs/apcela_web_project/lib/python3.5/site-packages/MySQLdb/connections.py", line 277, in query
_mysql.connection.query(self, query)
_mysql_exceptions.OperationalError: (1829, "Cannot drop column 'id': needed in a foreign key constraint 'schedule_eventrelation_event_id_8c57a7b4_fk_schedule_event_id' of table 'apcela_web_app.schedule_eventrelation'")