I am pretty new to south. I am working off of a friends project, and he seems to already have done some migrations.
I have a model and I am trying to to add an additional ManyToMany field to it. This is the class with owned_geofences
being the field I am trying to add:
class UserProfile(models.Model):
owned_beacons = models.ManyToManyField(
Beacon,
blank=True,
null=True,
related_name='owned_beacons'
)
#trying to add this one below
owned_goefences = models.ManyToManyField(
Geofence,
blank=True,
null=True,
related_name='owned_geofences'
)
The app is named 'profile'. First I did this:
$ sudo python manage.py schemamigration profile --auto
+ Added M2M table for owned_goefences on profile.UserProfile
Created 0007_auto.py. You can now apply this migration with: ./manage.py migrate profile
Cool it seems to have worked. Then I did this:
$ python manage.py migrate profile
Running migrations for profile:
- Migrating forwards to 0007_auto.
> profile:0007_auto
- Loading initial data for profile.
Installed 0 object(s) from 0 fixture(s)
Okay. Now It should be working right?
Well, it does seem to have worked. I ran some tests and..
>>> user = User.objects.get(pk=1)
<User: nick>
# just to test if user is working properly
>>> user.get_profile().owned_beacons
<django.db.models.fields.related.ManyRelatedManager object at 0x1104e7d50>
# this is the one that isn't working
>>> user.get_profile().owned_geofences
AttributeError: 'UserProfile' object has no attribute 'owned_geofences'
On top of that, out of curiousity I ran:
$ python manage.py syncdb
Syncing...
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
Synced:
> django.contrib.auth
> django.contrib.contenttypes
> django.contrib.sessions
> django.contrib.sites
> django.contrib.messages
> django.contrib.staticfiles
> django.contrib.admin
> django.contrib.admindocs
> south
Not synced (use migrations):
- pp.apps.careers
- pp.apps.contact
- pp.apps.geofencemanager
- pp.apps.locationmanager
- pp.apps.messagemanager
- django_extensions
- pp.profile
- pp.apps.beaconmanager
(use ./manage.py migrate to migrate these)
Why aren't these synced? I thought I was messing up something so I took the advice above and ran:
$ python manage.py migrate
Running migrations for careers:
- Nothing to migrate.
#etc for all of them
Can someone please shed some light on what is going on here?