Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
5489819f
Commit
5489819f
authored
Jul 06, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started writing slug uniquifying data migration. Doesn't work yet.
parent
6d7b4779
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
139 additions
and
0 deletions
+139
-0
lms/djangoapps/simplewiki/migrations/0002_unique_slugs.py
+139
-0
lms/djangoapps/simplewiki/migrations/0003_auto__add_namespace__del_field_article_parent__add_field_article_names.py
+0
-0
lms/djangoapps/simplewiki/migrations/0004_multicourse_data_migration.py
+0
-0
lms/djangoapps/simplewiki/migrations/0005_auto__add_unique_namespace_name.py
+0
-0
lms/djangoapps/simplewiki/migrations/0006_auto.py
+0
-0
No files found.
lms/djangoapps/simplewiki/migrations/0002_unique_slugs.py
0 → 100644
View file @
5489819f
# -*- coding: utf-8 -*-
import
datetime
from
south.db
import
db
from
south.v2
import
DataMigration
from
django.db
import
models
class
Migration
(
DataMigration
):
def
forwards
(
self
,
orm
):
# We collect every article slug in a set. Any time we see a duplicate, we change the duplicate's name
unique_slugs
=
set
()
for
article
in
orm
.
Article
.
objects
.
all
():
if
article
.
slug
in
unique_slugs
:
i
=
2
new_name
=
article
.
slug
+
str
(
i
)
while
new_name
in
unique_slugs
:
i
+=
1
new_name
=
article
.
slug
+
str
(
i
)
article
.
slug
=
new_name
article
.
save
()
unique_slugs
.
add
(
article
.
slug
)
def
backwards
(
self
,
orm
):
"Write your backwards methods here."
models
=
{
'auth.group'
:
{
'Meta'
:
{
'object_name'
:
'Group'
},
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'unique'
:
'True'
,
'max_length'
:
'80'
}),
'permissions'
:
(
'django.db.models.fields.related.ManyToManyField'
,
[],
{
'to'
:
"orm['auth.Permission']"
,
'symmetrical'
:
'False'
,
'blank'
:
'True'
})
},
'auth.permission'
:
{
'Meta'
:
{
'ordering'
:
"('content_type__app_label', 'content_type__model', 'codename')"
,
'unique_together'
:
"(('content_type', 'codename'),)"
,
'object_name'
:
'Permission'
},
'codename'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
}),
'content_type'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'to'
:
"orm['contenttypes.ContentType']"
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'50'
})
},
'auth.user'
:
{
'Meta'
:
{
'object_name'
:
'User'
},
'about'
:
(
'django.db.models.fields.TextField'
,
[],
{
'blank'
:
'True'
}),
'avatar_type'
:
(
'django.db.models.fields.CharField'
,
[],
{
'default'
:
"'n'"
,
'max_length'
:
'1'
}),
'bronze'
:
(
'django.db.models.fields.SmallIntegerField'
,
[],
{
'default'
:
'0'
}),
'consecutive_days_visit_count'
:
(
'django.db.models.fields.IntegerField'
,
[],
{
'default'
:
'0'
}),
'country'
:
(
'django_countries.fields.CountryField'
,
[],
{
'max_length'
:
'2'
,
'blank'
:
'True'
}),
'date_joined'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'date_of_birth'
:
(
'django.db.models.fields.DateField'
,
[],
{
'null'
:
'True'
,
'blank'
:
'True'
}),
'display_tag_filter_strategy'
:
(
'django.db.models.fields.SmallIntegerField'
,
[],
{
'default'
:
'0'
}),
'email'
:
(
'django.db.models.fields.EmailField'
,
[],
{
'max_length'
:
'75'
,
'blank'
:
'True'
}),
'email_isvalid'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'False'
}),
'email_key'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'32'
,
'null'
:
'True'
}),
'email_tag_filter_strategy'
:
(
'django.db.models.fields.SmallIntegerField'
,
[],
{
'default'
:
'1'
}),
'first_name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'30'
,
'blank'
:
'True'
}),
'gold'
:
(
'django.db.models.fields.SmallIntegerField'
,
[],
{
'default'
:
'0'
}),
'gravatar'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'32'
}),
'groups'
:
(
'django.db.models.fields.related.ManyToManyField'
,
[],
{
'to'
:
"orm['auth.Group']"
,
'symmetrical'
:
'False'
,
'blank'
:
'True'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'ignored_tags'
:
(
'django.db.models.fields.TextField'
,
[],
{
'blank'
:
'True'
}),
'interesting_tags'
:
(
'django.db.models.fields.TextField'
,
[],
{
'blank'
:
'True'
}),
'is_active'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'True'
}),
'is_staff'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'False'
}),
'is_superuser'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'False'
}),
'last_login'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'last_name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'30'
,
'blank'
:
'True'
}),
'last_seen'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'location'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
,
'blank'
:
'True'
}),
'new_response_count'
:
(
'django.db.models.fields.IntegerField'
,
[],
{
'default'
:
'0'
}),
'password'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'128'
}),
'questions_per_page'
:
(
'django.db.models.fields.SmallIntegerField'
,
[],
{
'default'
:
'10'
}),
'real_name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
,
'blank'
:
'True'
}),
'reputation'
:
(
'django.db.models.fields.PositiveIntegerField'
,
[],
{
'default'
:
'1'
}),
'seen_response_count'
:
(
'django.db.models.fields.IntegerField'
,
[],
{
'default'
:
'0'
}),
'show_country'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'False'
}),
'silver'
:
(
'django.db.models.fields.SmallIntegerField'
,
[],
{
'default'
:
'0'
}),
'status'
:
(
'django.db.models.fields.CharField'
,
[],
{
'default'
:
"'w'"
,
'max_length'
:
'2'
}),
'user_permissions'
:
(
'django.db.models.fields.related.ManyToManyField'
,
[],
{
'to'
:
"orm['auth.Permission']"
,
'symmetrical'
:
'False'
,
'blank'
:
'True'
}),
'username'
:
(
'django.db.models.fields.CharField'
,
[],
{
'unique'
:
'True'
,
'max_length'
:
'30'
}),
'website'
:
(
'django.db.models.fields.URLField'
,
[],
{
'max_length'
:
'200'
,
'blank'
:
'True'
})
},
'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'
}),
'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'
})
},
'simplewiki.article'
:
{
'Meta'
:
{
'unique_together'
:
"(('slug', 'namespace'),)"
,
'object_name'
:
'Article'
},
'created_by'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'to'
:
"orm['auth.User']"
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'created_on'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'auto_now_add'
:
'1'
,
'blank'
:
'True'
}),
'current_revision'
:
(
'django.db.models.fields.related.OneToOneField'
,
[],
{
'blank'
:
'True'
,
'related_name'
:
"'current_rev'"
,
'unique'
:
'True'
,
'null'
:
'True'
,
'to'
:
"orm['simplewiki.Revision']"
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'locked'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'False'
}),
'modified_on'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'auto_now_add'
:
'1'
,
'blank'
:
'True'
}),
'namespace'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'to'
:
"orm['simplewiki.Namespace']"
}),
'permissions'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'to'
:
"orm['simplewiki.Permission']"
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'related'
:
(
'django.db.models.fields.related.ManyToManyField'
,
[],
{
'blank'
:
'True'
,
'related_name'
:
"'related_rel_+'"
,
'null'
:
'True'
,
'to'
:
"orm['simplewiki.Article']"
}),
'slug'
:
(
'django.db.models.fields.SlugField'
,
[],
{
'max_length'
:
'100'
,
'blank'
:
'True'
}),
'title'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'512'
})
},
'simplewiki.articleattachment'
:
{
'Meta'
:
{
'object_name'
:
'ArticleAttachment'
},
'article'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'to'
:
"orm['simplewiki.Article']"
}),
'file'
:
(
'django.db.models.fields.files.FileField'
,
[],
{
'max_length'
:
'255'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'uploaded_by'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'to'
:
"orm['auth.User']"
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'uploaded_on'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'auto_now_add'
:
'True'
,
'blank'
:
'True'
})
},
'simplewiki.namespace'
:
{
'Meta'
:
{
'object_name'
:
'Namespace'
},
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'unique'
:
'True'
,
'max_length'
:
'30'
,
'db_index'
:
'True'
})
},
'simplewiki.permission'
:
{
'Meta'
:
{
'object_name'
:
'Permission'
},
'can_read'
:
(
'django.db.models.fields.related.ManyToManyField'
,
[],
{
'blank'
:
'True'
,
'related_name'
:
"'read'"
,
'null'
:
'True'
,
'symmetrical'
:
'False'
,
'to'
:
"orm['auth.User']"
}),
'can_write'
:
(
'django.db.models.fields.related.ManyToManyField'
,
[],
{
'blank'
:
'True'
,
'related_name'
:
"'write'"
,
'null'
:
'True'
,
'symmetrical'
:
'False'
,
'to'
:
"orm['auth.User']"
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'permission_name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'255'
})
},
'simplewiki.revision'
:
{
'Meta'
:
{
'object_name'
:
'Revision'
},
'article'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'to'
:
"orm['simplewiki.Article']"
}),
'contents'
:
(
'django.db.models.fields.TextField'
,
[],
{}),
'contents_parsed'
:
(
'django.db.models.fields.TextField'
,
[],
{
'null'
:
'True'
,
'blank'
:
'True'
}),
'counter'
:
(
'django.db.models.fields.IntegerField'
,
[],
{
'default'
:
'1'
}),
'deleted'
:
(
'django.db.models.fields.IntegerField'
,
[],
{
'default'
:
'0'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'previous_revision'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'to'
:
"orm['simplewiki.Revision']"
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'revision_date'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'auto_now_add'
:
'True'
,
'blank'
:
'True'
}),
'revision_text'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'255'
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'revision_user'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'blank'
:
'True'
,
'related_name'
:
"'wiki_revision_user'"
,
'null'
:
'True'
,
'to'
:
"orm['auth.User']"
})
}
}
complete_apps
=
[
'simplewiki'
]
symmetrical
=
True
lms/djangoapps/simplewiki/migrations/000
2
_auto__add_namespace__del_field_article_parent__add_field_article_names.py
→
lms/djangoapps/simplewiki/migrations/000
3
_auto__add_namespace__del_field_article_parent__add_field_article_names.py
View file @
5489819f
File moved
lms/djangoapps/simplewiki/migrations/000
3
_multicourse_data_migration.py
→
lms/djangoapps/simplewiki/migrations/000
4
_multicourse_data_migration.py
View file @
5489819f
File moved
lms/djangoapps/simplewiki/migrations/000
4
_auto__add_unique_namespace_name.py
→
lms/djangoapps/simplewiki/migrations/000
5
_auto__add_unique_namespace_name.py
View file @
5489819f
File moved
lms/djangoapps/simplewiki/migrations/000
5
_auto.py
→
lms/djangoapps/simplewiki/migrations/000
6
_auto.py
View file @
5489819f
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment