mirror of
https://github.com/evennia/evennia.git
synced 2026-03-21 07:16:31 +01:00
Tidying up the admin interface by adding more verbose and helpful names to database fields as well as adding more help texts. The ObjectAdmin still gives tracebacks.
This commit is contained in:
parent
6ae1123421
commit
7f2e6dd4fa
11 changed files with 137 additions and 80 deletions
|
|
@ -11,13 +11,15 @@ class ObjAttributeInline(admin.TabularInline):
|
|||
fields = ('db_key', 'db_value')
|
||||
max_num = 1
|
||||
|
||||
class ObjectDBAdmin(admin.ModelAdmin):
|
||||
inlines = [ObjAttributeInline]
|
||||
class ObjectDBAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'db_key', 'db_location', 'db_player', 'db_typeclass_path')
|
||||
list_display_links = ('id', 'db_key')
|
||||
ordering = ['db_player', 'db_typeclass_path', 'id']
|
||||
search_fields = ['^db_key', 'db_typeclass_path']
|
||||
|
||||
save_as = True
|
||||
save_on_top = True
|
||||
list_select_related = True
|
||||
inlines = [ObjAttributeInline]
|
||||
|
||||
admin.site.register(ObjectDB, ObjectDBAdmin)
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ class Alias(SharedMemoryModel):
|
|||
is so as to allow for effective global searches also by
|
||||
alias.
|
||||
"""
|
||||
db_key = models.CharField(max_length=255)
|
||||
db_obj = models.ForeignKey("ObjectDB")
|
||||
db_key = models.CharField('alias', max_length=255)
|
||||
db_obj = models.ForeignKey("ObjectDB", verbose_name='object')
|
||||
|
||||
class Meta:
|
||||
"Define Django meta options"
|
||||
|
|
@ -92,12 +92,12 @@ class ObjectNick(TypeNick):
|
|||
obj - match against object searches
|
||||
channel - used to store own names for channels
|
||||
"""
|
||||
db_obj = models.ForeignKey("ObjectDB")
|
||||
db_obj = models.ForeignKey("ObjectDB", verbose_name='object')
|
||||
|
||||
class Meta:
|
||||
"Define Django meta options"
|
||||
verbose_name = "Nickname for Objects"
|
||||
verbose_name_plural = "Nicknames Objects"
|
||||
verbose_name_plural = "Nicknames for Objects"
|
||||
unique_together = ("db_nick", "db_type", "db_obj")
|
||||
|
||||
class ObjectNickHandler(TypeNickHandler):
|
||||
|
|
@ -163,20 +163,22 @@ class ObjectDB(TypedObject):
|
|||
# but withtout the db_* prefix.
|
||||
|
||||
# If this is a character object, the player is connected here.
|
||||
db_player = models.ForeignKey("players.PlayerDB", blank=True, null=True)
|
||||
db_player = models.ForeignKey("players.PlayerDB", blank=True, null=True, verbose_name='player',
|
||||
help_text='a Player connected to this object, if any.')
|
||||
# The location in the game world. Since this one is likely
|
||||
# to change often, we set this with the 'location' property
|
||||
# to transparently handle Typeclassing.
|
||||
db_location = models.ForeignKey('self', related_name="locations_set",
|
||||
blank=True, null=True)
|
||||
blank=True, null=True, verbose_name='game location')
|
||||
# a safety location, this usually don't change much.
|
||||
db_home = models.ForeignKey('self', related_name="homes_set",
|
||||
blank=True, null=True)
|
||||
blank=True, null=True, verbose_name='home location')
|
||||
# destination of this object - primarily used by exits.
|
||||
db_destination = models.ForeignKey('self', related_name="destinations_set",
|
||||
blank=True, null=True)
|
||||
blank=True, null=True, verbose_name='destination',
|
||||
help_text='a destination, used only by exit objects.')
|
||||
# database storage of persistant cmdsets.
|
||||
db_cmdset_storage = models.CharField(max_length=255, null=True)
|
||||
db_cmdset_storage = models.CharField('cmdset', max_length=255, null=True)
|
||||
|
||||
# Database manager
|
||||
objects = ObjectManager()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue