Finally found and fixed the problem with editing objects in the admin interface.

This commit is contained in:
Greg Taylor 2007-01-01 23:38:59 +00:00
parent f6de21be13
commit 0adfd4d45c
8 changed files with 35 additions and 18 deletions

View file

@ -1,7 +1,7 @@
from django.db import models
from django.contrib.auth.models import User
import global_defines
import ansi
import evennia.defines_global as global_defines
import evennia.ansi
class Attribute(models.Model):
"""
@ -21,7 +21,7 @@ class Attribute(models.Model):
return "%s(%d)" % (self.name, self.id,)
class Admin:
list_display = ('name', 'value',)
list_display = ('object', 'name', 'value',)
class Object(models.Model):
"""
@ -57,7 +57,7 @@ class Object(models.Model):
)
class Admin:
list_display = ('name',)
list_display = ('id', 'name', 'type', 'owner', 'date_created')
"""
BEGIN COMMON METHODS
@ -583,5 +583,5 @@ class Object(models.Model):
def __str__(self):
return "%s(#%d%s)" % (self.get_ansiname(), self.id, self.flag_string())
import functions_db
import session_mgr
import evennia.functions_db
import evennia.session_mgr

View file

@ -3,7 +3,7 @@ import time
import functions_general
import functions_db
import functions_help
import global_defines
import evennia.defines_global as global_defines
import session_mgr
import ansi
import os
@ -231,10 +231,16 @@ def cmd_help(cdat):
session.msg("Your search query is too short. It must be at least three letters long.")
return
topics = functions_help.find_topicmatch(topicstr, pobject)
topics = functions_help.find_topicmatch(pobject, topicstr)
if len(topics) == 0:
session.msg("No matching topics found, please refine your search.")
suggestions = functions_help.find_topicsuggestions(pobject, topicstr)
if len(suggestions) > 0:
session.msg("Matching similarly named topics:")
for result in suggestions:
session.msg(" %s" % (result,))
session.msg("You may type 'help <#>' to see any of these topics.")
elif len(topics) > 1:
session.msg("More than one match found:")
for result in topics:

View file

Binary file not shown.

View file

@ -3,7 +3,7 @@ from django.db import connection
from django.contrib.auth.models import User
from apps.objects.models import Object
from apps.config.models import ConfigValue
import global_defines
import evennia.defines_global as global_defines
import gameconf
"""

View file

@ -2,17 +2,28 @@ from apps.helpsys.models import HelpEntry
"""
Help system functions.
"""
def find_topicmatch(topicstr, pobject):
def find_topicmatch(pobject, topicstr):
"""
Searches for matching topics based on player's input.
"""
is_staff = pobject.is_staff()
if topicstr.isdigit():
return HelpEntry.objects.filter(id=topicstr)
if is_staff:
return HelpEntry.objects.filter(id=topicstr)
else:
return HelpEntry.objects.filter(id=topicstr).exclude(staff_only=1)
else:
return HelpEntry.objects.filter(topicname__istartswith=topicstr)
if is_staff:
return HelpEntry.objects.filter(topicname__istartswith=topicstr)
else:
return HelpEntry.objects.filter(topicname__istartswith=topicstr).exclude(staff_only=1)
def find_topicsuggestions(topicstr, pobject):
def find_topicsuggestions(pobject, topicstr):
"""
Do a fuzzier "contains" match.
"""
return HelpEntry.objects.filter(topicname__icontains=topicstr)
is_staff = pobject.is_staff()
if is_staff:
return HelpEntry.objects.filter(topicname__icontains=topicstr)
else:
return HelpEntry.objects.filter(topicname__icontains=topicstr).exclude(staff_only=1)

View file

@ -1,4 +1,4 @@
#!/bin/bash
export DJANGO_SETTINGS_MODULE="settings"
export PYTHONPATH=/home/evennia
python server.py
export PYTHONPATH=/home/gtaylor/dev/
python2.5 server.py

View file

@ -1,6 +1,6 @@
from asyncore import dispatcher
from asynchat import async_chat
import socket, asyncore, time, sys
import socket, asyncore, time
from django.db import models
from django.db import connection
@ -8,7 +8,7 @@ from apps.config.models import CommandAlias
import scheduler
import functions_db
import functions_general
import global_defines
import evennia.defines_global as global_defines
import session_mgr
import gameconf
import settings