This repository has been archived by the owner on Dec 9, 2019. It is now read-only.
forked from howiworkdaily/django-freetext
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This removes the constraint on slugs since they should be enforced o site basis. This is done right now using the m2m_changed signal and model validation.
- Loading branch information
Showing
7 changed files
with
148 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# -*- 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): | ||
# Removing unique constraint on 'FlatBlock', fields ['slug'] | ||
db.delete_unique('flatblocks_flatblock', ['slug']) | ||
|
||
# Adding M2M table for field sites on 'FlatBlock' | ||
db.create_table('flatblocks_flatblock_sites', ( | ||
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), | ||
('flatblock', models.ForeignKey(orm['flatblocks.flatblock'], null=False)), | ||
('site', models.ForeignKey(orm['sites.site'], null=False)) | ||
)) | ||
db.create_unique('flatblocks_flatblock_sites', ['flatblock_id', 'site_id']) | ||
|
||
def backwards(self, orm): | ||
# Removing M2M table for field sites on 'FlatBlock' | ||
db.delete_table('flatblocks_flatblock_sites') | ||
|
||
# Adding unique constraint on 'FlatBlock', fields ['slug'] | ||
db.create_unique('flatblocks_flatblock', ['slug']) | ||
|
||
models = { | ||
'flatblocks.flatblock': { | ||
'Meta': {'object_name': 'FlatBlock'}, | ||
'content': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), | ||
'header': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), | ||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'sites': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sites.Site']", 'symmetrical': 'False'}), | ||
'slug': ('django.db.models.fields.CharField', [], {'max_length': '255'}) | ||
}, | ||
'sites.site': { | ||
'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"}, | ||
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) | ||
} | ||
} | ||
|
||
complete_apps = ['flatblocks'] |
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,6 +1,7 @@ | ||
<h1>Edit "{{ flatblock.slug }}"</h1> | ||
|
||
<form method="post"> | ||
{% csrf_token %} | ||
{{ form.as_p }} | ||
<input type="submit" value="Save" /> | ||
</form> |
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
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