Fixed website. Fixing references to db_references, not sure how to add the m2m field access to the admin. Fixed wrapper for db_home.

This commit is contained in:
Griatch 2013-09-23 22:08:14 +02:00
parent 272a6ddc2d
commit fd9acd6bf9
11 changed files with 187 additions and 261 deletions

View file

@ -94,11 +94,11 @@ class PlayerForm(forms.ModelForm):
initial=settings.BASE_PLAYER_TYPECLASS,
widget=forms.TextInput(attrs={'size':'78'}),
help_text="Required. Defines what 'type' of entity this is. This variable holds a Python path to a module with a valid Evennia Typeclass. Defaults to settings.BASE_PLAYER_TYPECLASS.")
db_permissions = forms.CharField(label="Permissions",
initial=settings.PERMISSION_PLAYER_DEFAULT,
required=False,
widget=forms.TextInput(attrs={'size':'78'}),
help_text="In-game permissions. A comma-separated list of text strings checked by certain locks. They are often used for hierarchies, such as letting a Player have permission 'Wizards', 'Builders' etc. A Player permission can be overloaded by the permissions of a controlled Character. Normal players use 'Players' by default.")
#db_permissions = forms.CharField(label="Permissions",
# initial=settings.PERMISSION_PLAYER_DEFAULT,
# required=False,
# widget=forms.TextInput(attrs={'size':'78'}),
# help_text="In-game permissions. A comma-separated list of text strings checked by certain locks. They are often used for hierarchies, such as letting a Player have permission 'Wizards', 'Builders' etc. A Player permission can be overloaded by the permissions of a controlled Character. Normal players use 'Players' by default.")
db_lock_storage = forms.CharField(label="Locks",
widget=forms.Textarea(attrs={'cols':'100', 'rows':'2'}),
required=False,
@ -116,7 +116,8 @@ class PlayerInline(admin.StackedInline):
form = PlayerForm
fieldsets = (
("In-game Permissions and Locks",
{'fields': ('db_permissions', 'db_lock_storage'),
{'fields': ('db_lock_storage',),
#{'fields': ('db_permissions', 'db_lock_storage'),
'description':"<i>These are permissions/locks for in-game use. They are unrelated to website access rights.</i>"}),
("In-game Player data",
{'fields':('db_typeclass_path', 'db_cmdset_storage'),
@ -140,8 +141,10 @@ class PlayerDBAdmin(BaseUserAdmin):
'description':'<i>Relevant only to the website.</i>'}),
('Website Permissions', {'fields': ('is_active', 'is_staff', 'is_superuser', 'user_permissions','groups'),
'description': "<i>These are permissions/permission groups for accessing the admin site. They are unrelated to in-game access rights.</i>"}),
('Game Options', {'fields': ('db_typeclass_path', 'db_cmdset_storage', 'db_permissions', 'db_lock_storage'),
('Game Options', {'fields': ('db_typeclass_path', 'db_cmdset_storage', 'db_lock_storage'),
'description': '<i>These are attributes that are more relevant to gameplay.</i>'}))
#('Game Options', {'fields': ('db_typeclass_path', 'db_cmdset_storage', 'db_permissions', 'db_lock_storage'),
# 'description': '<i>These are attributes that are more relevant to gameplay.</i>'}))
add_fieldsets = (

View file

@ -21,8 +21,6 @@ from django.db import models
from django.contrib.auth.models import AbstractUser
from django.utils.encoding import smart_str
from src.server.caches import get_field_cache, set_field_cache
from src.players import manager
from src.scripts.models import ScriptDB
from src.typeclasses.models import TypedObject, TagHandler, NickHandler, AliasHandler, AttributeHandler
@ -165,19 +163,19 @@ class PlayerDB(TypedObject, AbstractUser):
_GA(self, "save")()
cmdset_storage = property(cmdset_storage_get, cmdset_storage_set, cmdset_storage_del)
#@property
def is_connected_get(self):
"Getter. Allows for value = self.is_connected"
return get_field_cache(self, "is_connected")
#@is_connected.setter
def is_connected_set(self, value):
"Setter. Allows for self.is_connected = value"
set_field_cache(self, "is_connected", value)
#@is_connected.deleter
def is_connected_del(self):
"Deleter. Allows for del is_connected"
set_field_cache(self, "is_connected", False)
is_connected = property(is_connected_get, is_connected_set, is_connected_del)
##@property
#def is_connected_get(self):
# "Getter. Allows for value = self.is_connected"
# return get_field_cache(self, "is_connected")
##@is_connected.setter
#def is_connected_set(self, value):
# "Setter. Allows for self.is_connected = value"
# set_field_cache(self, "is_connected", value)
##@is_connected.deleter
#def is_connected_del(self):
# "Deleter. Allows for del is_connected"
# set_field_cache(self, "is_connected", False)
#is_connected = property(is_connected_get, is_connected_set, is_connected_del)
class Meta:
"Define Django meta options"