-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from ambitioninc/develop
Dynamic initial data supports deletions
- Loading branch information
Showing
16 changed files
with
582 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# flake8: noqa | ||
from .version import __version__ | ||
from .base import BaseInitialData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# -*- coding: utf-8 -*- | ||
import datetime | ||
from south.db import db | ||
from south.v2 import SchemaMigration | ||
from django.db import models | ||
|
||
|
||
class Migration(SchemaMigration): | ||
|
||
def forwards(self, orm): | ||
# Adding model 'RegisteredForDeletionReceipt' | ||
db.create_table(u'dynamic_initial_data_registeredfordeletionreceipt', ( | ||
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), | ||
('model_obj_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])), | ||
('model_obj_id', self.gf('django.db.models.fields.PositiveIntegerField')()), | ||
('register_time', self.gf('django.db.models.fields.DateTimeField')()), | ||
)) | ||
db.send_create_signal(u'dynamic_initial_data', ['RegisteredForDeletionReceipt']) | ||
|
||
|
||
def backwards(self, orm): | ||
# Deleting model 'RegisteredForDeletionReceipt' | ||
db.delete_table(u'dynamic_initial_data_registeredfordeletionreceipt') | ||
|
||
|
||
models = { | ||
u'contenttypes.contenttype': { | ||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, | ||
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) | ||
}, | ||
u'dynamic_initial_data.registeredfordeletionreceipt': { | ||
'Meta': {'object_name': 'RegisteredForDeletionReceipt'}, | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'model_obj_id': ('django.db.models.fields.PositiveIntegerField', [], {}), | ||
'model_obj_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), | ||
'register_time': ('django.db.models.fields.DateTimeField', [], {}) | ||
} | ||
} | ||
|
||
complete_apps = ['dynamic_initial_data'] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from django.contrib.contenttypes import generic | ||
from django.contrib.contenttypes.models import ContentType | ||
from django.db import models | ||
from manager_utils import ManagerUtilsManager | ||
|
||
|
||
class RegisteredForDeletionReceipt(models.Model): | ||
""" | ||
Specifies a receipt of a model object that was registered for deletion by the dynamic | ||
initial data process. | ||
""" | ||
# The model object that was registered | ||
model_obj_type = models.ForeignKey(ContentType) | ||
model_obj_id = models.PositiveIntegerField() | ||
model_obj = generic.GenericForeignKey('model_obj_type', 'model_obj_id') | ||
|
||
# The time at which it was registered for deletion | ||
register_time = models.DateTimeField() | ||
|
||
# Use manager utils for bulk updating capabilities | ||
objects = ManagerUtilsManager() |
Oops, something went wrong.