Run migrations! Added Tagging to default Msg object.
This commit is contained in:
parent
6db109c333
commit
836c9913d5
2 changed files with 28 additions and 0 deletions
20
evennia/comms/migrations/0007_msg_db_tags.py
Normal file
20
evennia/comms/migrations/0007_msg_db_tags.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('typeclasses', '0004_auto_20151101_1759'),
|
||||
('comms', '0006_channeldb_db_object_subscriptions'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='msg',
|
||||
name='db_tags',
|
||||
field=models.ManyToManyField(help_text=b'tags on this message. Tags are simple string markers to identify, group and alias messages.', to='typeclasses.Tag', null=True),
|
||||
),
|
||||
]
|
||||
|
|
@ -22,6 +22,7 @@ from django.conf import settings
|
|||
from django.utils import timezone
|
||||
from django.db import models
|
||||
from evennia.typeclasses.models import TypedObject
|
||||
from evennia.typeclasses.tags import Tag, TagHandler
|
||||
from evennia.utils.idmapper.models import SharedMemoryModel
|
||||
from evennia.comms import managers
|
||||
from evennia.locks.lockhandler import LockHandler
|
||||
|
|
@ -107,6 +108,9 @@ class Msg(SharedMemoryModel):
|
|||
db_hide_from_objects = models.ManyToManyField("objects.ObjectDB", related_name='hide_from_objects_set', null=True)
|
||||
db_hide_from_channels = models.ManyToManyField("ChannelDB", related_name='hide_from_channels_set', null=True)
|
||||
|
||||
db_tags = models.ManyToManyField(Tag, null=True,
|
||||
help_text='tags on this message. Tags are simple string markers to identify, group and alias messages.')
|
||||
|
||||
# Database manager
|
||||
objects = managers.MsgManager()
|
||||
_is_deleted = False
|
||||
|
|
@ -123,6 +127,10 @@ class Msg(SharedMemoryModel):
|
|||
def locks(self):
|
||||
return LockHandler(self)
|
||||
|
||||
@lazy_property
|
||||
def tags(self):
|
||||
return TagHandler(self)
|
||||
|
||||
# Wrapper properties to easily set database fields. These are
|
||||
# @property decorators that allows to access these fields using
|
||||
# normal python operations (without having to remember to save()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue