Merge pull request #61 from nitely/experimental

v0.4.0
This commit is contained in:
Esteban Castro Borsani 2015-07-28 02:40:00 -03:00
commit 10382b530c
78 changed files with 290 additions and 2258 deletions

View File

@ -1,3 +1,9 @@
0.4.0
==================
* Removed old migrations.
* Removed `spirit` app, it has been decoupled into many apps.
0.3.0
==================

View File

@ -54,7 +54,7 @@ Visit (http://127.0.0.1:8000/)
## Upgrading
Detailed upgrade instructions are listed in [Upgrading Spirit](https://github.com/nitely/Spirit/wiki/Upgrading#from-v02-to-v03)
Detailed upgrade instructions are listed in [Upgrading Spirit](https://github.com/nitely/Spirit/wiki/Upgrading)
## Testing

View File

@ -15,7 +15,7 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-spirit',
version='0.3.0',
version='0.4.0',
description='Spirit is a Python based forum powered by Django.',
author='Esteban Castro Borsani',
author_email='ecastroborsani@gmail.com',

View File

@ -2,8 +2,4 @@
from __future__ import unicode_literals
# TODO: check django User.count >= spirit custom.User.count
# in the migration to remove that table/model (Spirit v0.4)
__version__ = '0.3.0'
default_app_config = 'spirit.apps.SpiritConfig'
__version__ = '0.4.0'

View File

@ -10,3 +10,12 @@ class SpiritAdminConfig(AppConfig):
name = 'spirit.admin'
verbose_name = "Spirit Admin"
label = 'spirit_admin'
def ready(self):
self.register_config()
def register_config(self):
import djconfig
from .forms import BasicConfigForm
djconfig.register(BasicConfigForm)

View File

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class SpiritConfig(AppConfig):
# TODO: remove this in spirit 0.4
name = 'spirit'
verbose_name = "Spirit"
def ready(self):
self.register_config()
self.register_signals()
def register_config(self):
import djconfig
from spirit.admin.forms import BasicConfigForm
djconfig.register(BasicConfigForm)
def register_signals(self):
from .topic.poll import signals as poll
from .user import signals as user

View File

@ -8,32 +8,25 @@ import spirit.core.utils.models
class Migration(migrations.Migration):
dependencies = [
('spirit', '0012_auto_20150724_1637'),
]
state_operations = [
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.AutoField(serialize=False, verbose_name='ID', primary_key=True, auto_created=True)),
('id', models.AutoField(primary_key=True, verbose_name='ID', serialize=False, auto_created=True)),
('title', models.CharField(verbose_name='title', max_length=75)),
('slug', spirit.core.utils.models.AutoSlugField(db_index=False, populate_from='title', blank=True)),
('description', models.CharField(verbose_name='description', max_length=255, blank=True)),
('is_closed', models.BooleanField(verbose_name='closed', default=False)),
('is_removed', models.BooleanField(verbose_name='removed', default=False)),
('is_private', models.BooleanField(verbose_name='private', default=False)),
('parent', models.ForeignKey(verbose_name='category parent', blank=True, to='spirit_category.Category', null=True)),
('parent', models.ForeignKey(null=True, verbose_name='category parent', to='spirit_category.Category', blank=True)),
],
options={
'ordering': ['title', 'pk'],
'verbose_name': 'category',
'verbose_name_plural': 'categories',
'db_table': 'spirit_category_category',
'ordering': ['title', 'pk'],
},
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,18 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit_category', '0001_initial'),
]
operations = [
migrations.AlterModelTable(
name='category',
table=None,
),
]

View File

@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
def default_categories(apps, schema_editor):
Category = apps.get_model("spirit_category", "Category")
if not Category.objects.filter(pk=settings.ST_TOPIC_PRIVATE_CATEGORY_PK).exists():
Category.objects.create(
pk=settings.ST_TOPIC_PRIVATE_CATEGORY_PK,
title="Private",
slug="private",
is_private=True
)
if not Category.objects.filter(pk=settings.ST_UNCATEGORIZED_CATEGORY_PK).exists():
Category.objects.create(
pk=settings.ST_UNCATEGORIZED_CATEGORY_PK,
title="Uncategorized",
slug="uncategorized"
)
class Migration(migrations.Migration):
dependencies = [
('spirit_category', '0001_initial'),
]
operations = [
migrations.RunPython(default_categories),
]

View File

@ -8,22 +8,20 @@ from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('spirit_topic', '0002_auto_20150724_2106'),
('spirit_topic', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('spirit', '0030_auto_20150724_2309')
]
state_operations = [
operations = [
migrations.CreateModel(
name='CommentBookmark',
fields=[
('id', models.AutoField(auto_created=True, serialize=False, primary_key=True, verbose_name='ID')),
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('comment_number', models.PositiveIntegerField(default=0)),
('topic', models.ForeignKey(to='spirit_topic.Topic')),
('user', models.ForeignKey(verbose_name='user', to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'spirit_bookmark_commentbookmark',
'verbose_name': 'comment bookmark',
'verbose_name_plural': 'comments bookmarks',
},
@ -33,8 +31,3 @@ class Migration(migrations.Migration):
unique_together=set([('user', 'topic')]),
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,18 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit_comment_bookmark', '0001_initial'),
]
operations = [
migrations.AlterModelTable(
name='commentbookmark',
table=None,
),
]

View File

@ -10,42 +10,39 @@ class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('spirit_comment', '0002_auto_20150724_2212'),
('spirit', '0032_auto_20150724_2315')
('spirit_comment', '0001_initial'),
]
state_operations = [
operations = [
migrations.CreateModel(
name='CommentFlag',
fields=[
('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
('id', models.AutoField(auto_created=True, serialize=False, verbose_name='ID', primary_key=True)),
('date', models.DateTimeField(default=django.utils.timezone.now)),
('is_closed', models.BooleanField(default=False)),
('comment', models.OneToOneField(to='spirit_comment.Comment')),
('moderator', models.ForeignKey(to=settings.AUTH_USER_MODEL, blank=True, null=True)),
('moderator', models.ForeignKey(null=True, to=settings.AUTH_USER_MODEL, blank=True)),
],
options={
'db_table': 'spirit_flag_commentflag',
'verbose_name': 'comment flag',
'verbose_name_plural': 'comments flags',
'ordering': ['-date', '-pk'],
'verbose_name': 'comment flag',
},
),
migrations.CreateModel(
name='Flag',
fields=[
('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
('id', models.AutoField(auto_created=True, serialize=False, verbose_name='ID', primary_key=True)),
('date', models.DateTimeField(default=django.utils.timezone.now)),
('reason', models.IntegerField(verbose_name='reason', choices=[(0, 'Spam'), (1, 'Other')])),
('reason', models.IntegerField(choices=[(0, 'Spam'), (1, 'Other')], verbose_name='reason')),
('body', models.TextField(verbose_name='body', blank=True)),
('comment', models.ForeignKey(to='spirit_comment.Comment')),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'spirit_flag_flag',
'verbose_name': 'flag',
'ordering': ['-date', '-pk'],
'verbose_name_plural': 'flags',
'ordering': ['-date', '-pk'],
'verbose_name': 'flag',
},
),
migrations.AlterUniqueTogether(
@ -53,8 +50,3 @@ class Migration(migrations.Migration):
unique_together=set([('user', 'comment')]),
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit_comment_flag', '0001_initial'),
]
operations = [
migrations.AlterModelTable(
name='commentflag',
table=None,
),
migrations.AlterModelTable(
name='flag',
table=None,
),
]

View File

@ -8,29 +8,22 @@ import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('spirit_comment', '0002_auto_20150724_2212'),
('spirit', '0034_auto_20150724_2321')
('spirit_comment', '0001_initial'),
]
state_operations = [
operations = [
migrations.CreateModel(
name='CommentHistory',
fields=[
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
('comment_html', models.TextField(verbose_name='comment html')),
('date', models.DateTimeField(default=django.utils.timezone.now)),
('comment_fk', models.ForeignKey(to='spirit_comment.Comment', verbose_name='original comment')),
('comment_fk', models.ForeignKey(verbose_name='original comment', to='spirit_comment.Comment')),
],
options={
'db_table': 'spirit_history_commenthistory',
'ordering': ['-date', '-pk'],
'verbose_name': 'comment history',
'ordering': ['-date', '-pk'],
'verbose_name_plural': 'comments history',
},
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,18 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit_comment_history', '0001_initial'),
]
operations = [
migrations.AlterModelTable(
name='commenthistory',
table=None,
),
]

View File

@ -2,32 +2,30 @@
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('spirit_comment', '0002_auto_20150724_2212'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('spirit', '0037_auto_20150724_2329')
('spirit_comment', '0001_initial'),
]
state_operations = [
operations = [
migrations.CreateModel(
name='CommentLike',
fields=[
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
('id', models.AutoField(primary_key=True, verbose_name='ID', serialize=False, auto_created=True)),
('date', models.DateTimeField(default=django.utils.timezone.now)),
('comment', models.ForeignKey(to='spirit_comment.Comment', related_name='comment_likes')),
('comment', models.ForeignKey(related_name='comment_likes', to='spirit_comment.Comment')),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'spirit_like_commentlike',
'verbose_name': 'like',
'verbose_name_plural': 'likes',
'ordering': ['-date', '-pk'],
'verbose_name': 'like',
},
),
migrations.AlterUniqueTogether(
@ -35,8 +33,3 @@ class Migration(migrations.Migration):
unique_together=set([('user', 'comment')]),
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,18 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit_comment_like', '0001_initial'),
]
operations = [
migrations.AlterModelTable(
name='commentlike',
table=None,
),
]

View File

@ -10,37 +10,30 @@ class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('spirit_topic', '0002_auto_20150724_2106'),
('spirit', '0020_auto_20150724_2209')
('spirit_topic', '0001_initial'),
]
state_operations = [
operations = [
migrations.CreateModel(
name='Comment',
fields=[
('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')),
('comment', models.TextField(max_length=3000, verbose_name='comment')),
('id', models.AutoField(serialize=False, verbose_name='ID', primary_key=True, auto_created=True)),
('comment', models.TextField(verbose_name='comment', max_length=3000)),
('comment_html', models.TextField(verbose_name='comment html')),
('action', models.IntegerField(default=0, choices=[(0, 'comment'), (1, 'topic moved'), (2, 'topic closed'), (3, 'topic unclosed'), (4, 'topic pinned'), (5, 'topic unpinned')], verbose_name='action')),
('action', models.IntegerField(default=0, verbose_name='action', choices=[(0, 'comment'), (1, 'topic moved'), (2, 'topic closed'), (3, 'topic unclosed'), (4, 'topic pinned'), (5, 'topic unpinned')])),
('date', models.DateTimeField(default=django.utils.timezone.now)),
('is_removed', models.BooleanField(default=False)),
('is_modified', models.BooleanField(default=False)),
('ip_address', models.GenericIPAddressField(blank=True, null=True)),
('ip_address', models.GenericIPAddressField(null=True, blank=True)),
('modified_count', models.PositiveIntegerField(default=0, verbose_name='modified count')),
('likes_count', models.PositiveIntegerField(default=0, verbose_name='likes count')),
('topic', models.ForeignKey(to='spirit_topic.Topic')),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, verbose_name='user')),
],
options={
'db_table': 'spirit_comment_comment',
'verbose_name_plural': 'comments',
'ordering': ['-date', '-pk'],
'verbose_name': 'comment',
'ordering': ['-date', '-pk'],
},
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,18 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit_comment', '0001_initial'),
]
operations = [
migrations.AlterModelTable(
name='comment',
table=None,
),
]

View File

@ -1,390 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
import django.core.validators
import spirit.core.utils.models
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
]
dependencies.extend(settings.ST_INITIAL_MIGRATION_DEPENDENCIES)
operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(default=django.utils.timezone.now, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('slug', spirit.core.utils.models.AutoSlugField(db_index=False, populate_from=b'username', blank=True)),
('location', models.CharField(max_length=75, verbose_name='location', blank=True)),
('last_seen', models.DateTimeField(auto_now=True, verbose_name='last seen')),
('last_ip', models.GenericIPAddressField(null=True, verbose_name='last ip', blank=True)),
('timezone', models.CharField(default=b'UTC', max_length=32, verbose_name='time zone', choices=[(b'Etc/GMT+12', '(GMT -12:00) Eniwetok, Kwajalein'), (b'Etc/GMT+11', '(GMT -11:00) Midway Island, Samoa'), (b'Etc/GMT+10', '(GMT -10:00) Hawaii'), (b'Pacific/Marquesas', '(GMT -9:30) Marquesas Islands'), (b'Etc/GMT+9', '(GMT -9:00) Alaska'), (b'Etc/GMT+8', '(GMT -8:00) Pacific Time (US & Canada)'), (b'Etc/GMT+7', '(GMT -7:00) Mountain Time (US & Canada)'), (b'Etc/GMT+6', '(GMT -6:00) Central Time (US & Canada), Mexico City'), (b'Etc/GMT+5', '(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima'), (b'America/Caracas', '(GMT -4:30) Venezuela'), (b'Etc/GMT+4', '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz'), (b'Etc/GMT+3', '(GMT -3:00) Brazil, Buenos Aires, Georgetown'), (b'Etc/GMT+2', '(GMT -2:00) Mid-Atlantic'), (b'Etc/GMT+1', '(GMT -1:00) Azores, Cape Verde Islands'), (b'UTC', '(GMT) Western Europe Time, London, Lisbon, Casablanca'), (b'Etc/GMT-1', '(GMT +1:00) Brussels, Copenhagen, Madrid, Paris'), (b'Etc/GMT-2', '(GMT +2:00) Kaliningrad, South Africa'), (b'Etc/GMT-3', '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg'), (b'Etc/GMT-4', '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi'), (b'Asia/Kabul', '(GMT +4:30) Afghanistan'), (b'Etc/GMT-5', '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent'), (b'Asia/Kolkata', '(GMT +5:30) India, Sri Lanka'), (b'Asia/Kathmandu', '(GMT +5:45) Nepal'), (b'Etc/GMT-6', '(GMT +6:00) Almaty, Dhaka, Colombo'), (b'Indian/Cocos', '(GMT +6:30) Cocos Islands, Myanmar'), (b'Etc/GMT-7', '(GMT +7:00) Bangkok, Hanoi, Jakarta'), (b'Etc/GMT-8', '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong'), (b'Australia/Eucla', '(GMT +8:45) Australia (Eucla)'), (b'Etc/GMT-9', '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk'), (b'Australia/North', '(GMT +9:30) Australia (Northern Territory)'), (b'Etc/GMT-10', '(GMT +10:00) Eastern Australia, Guam, Vladivostok'), (b'Etc/GMT-11', '(GMT +11:00) Magadan, Solomon Islands, New Caledonia'), (b'Pacific/Norfolk', '(GMT +11:30) Norfolk Island'), (b'Etc/GMT-12', '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka')])),
('is_administrator', models.BooleanField(default=False, verbose_name='administrator status')),
('is_moderator', models.BooleanField(default=False, verbose_name='moderator status')),
('topic_count', models.PositiveIntegerField(default=0, verbose_name='topic count')),
('comment_count', models.PositiveIntegerField(default=0, verbose_name='comment count')),
('username', models.CharField(max_length=30, validators=[django.core.validators.RegexValidator(re.compile(b'^[\\w.@+-]+$'), 'Enter a valid username.', b'invalid')], help_text='Required. 30 characters or fewer. Letters, numbers and @/./+/-/_ characters', unique=True, verbose_name='username', db_index=True)),
('first_name', models.CharField(max_length=30, verbose_name='first name', blank=True)),
('last_name', models.CharField(max_length=30, verbose_name='last name', blank=True)),
('email', models.EmailField(unique=True, max_length=254, verbose_name='email')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('groups', models.ManyToManyField(related_query_name='user', related_name='user_set', to='auth.Group', blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of his/her group.', verbose_name='groups')),
('user_permissions', models.ManyToManyField(related_query_name='user', related_name='user_set', to='auth.Permission', blank=True, help_text='Specific permissions for this user.', verbose_name='user permissions')),
],
options={
'ordering': ['-date_joined'],
'abstract': False,
'verbose_name': 'user',
'swappable': 'AUTH_USER_MODEL',
'verbose_name_plural': 'users',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Category',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('title', models.CharField(max_length=75, verbose_name='title')),
('slug', spirit.core.utils.models.AutoSlugField(db_index=False, populate_from=b'title', blank=True)),
('description', models.CharField(max_length=255, verbose_name='description', blank=True)),
('is_closed', models.BooleanField(default=False, verbose_name='closed')),
('is_removed', models.BooleanField(default=False, verbose_name='removed')),
('is_private', models.BooleanField(default=False, verbose_name='private')),
('parent', models.ForeignKey(verbose_name='category parent', blank=True, to='spirit.Category', null=True)),
],
options={
'ordering': ['title'],
'verbose_name': 'category',
'verbose_name_plural': 'categories',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Comment',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('comment', models.TextField(max_length=3000, verbose_name='comment')),
('comment_html', models.TextField(verbose_name='comment html')),
('action', models.IntegerField(default=0, verbose_name='action', choices=[(0, 'comment'), (1, 'topic moved'), (2, 'topic closed'), (3, 'topic unclosed'), (4, 'topic pinned'), (5, 'topic unpinned')])),
('date', models.DateTimeField(auto_now_add=True)),
('is_removed', models.BooleanField(default=False)),
('is_modified', models.BooleanField(default=False)),
('ip_address', models.GenericIPAddressField(null=True, blank=True)),
('modified_count', models.PositiveIntegerField(default=0, verbose_name='modified count')),
('likes_count', models.PositiveIntegerField(default=0, verbose_name='likes count')),
],
options={
'ordering': ['-date'],
'verbose_name': 'comment',
'verbose_name_plural': 'comments',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='CommentBookmark',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('comment_number', models.PositiveIntegerField(default=0)),
],
options={
'verbose_name': 'comment bookmark',
'verbose_name_plural': 'comments bookmarks',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='CommentFlag',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('date', models.DateTimeField(auto_now_add=True)),
('is_closed', models.BooleanField(default=False)),
('comment', models.OneToOneField(to='spirit.Comment')),
('moderator', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True)),
],
options={
'ordering': ['-date'],
'verbose_name': 'comment flag',
'verbose_name_plural': 'comments flags',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='CommentHistory',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('comment_html', models.TextField(verbose_name='comment html')),
('date', models.DateTimeField(auto_now_add=True)),
('comment_fk', models.ForeignKey(verbose_name='original comment', to='spirit.Comment')),
],
options={
'ordering': ['-date'],
'verbose_name': 'comment history',
'verbose_name_plural': 'comments history',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='CommentLike',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('date', models.DateTimeField(auto_now_add=True)),
('comment', models.ForeignKey(related_name=b'comment_likes', to='spirit.Comment')),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['-date'],
'verbose_name': 'like',
'verbose_name_plural': 'likes',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Flag',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('date', models.DateTimeField(auto_now_add=True)),
('reason', models.IntegerField(verbose_name='reason', choices=[(0, 'Spam'), (1, 'Other')])),
('body', models.TextField(verbose_name='body', blank=True)),
('comment', models.ForeignKey(to='spirit.Comment')),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['-date'],
'verbose_name': 'flag',
'verbose_name_plural': 'flags',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Topic',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('title', models.CharField(max_length=75, verbose_name='title')),
('slug', spirit.core.utils.models.AutoSlugField(db_index=False, populate_from=b'title', blank=True)),
('date', models.DateTimeField(auto_now_add=True, verbose_name='date')),
('last_active', models.DateTimeField(auto_now_add=True, verbose_name='last active')),
('is_pinned', models.BooleanField(default=False, verbose_name='pinned')),
('is_closed', models.BooleanField(default=False, verbose_name='closed')),
('is_removed', models.BooleanField(default=False)),
('view_count', models.PositiveIntegerField(default=0, verbose_name='views count')),
('comment_count', models.PositiveIntegerField(default=0, verbose_name='comment count')),
],
options={
'ordering': ['-last_active'],
'verbose_name': 'topic',
'verbose_name_plural': 'topics',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='TopicFavorite',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('date', models.DateTimeField(auto_now_add=True)),
],
options={
'ordering': ['-date'],
'verbose_name': 'favorite',
'verbose_name_plural': 'favorites',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='TopicNotification',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('date', models.DateTimeField(auto_now_add=True)),
('action', models.IntegerField(default=0, choices=[(0, 'Undefined'), (1, 'Mention'), (2, 'Comment')])),
('is_read', models.BooleanField(default=False)),
('is_active', models.BooleanField(default=False)),
('comment', models.ForeignKey(blank=True, to='spirit.Comment', null=True)),
],
options={
'ordering': ['-date'],
'verbose_name': 'topic notification',
'verbose_name_plural': 'topics notification',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='TopicPoll',
fields=[
('topic', models.OneToOneField(related_name=b'poll', primary_key=True, serialize=False, to='spirit.Topic', verbose_name='topic')),
('date', models.DateTimeField(auto_now_add=True)),
('choice_limit', models.PositiveIntegerField(default=1, verbose_name='choice limit')),
('is_closed', models.BooleanField(default=False)),
],
options={
'verbose_name': 'topic poll',
'verbose_name_plural': 'topics polls',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='TopicPollChoice',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('description', models.CharField(max_length=255, verbose_name='choice description')),
('vote_count', models.PositiveIntegerField(default=0, verbose_name='vote count')),
('poll', models.ForeignKey(related_name=b'choices', verbose_name='poll', to='spirit.TopicPoll')),
],
options={
'verbose_name': 'poll choice',
'verbose_name_plural': 'poll choices',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='TopicPollVote',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('date', models.DateTimeField(auto_now_add=True)),
('choice', models.ForeignKey(related_name=b'votes', verbose_name='poll choice', to='spirit.TopicPollChoice')),
('user', models.ForeignKey(verbose_name='voter', to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'poll vote',
'verbose_name_plural': 'poll votes',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='TopicPrivate',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('date', models.DateTimeField(auto_now_add=True)),
('topic', models.ForeignKey(related_name=b'topics_private', to='spirit.Topic')),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['-date'],
'verbose_name': 'private topic',
'verbose_name_plural': 'private topics',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='TopicUnread',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('date', models.DateTimeField(auto_now_add=True)),
('is_read', models.BooleanField(default=True)),
('topic', models.ForeignKey(to='spirit.Topic')),
('user', models.ForeignKey(verbose_name='user', to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['-date'],
'verbose_name': 'topic unread',
'verbose_name_plural': 'topics unread',
},
bases=(models.Model,),
),
migrations.AlterUniqueTogether(
name='topicunread',
unique_together=set([('user', 'topic')]),
),
migrations.AlterUniqueTogether(
name='topicprivate',
unique_together=set([('user', 'topic')]),
),
migrations.AlterUniqueTogether(
name='topicpollvote',
unique_together=set([('user', 'choice')]),
),
migrations.AddField(
model_name='topicnotification',
name='topic',
field=models.ForeignKey(to='spirit.Topic'),
preserve_default=True,
),
migrations.AddField(
model_name='topicnotification',
name='user',
field=models.ForeignKey(verbose_name='user', to=settings.AUTH_USER_MODEL),
preserve_default=True,
),
migrations.AlterUniqueTogether(
name='topicnotification',
unique_together=set([('user', 'topic')]),
),
migrations.AddField(
model_name='topicfavorite',
name='topic',
field=models.ForeignKey(to='spirit.Topic'),
preserve_default=True,
),
migrations.AddField(
model_name='topicfavorite',
name='user',
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
preserve_default=True,
),
migrations.AlterUniqueTogether(
name='topicfavorite',
unique_together=set([('user', 'topic')]),
),
migrations.AddField(
model_name='topic',
name='category',
field=models.ForeignKey(verbose_name='category', to='spirit.Category'),
preserve_default=True,
),
migrations.AddField(
model_name='topic',
name='user',
field=models.ForeignKey(verbose_name='user', to=settings.AUTH_USER_MODEL),
preserve_default=True,
),
migrations.AlterUniqueTogether(
name='flag',
unique_together=set([('user', 'comment')]),
),
migrations.AlterUniqueTogether(
name='commentlike',
unique_together=set([('user', 'comment')]),
),
migrations.AddField(
model_name='commentbookmark',
name='topic',
field=models.ForeignKey(to='spirit.Topic'),
preserve_default=True,
),
migrations.AddField(
model_name='commentbookmark',
name='user',
field=models.ForeignKey(verbose_name='user', to=settings.AUTH_USER_MODEL),
preserve_default=True,
),
migrations.AlterUniqueTogether(
name='commentbookmark',
unique_together=set([('user', 'topic')]),
),
migrations.AddField(
model_name='comment',
name='topic',
field=models.ForeignKey(to='spirit.Topic'),
preserve_default=True,
),
migrations.AddField(
model_name='comment',
name='user',
field=models.ForeignKey(verbose_name='user', to=settings.AUTH_USER_MODEL),
preserve_default=True,
),
]

View File

@ -1,32 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.conf import settings
def default_categories(apps, schema_editor):
Category = apps.get_model("spirit", "Category")
if not Category.objects.filter(pk=settings.ST_TOPIC_PRIVATE_CATEGORY_PK).exists():
Category.objects.create(pk=settings.ST_TOPIC_PRIVATE_CATEGORY_PK,
title="Private",
slug="private",
is_private=True)
if not Category.objects.filter(pk=settings.ST_UNCATEGORIZED_CATEGORY_PK).exists():
Category.objects.get_or_create(pk=settings.ST_UNCATEGORIZED_CATEGORY_PK,
title="Uncategorized",
slug="uncategorized")
class Migration(migrations.Migration):
dependencies = [
('spirit', '0001_initial'),
]
operations = [
migrations.RunPython(default_categories),
]

View File

@ -1,55 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from django.db import models, migrations
import django.core.validators
import spirit.core.utils.models
class Migration(migrations.Migration):
dependencies = [
('spirit', '0002_auto_20140928_2347'),
]
operations = [
migrations.AlterField(
model_name='category',
name='slug',
field=spirit.core.utils.models.AutoSlugField(blank=True, populate_from='title', db_index=False),
preserve_default=True,
),
migrations.AlterField(
model_name='topic',
name='slug',
field=spirit.core.utils.models.AutoSlugField(blank=True, populate_from='title', db_index=False),
preserve_default=True,
),
migrations.AlterField(
model_name='topic',
name='title',
field=models.CharField(max_length=255, verbose_name='title'),
preserve_default=True,
),
migrations.AlterField(
model_name='user',
name='slug',
field=spirit.core.utils.models.AutoSlugField(blank=True, populate_from='username', db_index=False),
preserve_default=True,
),
migrations.AlterField(
model_name='user',
name='timezone',
field=models.CharField(choices=[('Etc/GMT+12', '(GMT -12:00) Eniwetok, Kwajalein'), ('Etc/GMT+11', '(GMT -11:00) Midway Island, Samoa'), ('Etc/GMT+10', '(GMT -10:00) Hawaii'), ('Pacific/Marquesas', '(GMT -9:30) Marquesas Islands'), ('Etc/GMT+9', '(GMT -9:00) Alaska'), ('Etc/GMT+8', '(GMT -8:00) Pacific Time (US & Canada)'), ('Etc/GMT+7', '(GMT -7:00) Mountain Time (US & Canada)'), ('Etc/GMT+6', '(GMT -6:00) Central Time (US & Canada), Mexico City'), ('Etc/GMT+5', '(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima'), ('America/Caracas', '(GMT -4:30) Venezuela'), ('Etc/GMT+4', '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz'), ('Etc/GMT+3', '(GMT -3:00) Brazil, Buenos Aires, Georgetown'), ('Etc/GMT+2', '(GMT -2:00) Mid-Atlantic'), ('Etc/GMT+1', '(GMT -1:00) Azores, Cape Verde Islands'), ('UTC', '(GMT) Western Europe Time, London, Lisbon, Casablanca'), ('Etc/GMT-1', '(GMT +1:00) Brussels, Copenhagen, Madrid, Paris'), ('Etc/GMT-2', '(GMT +2:00) Kaliningrad, South Africa'), ('Etc/GMT-3', '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg'), ('Etc/GMT-4', '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi'), ('Asia/Kabul', '(GMT +4:30) Afghanistan'), ('Etc/GMT-5', '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent'), ('Asia/Kolkata', '(GMT +5:30) India, Sri Lanka'), ('Asia/Kathmandu', '(GMT +5:45) Nepal'), ('Etc/GMT-6', '(GMT +6:00) Almaty, Dhaka, Colombo'), ('Indian/Cocos', '(GMT +6:30) Cocos Islands, Myanmar'), ('Etc/GMT-7', '(GMT +7:00) Bangkok, Hanoi, Jakarta'), ('Etc/GMT-8', '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong'), ('Australia/Eucla', '(GMT +8:45) Australia (Eucla)'), ('Etc/GMT-9', '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk'), ('Australia/North', '(GMT +9:30) Australia (Northern Territory)'), ('Etc/GMT-10', '(GMT +10:00) Eastern Australia, Guam, Vladivostok'), ('Etc/GMT-11', '(GMT +11:00) Magadan, Solomon Islands, New Caledonia'), ('Pacific/Norfolk', '(GMT +11:30) Norfolk Island'), ('Etc/GMT-12', '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka')], default='UTC', verbose_name='time zone', max_length=32),
preserve_default=True,
),
migrations.AlterField(
model_name='user',
name='username',
field=models.CharField(max_length=30, help_text='Required. 30 characters or fewer. Letters, numbers and @/./+/-/_ characters', verbose_name='username', validators=[django.core.validators.RegexValidator(re.compile('^[\\w.@+-]+$', 32), 'Enter a valid username.', 'invalid')], unique=True, db_index=True),
preserve_default=True,
),
]

View File

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0003_auto_20141220_1125'),
]
operations = [
migrations.AddField(
model_name='topic',
name='is_globally_pinned',
field=models.BooleanField(default=False, verbose_name='globally pinned'),
preserve_default=True,
),
]

View File

@ -1,68 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0004_topic_is_globally_pinned'),
]
operations = [
migrations.AlterModelOptions(
name='category',
options={'ordering': ['title', 'pk'], 'verbose_name_plural': 'categories', 'verbose_name': 'category'},
),
migrations.AlterModelOptions(
name='comment',
options={'ordering': ['-date', '-pk'], 'verbose_name_plural': 'comments', 'verbose_name': 'comment'},
),
migrations.AlterModelOptions(
name='commentflag',
options={'ordering': ['-date', '-pk'], 'verbose_name_plural': 'comments flags', 'verbose_name': 'comment flag'},
),
migrations.AlterModelOptions(
name='commenthistory',
options={'ordering': ['-date', '-pk'], 'verbose_name_plural': 'comments history', 'verbose_name': 'comment history'},
),
migrations.AlterModelOptions(
name='commentlike',
options={'ordering': ['-date', '-pk'], 'verbose_name_plural': 'likes', 'verbose_name': 'like'},
),
migrations.AlterModelOptions(
name='flag',
options={'ordering': ['-date', '-pk'], 'verbose_name_plural': 'flags', 'verbose_name': 'flag'},
),
migrations.AlterModelOptions(
name='topic',
options={'ordering': ['-last_active', '-pk'], 'verbose_name_plural': 'topics', 'verbose_name': 'topic'},
),
migrations.AlterModelOptions(
name='topicfavorite',
options={'ordering': ['-date', '-pk'], 'verbose_name_plural': 'favorites', 'verbose_name': 'favorite'},
),
migrations.AlterModelOptions(
name='topicnotification',
options={'ordering': ['-date', '-pk'], 'verbose_name_plural': 'topics notification', 'verbose_name': 'topic notification'},
),
migrations.AlterModelOptions(
name='topicprivate',
options={'ordering': ['-date', '-pk'], 'verbose_name_plural': 'private topics', 'verbose_name': 'private topic'},
),
migrations.AlterModelOptions(
name='topicunread',
options={'ordering': ['-date', '-pk'], 'verbose_name_plural': 'topics unread', 'verbose_name': 'topic unread'},
),
migrations.AlterModelOptions(
name='user',
options={'ordering': ['-date_joined', '-pk'], 'verbose_name_plural': 'users', 'verbose_name': 'user'},
),
migrations.AddField(
model_name='user',
name='is_verified',
field=models.BooleanField(help_text='Designates whether the user has verified his account by email or by other means. Un-select this to let the user activate his account.', default=False, verbose_name='verified'),
preserve_default=True,
),
]

View File

@ -1,23 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
def verify_active_users(apps, schema_editor):
User = apps.get_model(settings.AUTH_USER_MODEL)
if hasattr(User(), 'is_verified'):
User.objects.filter(is_active=True).update(is_verified=True)
class Migration(migrations.Migration):
dependencies = [
('spirit', '0005_auto_20150327_0138'),
]
operations = [
migrations.RunPython(verify_active_users),
]

View File

@ -1,40 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import spirit.core.utils.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('spirit', '0006_auto_20150327_0204'),
]
operations = [
migrations.CreateModel(
name='UserProfile',
fields=[
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
('slug', spirit.core.utils.models.AutoSlugField(db_index=False, blank=True, populate_from='user.username')),
('location', models.CharField(blank=True, verbose_name='location', max_length=75)),
('last_seen', models.DateTimeField(auto_now=True, verbose_name='last seen')),
('last_ip', models.GenericIPAddressField(blank=True, verbose_name='last ip', null=True)),
('timezone', models.CharField(max_length=32, verbose_name='time zone', choices=[('Etc/GMT+12', '(GMT -12:00) Eniwetok, Kwajalein'), ('Etc/GMT+11', '(GMT -11:00) Midway Island, Samoa'), ('Etc/GMT+10', '(GMT -10:00) Hawaii'), ('Pacific/Marquesas', '(GMT -9:30) Marquesas Islands'), ('Etc/GMT+9', '(GMT -9:00) Alaska'), ('Etc/GMT+8', '(GMT -8:00) Pacific Time (US & Canada)'), ('Etc/GMT+7', '(GMT -7:00) Mountain Time (US & Canada)'), ('Etc/GMT+6', '(GMT -6:00) Central Time (US & Canada), Mexico City'), ('Etc/GMT+5', '(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima'), ('America/Caracas', '(GMT -4:30) Venezuela'), ('Etc/GMT+4', '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz'), ('Etc/GMT+3', '(GMT -3:00) Brazil, Buenos Aires, Georgetown'), ('Etc/GMT+2', '(GMT -2:00) Mid-Atlantic'), ('Etc/GMT+1', '(GMT -1:00) Azores, Cape Verde Islands'), ('UTC', '(GMT) Western Europe Time, London, Lisbon, Casablanca'), ('Etc/GMT-1', '(GMT +1:00) Brussels, Copenhagen, Madrid, Paris'), ('Etc/GMT-2', '(GMT +2:00) Kaliningrad, South Africa'), ('Etc/GMT-3', '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg'), ('Etc/GMT-4', '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi'), ('Asia/Kabul', '(GMT +4:30) Afghanistan'), ('Etc/GMT-5', '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent'), ('Asia/Kolkata', '(GMT +5:30) India, Sri Lanka'), ('Asia/Kathmandu', '(GMT +5:45) Nepal'), ('Etc/GMT-6', '(GMT +6:00) Almaty, Dhaka, Colombo'), ('Indian/Cocos', '(GMT +6:30) Cocos Islands, Myanmar'), ('Etc/GMT-7', '(GMT +7:00) Bangkok, Hanoi, Jakarta'), ('Etc/GMT-8', '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong'), ('Australia/Eucla', '(GMT +8:45) Australia (Eucla)'), ('Etc/GMT-9', '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk'), ('Australia/North', '(GMT +9:30) Australia (Northern Territory)'), ('Etc/GMT-10', '(GMT +10:00) Eastern Australia, Guam, Vladivostok'), ('Etc/GMT-11', '(GMT +11:00) Magadan, Solomon Islands, New Caledonia'), ('Pacific/Norfolk', '(GMT +11:30) Norfolk Island'), ('Etc/GMT-12', '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka')], default='UTC')),
('is_administrator', models.BooleanField(verbose_name='administrator status', default=False)),
('is_moderator', models.BooleanField(verbose_name='moderator status', default=False)),
('is_verified', models.BooleanField(verbose_name='verified', help_text='Designates whether the user has verified his account by email or by other means. Un-select this to let the user activate his account.', default=False)),
('topic_count', models.PositiveIntegerField(verbose_name='topic count', default=0)),
('comment_count', models.PositiveIntegerField(verbose_name='comment count', default=0)),
('user', models.OneToOneField(to=settings.AUTH_USER_MODEL, verbose_name='profile', related_name='st')),
],
options={
'verbose_name': 'forum profile',
'verbose_name_plural': 'forum profiles',
},
bases=(models.Model,),
),
]

View File

@ -1,47 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
def migrate_users(apps, schema_editor):
UserOld = apps.get_model(settings.AUTH_USER_MODEL)
UserProfile = apps.get_model('spirit', 'UserProfile')
profiles = []
# TODO: after the deprecation period, this migration will get removed, but just in case...
# Check if this is the old Spirit user model
if not hasattr(UserOld(), 'is_moderator') \
or not hasattr(UserOld(), 'last_seen') \
or not hasattr(UserOld(), 'is_verified'):
return
for user in UserOld.objects.all():
st = UserProfile()
st.user = user
st.slug = user.slug
st.location = user.location
st.last_seen = user.last_seen
st.last_ip = user.last_ip
st.timezone = user.timezone
st.is_administrator = user.is_administrator
st.is_moderator = user.is_moderator
st.is_verified = user.is_verified
st.topic_count = user.topic_count
st.comment_count = user.comment_count
profiles.append(st)
if profiles:
UserProfile.objects.bulk_create(profiles)
class Migration(migrations.Migration):
dependencies = [
('spirit', '0007_userprofile'),
]
operations = [
migrations.RunPython(migrate_users),
]

View File

@ -1,31 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.auth.models
class Migration(migrations.Migration):
dependencies = [
('spirit', '0008_auto_20150330_0643'),
]
operations = [
migrations.AlterModelManagers(
name='user',
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
migrations.AlterField(
model_name='user',
name='groups',
field=models.ManyToManyField(to='auth.Group', help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_query_name='user', verbose_name='groups', blank=True, related_name='user_set'),
),
migrations.AlterField(
model_name='user',
name='last_login',
field=models.DateTimeField(null=True, blank=True, verbose_name='last login'),
),
]

View File

@ -1,82 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0009_auto_20150330_0858'),
]
operations = [
migrations.AlterModelTable(
name='category',
table='spirit_category_category',
),
migrations.AlterModelTable(
name='comment',
table='spirit_comment_comment',
),
migrations.AlterModelTable(
name='commentbookmark',
table='spirit_bookmark_commentbookmark',
),
migrations.AlterModelTable(
name='commentflag',
table='spirit_flag_commentflag',
),
migrations.AlterModelTable(
name='commenthistory',
table='spirit_history_commenthistory',
),
migrations.AlterModelTable(
name='commentlike',
table='spirit_like_commentlike',
),
migrations.AlterModelTable(
name='flag',
table='spirit_flag_flag',
),
migrations.AlterModelTable(
name='topic',
table='spirit_topic_topic',
),
migrations.AlterModelTable(
name='topicfavorite',
table='spirit_favorite_topicfavorite',
),
migrations.AlterModelTable(
name='topicnotification',
table='spirit_notification_topicnotification',
),
migrations.AlterModelTable(
name='topicpoll',
table='spirit_poll_topicpoll',
),
migrations.AlterModelTable(
name='topicpollchoice',
table='spirit_poll_topicpollchoice',
),
migrations.AlterModelTable(
name='topicpollvote',
table='spirit_poll_topicpollvote',
),
migrations.AlterModelTable(
name='topicprivate',
table='spirit_private_topicprivate',
),
migrations.AlterModelTable(
name='topicunread',
table='spirit_unread_topicunread',
),
migrations.AlterModelTable(
name='user',
table='spirit_user_user',
),
migrations.AlterModelTable(
name='userprofile',
table='spirit_user_userprofile',
),
]

View File

@ -1,80 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('spirit', '0010_auto_20150505_2125'),
]
operations = [
migrations.AlterField(
model_name='comment',
name='date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AlterField(
model_name='commentflag',
name='date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AlterField(
model_name='commenthistory',
name='date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AlterField(
model_name='commentlike',
name='date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AlterField(
model_name='flag',
name='date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AlterField(
model_name='topic',
name='date',
field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='date'),
),
migrations.AlterField(
model_name='topic',
name='last_active',
field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='last active'),
),
migrations.AlterField(
model_name='topicfavorite',
name='date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AlterField(
model_name='topicnotification',
name='date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AlterField(
model_name='topicpoll',
name='date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AlterField(
model_name='topicpollvote',
name='date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AlterField(
model_name='topicprivate',
name='date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
migrations.AlterField(
model_name='topicunread',
name='date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
]

View File

@ -1,31 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0011_auto_20150713_1032'),
]
state_operations = [
migrations.RemoveField(
model_name='category',
name='parent',
),
migrations.AlterField(
model_name='topic',
name='category',
field=models.ForeignKey(to='spirit_category.Category', verbose_name='category'),
),
migrations.DeleteModel(
name='Category',
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def rename_model_content_type(apps, schema_editor):
content_types = apps.get_model('contenttypes.ContentType')
content_types.objects.filter(
app_label='spirit', model='Category'.lower()
).update(app_label='spirit_category')
class Migration(migrations.Migration):
dependencies = [
('spirit', '0012_auto_20150724_1637'),
]
operations = [
migrations.RunPython(rename_model_content_type),
]

View File

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0013_auto_20150724_1730'),
]
state_operations = [
migrations.RemoveField(
model_name='userprofile',
name='user',
),
migrations.DeleteModel(
name='UserProfile',
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,65 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0015_auto_20150724_1940'),
]
state_operations = [
migrations.RemoveField(
model_name='topic',
name='category',
),
migrations.RemoveField(
model_name='topic',
name='user',
),
migrations.AlterField(
model_name='comment',
name='topic',
field=models.ForeignKey(to='spirit_topic.Topic'),
),
migrations.AlterField(
model_name='commentbookmark',
name='topic',
field=models.ForeignKey(to='spirit_topic.Topic'),
),
migrations.AlterField(
model_name='topicfavorite',
name='topic',
field=models.ForeignKey(to='spirit_topic.Topic'),
),
migrations.AlterField(
model_name='topicnotification',
name='topic',
field=models.ForeignKey(to='spirit_topic.Topic'),
),
migrations.AlterField(
model_name='topicpoll',
name='topic',
field=models.OneToOneField(to='spirit_topic.Topic', related_name='poll', primary_key=True, verbose_name='topic', serialize=False),
),
migrations.AlterField(
model_name='topicprivate',
name='topic',
field=models.ForeignKey(related_name='topics_private', to='spirit_topic.Topic'),
),
migrations.AlterField(
model_name='topicunread',
name='topic',
field=models.ForeignKey(to='spirit_topic.Topic'),
),
migrations.DeleteModel(
name='Topic',
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def rename_model_content_type(apps, schema_editor):
content_types = apps.get_model('contenttypes.ContentType')
content_types.objects.filter(
app_label='spirit', model='Topic'.lower()
).update(app_label='spirit_topic')
class Migration(migrations.Migration):
dependencies = [
('spirit', '0016_auto_20150724_2103'),
]
operations = [
migrations.RunPython(rename_model_content_type),
]

View File

@ -1,34 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0017_auto_20150724_2104'),
]
state_operations = [
migrations.AlterUniqueTogether(
name='topicfavorite',
unique_together=set([]),
),
migrations.RemoveField(
model_name='topicfavorite',
name='topic',
),
migrations.RemoveField(
model_name='topicfavorite',
name='user',
),
migrations.DeleteModel(
name='TopicFavorite',
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def rename_model_content_type(apps, schema_editor):
content_types = apps.get_model('contenttypes.ContentType')
content_types.objects.filter(
app_label='spirit', model='TopicFavorite'.lower()
).update(app_label='spirit_topic_favorite')
class Migration(migrations.Migration):
dependencies = [
('spirit', '0018_auto_20150724_2153'),
]
operations = [
migrations.RunPython(rename_model_content_type),
]

View File

@ -1,55 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0019_auto_20150724_2155'),
]
state_operations = [
migrations.RemoveField(
model_name='comment',
name='topic',
),
migrations.RemoveField(
model_name='comment',
name='user',
),
migrations.AlterField(
model_name='commentflag',
name='comment',
field=models.OneToOneField(to='spirit_comment.Comment'),
),
migrations.AlterField(
model_name='commenthistory',
name='comment_fk',
field=models.ForeignKey(verbose_name='original comment', to='spirit_comment.Comment'),
),
migrations.AlterField(
model_name='commentlike',
name='comment',
field=models.ForeignKey(related_name='comment_likes', to='spirit_comment.Comment'),
),
migrations.AlterField(
model_name='flag',
name='comment',
field=models.ForeignKey(to='spirit_comment.Comment'),
),
migrations.AlterField(
model_name='topicnotification',
name='comment',
field=models.ForeignKey(to='spirit_comment.Comment', blank=True, null=True),
),
migrations.DeleteModel(
name='Comment',
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def rename_model_content_type(apps, schema_editor):
content_types = apps.get_model('contenttypes.ContentType')
content_types.objects.filter(
app_label='spirit', model='Comment'.lower()
).update(app_label='spirit_comment')
class Migration(migrations.Migration):
dependencies = [
('spirit', '0020_auto_20150724_2209'),
]
operations = [
migrations.RunPython(rename_model_content_type),
]

View File

@ -1,38 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0021_auto_20150724_2210'),
]
state_operations = [
migrations.AlterUniqueTogether(
name='topicnotification',
unique_together=set([]),
),
migrations.RemoveField(
model_name='topicnotification',
name='comment',
),
migrations.RemoveField(
model_name='topicnotification',
name='topic',
),
migrations.RemoveField(
model_name='topicnotification',
name='user',
),
migrations.DeleteModel(
name='TopicNotification',
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def rename_model_content_type(apps, schema_editor):
content_types = apps.get_model('contenttypes.ContentType')
content_types.objects.filter(
app_label='spirit', model='TopicNotification'.lower()
).update(app_label='spirit_topic_notification')
class Migration(migrations.Migration):
dependencies = [
('spirit', '0022_auto_20150724_2232'),
]
operations = [
migrations.RunPython(rename_model_content_type),
]

View File

@ -1,48 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0023_auto_20150724_2234'),
]
state_operations = [
migrations.RemoveField(
model_name='topicpoll',
name='topic',
),
migrations.RemoveField(
model_name='topicpollchoice',
name='poll',
),
migrations.AlterUniqueTogether(
name='topicpollvote',
unique_together=set([]),
),
migrations.RemoveField(
model_name='topicpollvote',
name='choice',
),
migrations.RemoveField(
model_name='topicpollvote',
name='user',
),
migrations.DeleteModel(
name='TopicPoll',
),
migrations.DeleteModel(
name='TopicPollChoice',
),
migrations.DeleteModel(
name='TopicPollVote',
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,28 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def rename_model_content_type(apps, schema_editor):
content_types = apps.get_model('contenttypes.ContentType')
content_types.objects.filter(
app_label='spirit', model='TopicPoll'.lower()
).update(app_label='spirit_topic_poll')
content_types.objects.filter(
app_label='spirit', model='TopicPollChoice'.lower()
).update(app_label='spirit_topic_poll')
content_types.objects.filter(
app_label='spirit', model='TopicPollVote'.lower()
).update(app_label='spirit_topic_poll')
class Migration(migrations.Migration):
dependencies = [
('spirit', '0024_auto_20150724_2248'),
]
operations = [
migrations.RunPython(rename_model_content_type),
]

View File

@ -1,34 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0025_auto_20150724_2248'),
]
state_operations = [
migrations.AlterUniqueTogether(
name='topicprivate',
unique_together=set([]),
),
migrations.RemoveField(
model_name='topicprivate',
name='topic',
),
migrations.RemoveField(
model_name='topicprivate',
name='user',
),
migrations.DeleteModel(
name='TopicPrivate',
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def rename_model_content_type(apps, schema_editor):
content_types = apps.get_model('contenttypes.ContentType')
content_types.objects.filter(
app_label='spirit', model='TopicPrivate'.lower()
).update(app_label='spirit_topic_private')
class Migration(migrations.Migration):
dependencies = [
('spirit', '0026_auto_20150724_2256'),
]
operations = [
migrations.RunPython(rename_model_content_type),
]

View File

@ -1,34 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0027_auto_20150724_2256'),
]
state_operations = [
migrations.AlterUniqueTogether(
name='topicunread',
unique_together=set([]),
),
migrations.RemoveField(
model_name='topicunread',
name='topic',
),
migrations.RemoveField(
model_name='topicunread',
name='user',
),
migrations.DeleteModel(
name='TopicUnread',
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def rename_model_content_type(apps, schema_editor):
content_types = apps.get_model('contenttypes.ContentType')
content_types.objects.filter(
app_label='spirit', model='TopicUnread'.lower()
).update(app_label='spirit_topic_unread')
class Migration(migrations.Migration):
dependencies = [
('spirit', '0028_auto_20150724_2304'),
]
operations = [
migrations.RunPython(rename_model_content_type),
]

View File

@ -1,34 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0029_auto_20150724_2304'),
]
state_operations = [
migrations.AlterUniqueTogether(
name='commentbookmark',
unique_together=set([]),
),
migrations.RemoveField(
model_name='commentbookmark',
name='topic',
),
migrations.RemoveField(
model_name='commentbookmark',
name='user',
),
migrations.DeleteModel(
name='CommentBookmark',
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def rename_model_content_type(apps, schema_editor):
content_types = apps.get_model('contenttypes.ContentType')
content_types.objects.filter(
app_label='spirit', model='CommentBookmark'.lower()
).update(app_label='spirit_comment_bookmark')
class Migration(migrations.Migration):
dependencies = [
('spirit', '0030_auto_20150724_2309'),
]
operations = [
migrations.RunPython(rename_model_content_type),
]

View File

@ -1,45 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0031_auto_20150724_2309'),
]
state_operations = [
migrations.RemoveField(
model_name='commentflag',
name='comment',
),
migrations.RemoveField(
model_name='commentflag',
name='moderator',
),
migrations.AlterUniqueTogether(
name='flag',
unique_together=set([]),
),
migrations.RemoveField(
model_name='flag',
name='comment',
),
migrations.RemoveField(
model_name='flag',
name='user',
),
migrations.DeleteModel(
name='CommentFlag',
),
migrations.DeleteModel(
name='Flag',
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def rename_model_content_type(apps, schema_editor):
content_types = apps.get_model('contenttypes.ContentType')
content_types.objects.filter(
app_label='spirit', model='CommentFlag'.lower()
).update(app_label='spirit_comment_flag')
content_types.objects.filter(
app_label='spirit', model='Flag'.lower()
).update(app_label='spirit_comment_flag')
class Migration(migrations.Migration):
dependencies = [
('spirit', '0032_auto_20150724_2315'),
]
operations = [
migrations.RunPython(rename_model_content_type),
]

View File

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0033_auto_20150724_2316'),
]
state_operations = [
migrations.RemoveField(
model_name='commenthistory',
name='comment_fk',
),
migrations.DeleteModel(
name='CommentHistory',
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def rename_model_content_type(apps, schema_editor):
content_types = apps.get_model('contenttypes.ContentType')
content_types.objects.filter(
app_label='spirit', model='CommentHistory'.lower()
).update(app_label='spirit_comment_history')
class Migration(migrations.Migration):
dependencies = [
('spirit', '0034_auto_20150724_2321'),
]
operations = [
migrations.RunPython(rename_model_content_type),
]

View File

@ -1,34 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit', '0035_auto_20150724_2321'),
]
state_operations = [
migrations.AlterUniqueTogether(
name='commentlike',
unique_together=set([]),
),
migrations.RemoveField(
model_name='commentlike',
name='comment',
),
migrations.RemoveField(
model_name='commentlike',
name='user',
),
migrations.DeleteModel(
name='CommentLike',
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def rename_model_content_type(apps, schema_editor):
content_types = apps.get_model('contenttypes.ContentType')
content_types.objects.filter(
app_label='spirit', model='CommentLike'.lower()
).update(app_label='spirit_comment_like')
class Migration(migrations.Migration):
dependencies = [
('spirit', '0036_auto_20150724_2329'),
]
operations = [
migrations.RunPython(rename_model_content_type),
]

View File

@ -27,8 +27,6 @@ ST_PRIVATE_FORUM = False
ST_ALLOWED_UPLOAD_IMAGE_FORMAT = ('jpeg', 'png', 'gif')
ST_INITIAL_MIGRATION_DEPENDENCIES = [] # [('myuser', '0001_initial'), ]
ST_UNICODE_SLUGS = True
ST_UNIQUE_EMAILS = True
@ -45,7 +43,6 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'spirit',
'spirit.core',
'spirit.admin',
'spirit.search',

View File

@ -9,25 +9,23 @@ from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('spirit_topic', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('spirit_topic', '0002_auto_20150724_2106'),
('spirit', '0018_auto_20150724_2153')
]
state_operations = [
operations = [
migrations.CreateModel(
name='TopicFavorite',
fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)),
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateTimeField(default=django.utils.timezone.now)),
('topic', models.ForeignKey(to='spirit_topic.Topic')),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['-date', '-pk'],
'verbose_name_plural': 'favorites',
'verbose_name': 'favorite',
'ordering': ['-date', '-pk'],
'db_table': 'spirit_favorite_topicfavorite',
},
),
migrations.AlterUniqueTogether(
@ -35,8 +33,3 @@ class Migration(migrations.Migration):
unique_together=set([('user', 'topic')]),
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,18 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit_topic_favorite', '0001_initial'),
]
operations = [
migrations.AlterModelTable(
name='topicfavorite',
table=None,
),
]

View File

@ -10,39 +10,32 @@ from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('spirit_category', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('spirit_category', '0002_auto_20150724_1644'),
('spirit', '0016_auto_20150724_2103')
]
state_operations = [
migrations.CreateModel(
name='Topic',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('title', models.CharField(verbose_name='title', max_length=255)),
('slug', spirit.core.utils.models.AutoSlugField(populate_from='title', db_index=False, blank=True)),
('date', models.DateTimeField(verbose_name='date', default=django.utils.timezone.now)),
('last_active', models.DateTimeField(verbose_name='last active', default=django.utils.timezone.now)),
('is_pinned', models.BooleanField(verbose_name='pinned', default=False)),
('is_globally_pinned', models.BooleanField(verbose_name='globally pinned', default=False)),
('is_closed', models.BooleanField(verbose_name='closed', default=False)),
('is_removed', models.BooleanField(default=False)),
('view_count', models.PositiveIntegerField(verbose_name='views count', default=0)),
('comment_count', models.PositiveIntegerField(verbose_name='comment count', default=0)),
('category', models.ForeignKey(verbose_name='category', to='spirit_category.Category')),
('user', models.ForeignKey(verbose_name='user', to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'topic',
'db_table': 'spirit_topic_topic',
'ordering': ['-last_active', '-pk'],
'verbose_name_plural': 'topics',
},
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
migrations.CreateModel(
name='Topic',
fields=[
('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')),
('title', models.CharField(max_length=255, verbose_name='title')),
('slug', spirit.core.utils.models.AutoSlugField(blank=True, db_index=False, populate_from='title')),
('date', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date')),
('last_active', models.DateTimeField(default=django.utils.timezone.now, verbose_name='last active')),
('is_pinned', models.BooleanField(default=False, verbose_name='pinned')),
('is_globally_pinned', models.BooleanField(default=False, verbose_name='globally pinned')),
('is_closed', models.BooleanField(default=False, verbose_name='closed')),
('is_removed', models.BooleanField(default=False)),
('view_count', models.PositiveIntegerField(default=0, verbose_name='views count')),
('comment_count', models.PositiveIntegerField(default=0, verbose_name='comment count')),
('category', models.ForeignKey(to='spirit_category.Category', verbose_name='category')),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, verbose_name='user')),
],
options={
'verbose_name_plural': 'topics',
'ordering': ['-last_active', '-pk'],
'verbose_name': 'topic',
},
),
]

View File

@ -1,18 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit_topic', '0001_initial'),
]
operations = [
migrations.AlterModelTable(
name='topic',
table=None,
),
]

View File

@ -2,37 +2,35 @@
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('spirit_topic', '0002_auto_20150724_2106'),
('spirit_comment', '0002_auto_20150724_2212'),
('spirit', '0022_auto_20150724_2232')
('spirit_topic', '0001_initial'),
('spirit_comment', '__first__'),
]
state_operations = [
operations = [
migrations.CreateModel(
name='TopicNotification',
fields=[
('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')),
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)),
('date', models.DateTimeField(default=django.utils.timezone.now)),
('action', models.IntegerField(default=0, choices=[(0, 'Undefined'), (1, 'Mention'), (2, 'Comment')])),
('is_read', models.BooleanField(default=False)),
('is_active', models.BooleanField(default=False)),
('comment', models.ForeignKey(null=True, to='spirit_comment.Comment', blank=True)),
('comment', models.ForeignKey(to='spirit_comment.Comment')),
('topic', models.ForeignKey(to='spirit_topic.Topic')),
('user', models.ForeignKey(verbose_name='user', to=settings.AUTH_USER_MODEL)),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, verbose_name='user')),
],
options={
'verbose_name': 'topic notification',
'db_table': 'spirit_notification_topicnotification',
'ordering': ['-date', '-pk'],
'verbose_name_plural': 'topics notification',
'verbose_name': 'topic notification',
'ordering': ['-date', '-pk'],
},
),
migrations.AlterUniqueTogether(
@ -40,8 +38,3 @@ class Migration(migrations.Migration):
unique_together=set([('user', 'topic')]),
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,18 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit_topic_notification', '0001_initial'),
]
operations = [
migrations.AlterModelTable(
name='topicnotification',
table=None,
),
]

View File

@ -1,24 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def populate_comments_for_nulls(apps, schema_editor):
TopicNotification = apps.get_model('spirit_topic_notification.TopicNotification')
notifications = TopicNotification.objects.filter(comment=None)
for n in notifications:
TopicNotification.objects\
.filter(pk=n.pk)\
.update(comment=n.topic.comment_set.last(), action=0)
class Migration(migrations.Migration):
dependencies = [
('spirit_topic_notification', '0002_auto_20150724_2238'),
]
operations = [
migrations.RunPython(populate_comments_for_nulls),
]

View File

@ -1,19 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit_topic_notification', '0003_auto_20150726_0203'),
]
operations = [
migrations.AlterField(
model_name='topicnotification',
name='comment',
field=models.ForeignKey(to='spirit_comment.Comment'),
),
]

View File

@ -10,3 +10,9 @@ class SpiritTopicPollConfig(AppConfig):
name = 'spirit.topic.poll'
verbose_name = "Spirit Topic Poll"
label = 'spirit_topic_poll'
def ready(self):
self.register_signals()
def register_signals(self):
from . import signals

View File

@ -9,52 +9,48 @@ from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('spirit_topic', '0002_auto_20150724_2106'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('spirit', '0024_auto_20150724_2248')
('spirit_topic', '0001_initial'),
]
state_operations = [
operations = [
migrations.CreateModel(
name='TopicPoll',
fields=[
('topic', models.OneToOneField(verbose_name='topic', related_name='poll', serialize=False, to='spirit_topic.Topic', primary_key=True)),
('topic', models.OneToOneField(serialize=False, to='spirit_topic.Topic', verbose_name='topic', primary_key=True, related_name='poll')),
('date', models.DateTimeField(default=django.utils.timezone.now)),
('choice_limit', models.PositiveIntegerField(verbose_name='choice limit', default=1)),
('choice_limit', models.PositiveIntegerField(default=1, verbose_name='choice limit')),
('is_closed', models.BooleanField(default=False)),
],
options={
'verbose_name_plural': 'topics polls',
'verbose_name': 'topic poll',
'db_table': 'spirit_poll_topicpoll',
},
),
migrations.CreateModel(
name='TopicPollChoice',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)),
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('description', models.CharField(max_length=255, verbose_name='choice description')),
('vote_count', models.PositiveIntegerField(verbose_name='vote count', default=0)),
('poll', models.ForeignKey(verbose_name='poll', related_name='choices', to='spirit_topic_poll.TopicPoll')),
('vote_count', models.PositiveIntegerField(default=0, verbose_name='vote count')),
('poll', models.ForeignKey(to='spirit_topic_poll.TopicPoll', verbose_name='poll', related_name='choices')),
],
options={
'verbose_name_plural': 'poll choices',
'verbose_name': 'poll choice',
'db_table': 'spirit_poll_topicpollchoice',
},
),
migrations.CreateModel(
name='TopicPollVote',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)),
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateTimeField(default=django.utils.timezone.now)),
('choice', models.ForeignKey(verbose_name='poll choice', related_name='votes', to='spirit_topic_poll.TopicPollChoice')),
('choice', models.ForeignKey(to='spirit_topic_poll.TopicPollChoice', verbose_name='poll choice', related_name='votes')),
('user', models.ForeignKey(verbose_name='voter', to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name_plural': 'poll votes',
'verbose_name': 'poll vote',
'db_table': 'spirit_poll_topicpollvote',
},
),
migrations.AlterUniqueTogether(
@ -62,8 +58,3 @@ class Migration(migrations.Migration):
unique_together=set([('user', 'choice')]),
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit_topic_poll', '0001_initial'),
]
operations = [
migrations.AlterModelTable(
name='topicpoll',
table=None,
),
migrations.AlterModelTable(
name='topicpollchoice',
table=None,
),
migrations.AlterModelTable(
name='topicpollvote',
table=None,
),
]

View File

@ -2,32 +2,30 @@
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('spirit_topic', '0002_auto_20150724_2106'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('spirit', '0026_auto_20150724_2256')
('spirit_topic', '0001_initial'),
]
state_operations = [
operations = [
migrations.CreateModel(
name='TopicPrivate',
fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', serialize=False, auto_created=True)),
('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)),
('date', models.DateTimeField(default=django.utils.timezone.now)),
('topic', models.ForeignKey(to='spirit_topic.Topic', related_name='topics_private')),
('topic', models.ForeignKey(related_name='topics_private', to='spirit_topic.Topic')),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'private topic',
'verbose_name_plural': 'private topics',
'db_table': 'spirit_private_topicprivate',
'ordering': ['-date', '-pk'],
'verbose_name_plural': 'private topics',
},
),
migrations.AlterUniqueTogether(
@ -35,8 +33,3 @@ class Migration(migrations.Migration):
unique_together=set([('user', 'topic')]),
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,18 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit_topic_private', '0001_initial'),
]
operations = [
migrations.AlterModelTable(
name='topicprivate',
table=None,
),
]

View File

@ -9,26 +9,24 @@ from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('spirit_topic', '0002_auto_20150724_2106'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('spirit', '0028_auto_20150724_2304')
('spirit_topic', '0001_initial'),
]
state_operations = [
operations = [
migrations.CreateModel(
name='TopicUnread',
fields=[
('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')),
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True, serialize=False)),
('date', models.DateTimeField(default=django.utils.timezone.now)),
('is_read', models.BooleanField(default=True)),
('topic', models.ForeignKey(to='spirit_topic.Topic')),
('user', models.ForeignKey(verbose_name='user', to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['-date', '-pk'],
'verbose_name': 'topic unread',
'ordering': ['-date', '-pk'],
'verbose_name_plural': 'topics unread',
'db_table': 'spirit_unread_topicunread',
},
),
migrations.AlterUniqueTogether(
@ -36,8 +34,3 @@ class Migration(migrations.Migration):
unique_together=set([('user', 'topic')]),
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]

View File

@ -1,18 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit_topic_unread', '0001_initial'),
]
operations = [
migrations.AlterModelTable(
name='topicunread',
table=None,
),
]

View File

@ -10,3 +10,9 @@ class SpiritUserConfig(AppConfig):
name = 'spirit.user'
verbose_name = "Spirit User"
label = 'spirit_user'
def ready(self):
self.register_signals()
def register_signals(self):
from . import signals

View File

@ -2,43 +2,80 @@
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import django.utils.timezone
import django.contrib.auth.models
import spirit.core.utils.models
import re
from django.conf import settings
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('auth', '0006_require_contenttypes_0002'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('spirit', '0014_auto_20150724_1938')
]
state_operations = [
migrations.CreateModel(
name='UserProfile',
fields=[
('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
('slug', spirit.core.utils.models.AutoSlugField(db_index=False, blank=True, populate_from='user.username')),
('location', models.CharField(verbose_name='location', blank=True, max_length=75)),
('last_seen', models.DateTimeField(verbose_name='last seen', auto_now=True)),
('last_ip', models.GenericIPAddressField(verbose_name='last ip', blank=True, null=True)),
('timezone', models.CharField(verbose_name='time zone', choices=[('Etc/GMT+12', '(GMT -12:00) Eniwetok, Kwajalein'), ('Etc/GMT+11', '(GMT -11:00) Midway Island, Samoa'), ('Etc/GMT+10', '(GMT -10:00) Hawaii'), ('Pacific/Marquesas', '(GMT -9:30) Marquesas Islands'), ('Etc/GMT+9', '(GMT -9:00) Alaska'), ('Etc/GMT+8', '(GMT -8:00) Pacific Time (US & Canada)'), ('Etc/GMT+7', '(GMT -7:00) Mountain Time (US & Canada)'), ('Etc/GMT+6', '(GMT -6:00) Central Time (US & Canada), Mexico City'), ('Etc/GMT+5', '(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima'), ('America/Caracas', '(GMT -4:30) Venezuela'), ('Etc/GMT+4', '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz'), ('Etc/GMT+3', '(GMT -3:00) Brazil, Buenos Aires, Georgetown'), ('Etc/GMT+2', '(GMT -2:00) Mid-Atlantic'), ('Etc/GMT+1', '(GMT -1:00) Azores, Cape Verde Islands'), ('UTC', '(GMT) Western Europe Time, London, Lisbon, Casablanca'), ('Etc/GMT-1', '(GMT +1:00) Brussels, Copenhagen, Madrid, Paris'), ('Etc/GMT-2', '(GMT +2:00) Kaliningrad, South Africa'), ('Etc/GMT-3', '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg'), ('Etc/GMT-4', '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi'), ('Asia/Kabul', '(GMT +4:30) Afghanistan'), ('Etc/GMT-5', '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent'), ('Asia/Kolkata', '(GMT +5:30) India, Sri Lanka'), ('Asia/Kathmandu', '(GMT +5:45) Nepal'), ('Etc/GMT-6', '(GMT +6:00) Almaty, Dhaka, Colombo'), ('Indian/Cocos', '(GMT +6:30) Cocos Islands, Myanmar'), ('Etc/GMT-7', '(GMT +7:00) Bangkok, Hanoi, Jakarta'), ('Etc/GMT-8', '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong'), ('Australia/Eucla', '(GMT +8:45) Australia (Eucla)'), ('Etc/GMT-9', '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk'), ('Australia/North', '(GMT +9:30) Australia (Northern Territory)'), ('Etc/GMT-10', '(GMT +10:00) Eastern Australia, Guam, Vladivostok'), ('Etc/GMT-11', '(GMT +11:00) Magadan, Solomon Islands, New Caledonia'), ('Pacific/Norfolk', '(GMT +11:30) Norfolk Island'), ('Etc/GMT-12', '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka')], default='UTC', max_length=32)),
('is_administrator', models.BooleanField(verbose_name='administrator status', default=False)),
('is_moderator', models.BooleanField(verbose_name='moderator status', default=False)),
('is_verified', models.BooleanField(help_text='Designates whether the user has verified his account by email or by other means. Un-select this to let the user activate his account.', verbose_name='verified', default=False)),
('topic_count', models.PositiveIntegerField(verbose_name='topic count', default=0)),
('comment_count', models.PositiveIntegerField(verbose_name='comment count', default=0)),
('user', models.OneToOneField(verbose_name='profile', to=settings.AUTH_USER_MODEL, related_name='st')),
],
options={
'verbose_name': 'forum profile',
'verbose_name_plural': 'forum profiles',
'db_table': 'spirit_user_userprofile',
},
),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=state_operations)
]
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(null=True, verbose_name='last login', blank=True)),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('slug', spirit.core.utils.models.AutoSlugField(populate_from='username', db_index=False, blank=True)),
('location', models.CharField(max_length=75, verbose_name='location', blank=True)),
('last_seen', models.DateTimeField(auto_now=True, verbose_name='last seen')),
('last_ip', models.GenericIPAddressField(null=True, verbose_name='last ip', blank=True)),
('timezone', models.CharField(default='UTC', choices=[('Etc/GMT+12', '(GMT -12:00) Eniwetok, Kwajalein'), ('Etc/GMT+11', '(GMT -11:00) Midway Island, Samoa'), ('Etc/GMT+10', '(GMT -10:00) Hawaii'), ('Pacific/Marquesas', '(GMT -9:30) Marquesas Islands'), ('Etc/GMT+9', '(GMT -9:00) Alaska'), ('Etc/GMT+8', '(GMT -8:00) Pacific Time (US & Canada)'), ('Etc/GMT+7', '(GMT -7:00) Mountain Time (US & Canada)'), ('Etc/GMT+6', '(GMT -6:00) Central Time (US & Canada), Mexico City'), ('Etc/GMT+5', '(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima'), ('America/Caracas', '(GMT -4:30) Venezuela'), ('Etc/GMT+4', '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz'), ('Etc/GMT+3', '(GMT -3:00) Brazil, Buenos Aires, Georgetown'), ('Etc/GMT+2', '(GMT -2:00) Mid-Atlantic'), ('Etc/GMT+1', '(GMT -1:00) Azores, Cape Verde Islands'), ('UTC', '(GMT) Western Europe Time, London, Lisbon, Casablanca'), ('Etc/GMT-1', '(GMT +1:00) Brussels, Copenhagen, Madrid, Paris'), ('Etc/GMT-2', '(GMT +2:00) Kaliningrad, South Africa'), ('Etc/GMT-3', '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg'), ('Etc/GMT-4', '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi'), ('Asia/Kabul', '(GMT +4:30) Afghanistan'), ('Etc/GMT-5', '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent'), ('Asia/Kolkata', '(GMT +5:30) India, Sri Lanka'), ('Asia/Kathmandu', '(GMT +5:45) Nepal'), ('Etc/GMT-6', '(GMT +6:00) Almaty, Dhaka, Colombo'), ('Indian/Cocos', '(GMT +6:30) Cocos Islands, Myanmar'), ('Etc/GMT-7', '(GMT +7:00) Bangkok, Hanoi, Jakarta'), ('Etc/GMT-8', '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong'), ('Australia/Eucla', '(GMT +8:45) Australia (Eucla)'), ('Etc/GMT-9', '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk'), ('Australia/North', '(GMT +9:30) Australia (Northern Territory)'), ('Etc/GMT-10', '(GMT +10:00) Eastern Australia, Guam, Vladivostok'), ('Etc/GMT-11', '(GMT +11:00) Magadan, Solomon Islands, New Caledonia'), ('Pacific/Norfolk', '(GMT +11:30) Norfolk Island'), ('Etc/GMT-12', '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka')], max_length=32, verbose_name='time zone')),
('is_administrator', models.BooleanField(default=False, verbose_name='administrator status')),
('is_moderator', models.BooleanField(default=False, verbose_name='moderator status')),
('is_verified', models.BooleanField(default=False, help_text='Designates whether the user has verified his account by email or by other means. Un-select this to let the user activate his account.', verbose_name='verified')),
('topic_count', models.PositiveIntegerField(default=0, verbose_name='topic count')),
('comment_count', models.PositiveIntegerField(default=0, verbose_name='comment count')),
('username', models.CharField(unique=True, db_index=True, verbose_name='username', validators=[django.core.validators.RegexValidator(re.compile('^[\\w.@+-]+$', 32), 'Enter a valid username.', 'invalid')], help_text='Required. 30 characters or fewer. Letters, numbers and @/./+/-/_ characters', max_length=30)),
('first_name', models.CharField(max_length=30, verbose_name='first name', blank=True)),
('last_name', models.CharField(max_length=30, verbose_name='last name', blank=True)),
('email', models.EmailField(unique=True, max_length=254, verbose_name='email')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('groups', models.ManyToManyField(related_query_name='user', verbose_name='groups', blank=True, to='auth.Group', help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set')),
('user_permissions', models.ManyToManyField(related_query_name='user', verbose_name='user permissions', blank=True, to='auth.Permission', help_text='Specific permissions for this user.', related_name='user_set')),
],
options={
'verbose_name_plural': 'users',
'ordering': ['-date_joined', '-pk'],
'db_table': 'spirit_user_user',
'verbose_name': 'user',
'abstract': False,
'swappable': 'AUTH_USER_MODEL',
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
migrations.CreateModel(
name='UserProfile',
fields=[
('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')),
('slug', spirit.core.utils.models.AutoSlugField(populate_from='user.username', db_index=False, blank=True)),
('location', models.CharField(max_length=75, verbose_name='location', blank=True)),
('last_seen', models.DateTimeField(auto_now=True, verbose_name='last seen')),
('last_ip', models.GenericIPAddressField(null=True, verbose_name='last ip', blank=True)),
('timezone', models.CharField(default='UTC', choices=[('Etc/GMT+12', '(GMT -12:00) Eniwetok, Kwajalein'), ('Etc/GMT+11', '(GMT -11:00) Midway Island, Samoa'), ('Etc/GMT+10', '(GMT -10:00) Hawaii'), ('Pacific/Marquesas', '(GMT -9:30) Marquesas Islands'), ('Etc/GMT+9', '(GMT -9:00) Alaska'), ('Etc/GMT+8', '(GMT -8:00) Pacific Time (US & Canada)'), ('Etc/GMT+7', '(GMT -7:00) Mountain Time (US & Canada)'), ('Etc/GMT+6', '(GMT -6:00) Central Time (US & Canada), Mexico City'), ('Etc/GMT+5', '(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima'), ('America/Caracas', '(GMT -4:30) Venezuela'), ('Etc/GMT+4', '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz'), ('Etc/GMT+3', '(GMT -3:00) Brazil, Buenos Aires, Georgetown'), ('Etc/GMT+2', '(GMT -2:00) Mid-Atlantic'), ('Etc/GMT+1', '(GMT -1:00) Azores, Cape Verde Islands'), ('UTC', '(GMT) Western Europe Time, London, Lisbon, Casablanca'), ('Etc/GMT-1', '(GMT +1:00) Brussels, Copenhagen, Madrid, Paris'), ('Etc/GMT-2', '(GMT +2:00) Kaliningrad, South Africa'), ('Etc/GMT-3', '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg'), ('Etc/GMT-4', '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi'), ('Asia/Kabul', '(GMT +4:30) Afghanistan'), ('Etc/GMT-5', '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent'), ('Asia/Kolkata', '(GMT +5:30) India, Sri Lanka'), ('Asia/Kathmandu', '(GMT +5:45) Nepal'), ('Etc/GMT-6', '(GMT +6:00) Almaty, Dhaka, Colombo'), ('Indian/Cocos', '(GMT +6:30) Cocos Islands, Myanmar'), ('Etc/GMT-7', '(GMT +7:00) Bangkok, Hanoi, Jakarta'), ('Etc/GMT-8', '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong'), ('Australia/Eucla', '(GMT +8:45) Australia (Eucla)'), ('Etc/GMT-9', '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk'), ('Australia/North', '(GMT +9:30) Australia (Northern Territory)'), ('Etc/GMT-10', '(GMT +10:00) Eastern Australia, Guam, Vladivostok'), ('Etc/GMT-11', '(GMT +11:00) Magadan, Solomon Islands, New Caledonia'), ('Pacific/Norfolk', '(GMT +11:30) Norfolk Island'), ('Etc/GMT-12', '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka')], max_length=32, verbose_name='time zone')),
('is_administrator', models.BooleanField(default=False, verbose_name='administrator status')),
('is_moderator', models.BooleanField(default=False, verbose_name='moderator status')),
('is_verified', models.BooleanField(default=False, help_text='Designates whether the user has verified his account by email or by other means. Un-select this to let the user activate his account.', verbose_name='verified')),
('topic_count', models.PositiveIntegerField(default=0, verbose_name='topic count')),
('comment_count', models.PositiveIntegerField(default=0, verbose_name='comment count')),
('user', models.OneToOneField(verbose_name='profile', to=settings.AUTH_USER_MODEL, related_name='st')),
],
options={
'verbose_name_plural': 'forum profiles',
'verbose_name': 'forum profile',
},
),
]

View File

@ -1,18 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spirit_user', '0001_initial'),
]
operations = [
migrations.AlterModelTable(
name='userprofile',
table=None,
),
]

View File

@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('spirit_user', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='comment_count',
),
migrations.RemoveField(
model_name='user',
name='is_administrator',
),
migrations.RemoveField(
model_name='user',
name='is_moderator',
),
migrations.RemoveField(
model_name='user',
name='is_verified',
),
migrations.RemoveField(
model_name='user',
name='last_ip',
),
migrations.RemoveField(
model_name='user',
name='last_seen',
),
migrations.RemoveField(
model_name='user',
name='location',
),
migrations.RemoveField(
model_name='user',
name='slug',
),
migrations.RemoveField(
model_name='user',
name='timezone',
),
migrations.RemoveField(
model_name='user',
name='topic_count',
),
migrations.AlterField(
model_name='user',
name='email',
field=models.EmailField(verbose_name='email address', blank=True, max_length=254),
),
migrations.AlterField(
model_name='user',
name='username',
field=models.CharField(validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters.', 'invalid')], max_length=30, error_messages={'unique': 'A user with that username already exists.'}, verbose_name='username', help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', unique=True),
),
]

View File

@ -7,14 +7,14 @@ from django.db import models, migrations
def rename_model_content_type(apps, schema_editor):
content_types = apps.get_model('contenttypes.ContentType')
content_types.objects.filter(
app_label='spirit', model='UserProfile'.lower()
app_label='spirit', model='User'.lower()
).update(app_label='spirit_user')
class Migration(migrations.Migration):
dependencies = [
('spirit', '0014_auto_20150724_1938'),
('spirit_user', '0002_auto_20150728_0447'),
]
operations = [

View File

@ -1,16 +1,12 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from django.db import models
from django.core.urlresolvers import reverse
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, UserManager
from django.core.mail import send_mail
from django.core import validators
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from ..core.utils.timezone import TIMEZONE_CHOICES
from ..core.utils.models import AutoSlugField
@ -51,84 +47,10 @@ class UserProfile(models.Model):
return reverse('spirit:user:detail', kwargs={'pk': self.user.pk, 'slug': self.slug})
class AbstractForumUser(models.Model):
# TODO: DEPRECATED
slug = AutoSlugField(populate_from="username", db_index=False, blank=True)
location = models.CharField(_("location"), max_length=75, blank=True)
last_seen = models.DateTimeField(_("last seen"), auto_now=True)
last_ip = models.GenericIPAddressField(_("last ip"), blank=True, null=True)
timezone = models.CharField(_("time zone"), max_length=32, choices=TIMEZONE_CHOICES, default='UTC')
is_administrator = models.BooleanField(_('administrator status'), default=False)
is_moderator = models.BooleanField(_('moderator status'), default=False)
is_verified = models.BooleanField(_('verified'), default=False,
help_text=_('Designates whether the user has verified his '
'account by email or by other means. Un-select this '
'to let the user activate his account.'))
topic_count = models.PositiveIntegerField(_("topic count"), default=0)
comment_count = models.PositiveIntegerField(_("comment count"), default=0)
class Meta:
abstract = True
def save(self, *args, **kwargs):
if self.is_superuser:
self.is_administrator = True
if self.is_administrator:
self.is_moderator = True
super(AbstractForumUser, self).save(*args, **kwargs)
class AbstractUser(AbstractBaseUser, PermissionsMixin, AbstractForumUser):
# TODO: DEPRECATED
username = models.CharField(_("username"), max_length=30, unique=True, db_index=True,
help_text=_('Required. 30 characters or fewer. Letters, numbers and '
'@/./+/-/_ characters'),
validators=[
validators.RegexValidator(re.compile('^[\w.@+-]+$'), _('Enter a valid username.'),
'invalid')
])
first_name = models.CharField(_("first name"), max_length=30, blank=True)
last_name = models.CharField(_("last name"), max_length=30, blank=True)
email = models.EmailField(_("email"), max_length=254, unique=True)
is_staff = models.BooleanField(_('staff status'), default=False,
help_text=_('Designates whether the user can log into this admin '
'site.'))
is_active = models.BooleanField(_('active'), default=True,
help_text=_('Designates whether this user should be treated as '
'active. Unselect this instead of deleting accounts.'))
date_joined = models.DateTimeField(_('date joined'), default=timezone.now)
objects = UserManager()
USERNAME_FIELD = 'username'
REQUIRED_FIELDS = ['email', ]
class Meta:
abstract = True
def get_absolute_url(self):
return reverse('spirit:user:detail', kwargs={'pk': self.pk,
'slug': self.slug})
def get_full_name(self):
full_name = '%s %s' % (self.first_name, self.last_name)
return full_name.strip()
def get_short_name(self):
return self.first_name
def email_user(self, subject, message, from_email=None):
send_mail(subject, message, from_email, [self.email, ])
class User(AbstractUser):
class Meta(AbstractUser.Meta):
swappable = 'AUTH_USER_MODEL'
app_label = 'spirit'
ordering = ['-date_joined', '-pk']
verbose_name = _('user')
verbose_name_plural = _('users')