class Notification(models.Model):
user = models.ForeignKey(User)
createdAt = models.DateTimeField(auto_now_add=True, blank=True)
read = models.BooleanField(default=False, blank=True)
class Meta:
abstract = True
class RegularNotification(Notification):
message = models.CharField(max_length=150)
link = models.CharField(max_length=100)
class FNotification(Notification):
# same as Notification
pass
Wenn ich python manage.py makemigrations
tun, das ist, was es sagt:
Migrations for 'CApp':
0019_auto_20151202_2228.py:
- Create model RegularNotification
- Create model FNotification
- Remove field user from notification
- Add field f_request to userextended
- Delete model Notification
Erstens, es ist seltsam, dass es sagt Remove field user from notification
weil user
noch in meinem Notiication
Modell ist (Wenn also irgendjemand herausfinden kann, warum es sagt "Entfernen des Feldbenutzers von der Benachrichtigung", wäre das großartig!), aber nichtsdestotrotz, wenn ich weitergehe und versuche, python manage.py migrate
zu tun, bekomme ich diese Nachricht:
Applying CMApp.0019_auto_20151202_2228... OK
The following content types are stale and need to be deleted:
CApp | notification
Any objects related to these content types by a foreign key will also
be deleted. Are you sure you want to delete these content types?
If you're unsure, answer 'no'.
Type 'yes' to continue, or 'no' to cancel: no
Ich tippte no
. Aber was genau bedeutet das, warum bekomme ich diese Nachricht und wie mache ich es so, dass ich diese Nachricht nicht benötige?
Ich habe das, weil ich vergessen habe, die letzte Festschreibung des Repository zu ziehen. Meine letzte lokale Migration war nicht die neueste im Repository. : P Ich habe den Ferncode gezogen, ich habe die Migrationen erneut durchgeführt und ich habe wie ein Zauberer gearbeitet. – joaorodr84