kopia lustrzana https://github.com/wagtail/wagtail
Removing redundant RCA references
rodzic
c548b391d5
commit
866f4897d2
|
@ -41,7 +41,6 @@ class Migration(SchemaMigration):
|
|||
'Meta': {'object_name': 'Page'},
|
||||
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'pages'", 'to': u"orm['contenttypes.ContentType']"}),
|
||||
'depth': ('django.db.models.fields.PositiveIntegerField', [], {}),
|
||||
'feed_image': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': u"orm['rca.RcaImage']"}),
|
||||
'has_unpublished_changes': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'live': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
||||
|
@ -61,24 +60,6 @@ class Migration(SchemaMigration):
|
|||
'port': ('django.db.models.fields.IntegerField', [], {'default': '80'}),
|
||||
'root_page': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'sites_rooted_here'", 'to': u"orm['wagtailcore.Page']"})
|
||||
},
|
||||
u'rca.rcaimage': {
|
||||
'Meta': {'object_name': 'RcaImage'},
|
||||
'alt': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
|
||||
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'creator': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
|
||||
'dimensions': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
|
||||
'eprint_docid': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
|
||||
'file': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}),
|
||||
'height': ('django.db.models.fields.IntegerField', [], {}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'medium': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
|
||||
'permission': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
|
||||
'photographer': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
|
||||
'rca_content_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
|
||||
'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||
'width': ('django.db.models.fields.IntegerField', [], {}),
|
||||
'year': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'})
|
||||
},
|
||||
u'taggit.tag': {
|
||||
'Meta': {'object_name': 'Tag'},
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
|
|
|
@ -18,8 +18,8 @@ class Command(NoArgsCommand):
|
|||
|
||||
# Add all objects to object set and detect any duplicates
|
||||
# Duplicates are caused when both a model and a derived model are indexed
|
||||
# Eg, StudentPage inherits from Page and both of these models are indexed
|
||||
# If we were to add all objects from both models into the index, all the StudentPages will have two entries
|
||||
# Eg, if BlogPost inherits from Page and both of these models are indexed
|
||||
# If we were to add all objects from both models into the index, all the BlogPosts will have two entries
|
||||
for model in indexed_models:
|
||||
# Get toplevel content type
|
||||
toplevel_content_type = model.indexed_get_toplevel_content_type()
|
||||
|
@ -28,7 +28,7 @@ class Command(NoArgsCommand):
|
|||
for obj in model.objects.all():
|
||||
# Check if this object has an "object_indexed" function
|
||||
if hasattr(obj, "object_indexed"):
|
||||
if obj.object_indexed() == False:
|
||||
if obj.object_indexed() is False:
|
||||
continue
|
||||
|
||||
# Get key for this object
|
||||
|
@ -38,7 +38,7 @@ class Command(NoArgsCommand):
|
|||
if key in object_set:
|
||||
# Conflict, work out who should get this space
|
||||
# The object with the longest content type string gets the space
|
||||
# Eg, "wagtailcore.Page-rca.StudentPage" kicks out "wagtailcore.Page"
|
||||
# Eg, "wagtailcore.Page-myapp.BlogPost" kicks out "wagtailcore.Page"
|
||||
if len(obj.indexed_get_content_type()) > len(object_set[key].indexed_get_content_type()):
|
||||
# Take the spot
|
||||
object_set[key] = obj
|
||||
|
|
Ładowanie…
Reference in New Issue