Re-organization.
This commit is contained in:
parent
5db3ae2933
commit
5421ab7f6e
38 changed files with 0 additions and 0 deletions
0
apps/helpsys/__init__.py
Normal file
0
apps/helpsys/__init__.py
Normal file
40
apps/helpsys/models.py
Normal file
40
apps/helpsys/models.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
from django.db import models
|
||||
import ansi
|
||||
|
||||
class HelpEntry(models.Model):
|
||||
"""
|
||||
A generic help entry.
|
||||
"""
|
||||
topicname = models.CharField(maxlength=255)
|
||||
entrytext = models.TextField(blank=True, null=True)
|
||||
staff_only = models.BooleanField(default=0)
|
||||
|
||||
class Admin:
|
||||
list_display = ('id', 'topicname', 'staff_only')
|
||||
list_filter = ('staff_only',)
|
||||
search_fields = ['entrytext']
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "Help entries"
|
||||
ordering = ['topicname']
|
||||
|
||||
def __str__(self):
|
||||
return self.topicname
|
||||
|
||||
def get_topicname(self):
|
||||
"""
|
||||
Returns the topic's name.
|
||||
"""
|
||||
try:
|
||||
return self.topicname
|
||||
except:
|
||||
return None
|
||||
|
||||
def get_entrytext_ingame(self):
|
||||
"""
|
||||
Gets the entry text for in-game viewing.
|
||||
"""
|
||||
try:
|
||||
return ansi.parse_ansi(self.entrytext)
|
||||
except:
|
||||
return None
|
||||
1
apps/helpsys/views.py
Normal file
1
apps/helpsys/views.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Create your views here.
|
||||
Loading…
Add table
Add a link
Reference in a new issue