Resolve django 1.11 migration errors.
This commit is contained in:
commit
0ff1718437
54 changed files with 6444 additions and 574 deletions
32
evennia/objects/migrations/0006_auto_20170606_1731.py
Normal file
32
evennia/objects/migrations/0006_auto_20170606_1731.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.2 on 2017-06-06 17:31
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
import re
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('objects', '0005_auto_20150403_2339'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='objectdb',
|
||||
name='db_attributes',
|
||||
field=models.ManyToManyField(help_text=b'attributes on this object. An attribute can hold any pickle-able python object (see docs for special cases).', to='typeclasses.Attribute'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='objectdb',
|
||||
name='db_sessid',
|
||||
field=models.CharField(help_text=b'csv list of session ids of connected Player, if any.', max_length=32, null=True, validators=[django.core.validators.RegexValidator(re.compile('^\\d+(?:\\,\\d+)*\\Z'), code='invalid', message='Enter only digits separated by commas.')], verbose_name=b'session id'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='objectdb',
|
||||
name='db_tags',
|
||||
field=models.ManyToManyField(help_text=b'tags on this object. Tags are simple string markers to identify, group and alias objects.', to='typeclasses.Tag'),
|
||||
),
|
||||
]
|
||||
|
|
@ -18,6 +18,7 @@ from builtins import object
|
|||
from django.conf import settings
|
||||
from django.db import models
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.validators import validate_comma_separated_integer_list
|
||||
|
||||
from evennia.typeclasses.models import TypedObject
|
||||
from evennia.objects.manager import ObjectDBManager
|
||||
|
|
@ -172,7 +173,8 @@ class ObjectDB(TypedObject):
|
|||
db_player = models.ForeignKey("players.PlayerDB", null=True, verbose_name='player', on_delete=models.SET_NULL,
|
||||
help_text='a Player connected to this object, if any.')
|
||||
# the session id associated with this player, if any
|
||||
db_sessid = models.CommaSeparatedIntegerField(null=True, max_length=32, verbose_name="session id",
|
||||
db_sessid = models.CharField(null=True, max_length=32, validators=[validate_comma_separated_integer_list],
|
||||
verbose_name="session id",
|
||||
help_text="csv list of session ids of connected Player, if any.")
|
||||
# The location in the game world. Since this one is likely
|
||||
# to change often, we set this with the 'location' property
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class ObjectSessionHandler(object):
|
|||
self._sessid_cache = list(set(int(val) for val in (self.obj.db_sessid or "").split(",") if val))
|
||||
if any(sessid for sessid in self._sessid_cache if sessid not in _SESSIONS):
|
||||
# cache is out of sync with sessionhandler! Only retain the ones in the handler.
|
||||
self.sessid_cache = [sessid for sessid in self._sessid_cache if sessid in _SESSIONS]
|
||||
self._sessid_cache = [sessid for sessid in self._sessid_cache if sessid in _SESSIONS]
|
||||
self.obj.db_sessid = ",".join(str(val) for val in self._sessid_cache)
|
||||
self.obj.save(update_fields=["db_sessid"])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue