From 38f8225a37231290c1620e3d5f1946dfdd157850 Mon Sep 17 00:00:00 2001 From: Greg Taylor Date: Sat, 9 Feb 2008 02:49:03 +0000 Subject: [PATCH] Moving application initial data over to JSON and fixtures. This is much better than using those raw SQL files that might not work with all RDBMs. The Objects app needs to be converted to use fixtures as well, but I've got something bad data in there that's causing some issues (which I'm working on hunting down). --- apps/config/fixtures/initial_data.json | 1 + apps/config/sql/commandalias.sql | 9 --------- apps/config/sql/configvalue.sql | 17 ----------------- apps/helpsys/fixtures/initial_data.json | 1 + apps/helpsys/sql/helpentry.sql | 17 ----------------- apps/news/models.py | 4 ++-- 6 files changed, 4 insertions(+), 45 deletions(-) create mode 100644 apps/config/fixtures/initial_data.json delete mode 100644 apps/config/sql/commandalias.sql delete mode 100644 apps/config/sql/configvalue.sql create mode 100644 apps/helpsys/fixtures/initial_data.json delete mode 100644 apps/helpsys/sql/helpentry.sql diff --git a/apps/config/fixtures/initial_data.json b/apps/config/fixtures/initial_data.json new file mode 100644 index 000000000..bdb3d2ff6 --- /dev/null +++ b/apps/config/fixtures/initial_data.json @@ -0,0 +1 @@ +[{"pk": 9, "model": "config.commandalias", "fields": {"user_input": "@desc", "equiv_command": "@describe"}}, {"pk": 3, "model": "config.commandalias", "fields": {"user_input": "@dest", "equiv_command": "@destroy"}}, {"pk": 4, "model": "config.commandalias", "fields": {"user_input": "@nuke", "equiv_command": "@destroy"}}, {"pk": 6, "model": "config.commandalias", "fields": {"user_input": "@tel", "equiv_command": "@teleport"}}, {"pk": 2, "model": "config.commandalias", "fields": {"user_input": "ex", "equiv_command": "examine"}}, {"pk": 7, "model": "config.commandalias", "fields": {"user_input": "i", "equiv_command": "inventory"}}, {"pk": 8, "model": "config.commandalias", "fields": {"user_input": "inv", "equiv_command": "inventory"}}, {"pk": 1, "model": "config.commandalias", "fields": {"user_input": "l", "equiv_command": "look"}}, {"pk": 5, "model": "config.commandalias", "fields": {"user_input": "sa", "equiv_command": "say"}}, {"pk": 1, "model": "config.configvalue", "fields": {"conf_value": "Evennia Test Site", "conf_key": "site_name"}}, {"pk": 2, "model": "config.configvalue", "fields": {"conf_value": "2", "conf_key": "player_dbnum_start"}}, {"pk": 3, "model": "config.configvalue", "fields": {"conf_value": "Credits", "conf_key": "money_name_plural"}}, {"pk": 4, "model": "config.configvalue", "fields": {"conf_value": "Credit", "conf_key": "money_name_singular"}}, {"pk": 5, "model": "config.configvalue", "fields": {"conf_value": "0", "conf_key": "game_firstrun"}}, {"pk": 6, "model": "config.configvalue", "fields": {"conf_value": "1800", "conf_key": "idle_timeout"}}, {"pk": 7, "model": "config.configvalue", "fields": {"conf_value": "2", "conf_key": "default_home"}}, {"pk": 8, "model": "config.configvalue", "fields": {"conf_value": "\n%ch%cb==================================================================%cn\n Welcome to Evennia! Please type one of the following to begin:\n\n If you have an existing account, connect to it by typing:\n %chconnect %cn\n If you need to create an account, type (without the <>'s):\n %chcreate \"\" %cn\n%ch%cb==================================================================%cn\n", "conf_key": "connect_screen"}}] diff --git a/apps/config/sql/commandalias.sql b/apps/config/sql/commandalias.sql deleted file mode 100644 index ebc7b10d6..000000000 --- a/apps/config/sql/commandalias.sql +++ /dev/null @@ -1,9 +0,0 @@ -INSERT INTO config_commandalias VALUES(1,'l','look'); -INSERT INTO config_commandalias VALUES(2,'ex','examine'); -INSERT INTO config_commandalias VALUES(3,'@dest','@destroy'); -INSERT INTO config_commandalias VALUES(4,'@nuke','@destroy'); -INSERT INTO config_commandalias VALUES(5,'sa','say'); -INSERT INTO config_commandalias VALUES(6,'@tel','@teleport'); -INSERT INTO config_commandalias VALUES(7,'i','inventory'); -INSERT INTO config_commandalias VALUES(8,'inv','inventory'); -INSERT INTO config_commandalias VALUES(9,'@desc','@describe'); diff --git a/apps/config/sql/configvalue.sql b/apps/config/sql/configvalue.sql deleted file mode 100644 index 391511fe3..000000000 --- a/apps/config/sql/configvalue.sql +++ /dev/null @@ -1,17 +0,0 @@ -INSERT INTO config_configvalue VALUES(1,'site_name','Evennia Test Site'); -INSERT INTO config_configvalue VALUES(2,'player_dbnum_start','2'); -INSERT INTO config_configvalue VALUES(3,'money_name_plural','Credits'); -INSERT INTO config_configvalue VALUES(4,'money_name_singular','Credit'); -INSERT INTO config_configvalue VALUES(5,'game_firstrun','1'); -INSERT INTO config_configvalue VALUES(6,'idle_timeout','1800'); -INSERT INTO config_configvalue VALUES(7,'default_home','2'); -INSERT INTO config_configvalue VALUES(8,'connect_screen',' -%%ch%%cb==================================================================%%cn - Welcome to Evennia! Please type one of the following to begin: - - If you have an existing account, connect to it by typing: - %%chconnect %%cn - If you need to create an account, type (without the <>''s): - %%chcreate "" %%cn -%%ch%%cb==================================================================%%cn -'); diff --git a/apps/helpsys/fixtures/initial_data.json b/apps/helpsys/fixtures/initial_data.json new file mode 100644 index 000000000..107ef1f4a --- /dev/null +++ b/apps/helpsys/fixtures/initial_data.json @@ -0,0 +1 @@ +[{"pk": 3, "model": "helpsys.helpentry", "fields": {"entrytext": "Commands in Evennia are generally organized into one of two categories: %cgPublic%cn or %cyPrivileged%cn commands.\n\n%cgPublic%cn commands are more or less available to everyone. None of these commands are prefixed with anything, they are typical, every-day commands like %chlook%cn, %chsay%cn, and %chget%cn.\n\n%cyPrivileged%cn command availability is largely dependent on the privileges and powers bestowed on you by the staff. Privileged commands are generally building\/administration related and aren't of general interest to players. These commands are all pre-fixed by a '%ch@%cn' character.\n\nTo see a list of all commands, use %ch@list commands%cn. If you'd like to learn more about any individual command, you may do so by typing %chhelp %cn, where is the name of the command (without the <>'s).", "topicname": "Commands", "staff_only": false}}, {"pk": 2, "model": "helpsys.helpentry", "fields": {"entrytext": "Evennia is a product of a small community of developers, all working towards the continual improvement of the codebase. The following people have made major contributions with the end result being what you are now playing.\n\n\"Kelvin\" (Greg Taylor) - Lead developer and original author.", "topicname": "Credits", "staff_only": false}}, {"pk": 1, "model": "helpsys.helpentry", "fields": {"entrytext": "This game has yet to customize its help index, so for now you may browse the generic codebase help files.\n\nTopics\nNEWBIE %t%t Getting started (for new players).\nCOMMANDS %t How to get help with commands.\nCREDITS %t Codebase credits.", "topicname": "Help Index", "staff_only": false}}] diff --git a/apps/helpsys/sql/helpentry.sql b/apps/helpsys/sql/helpentry.sql deleted file mode 100644 index 5081a9021..000000000 --- a/apps/helpsys/sql/helpentry.sql +++ /dev/null @@ -1,17 +0,0 @@ -INSERT INTO helpsys_helpentry VALUES(1,'Help Index','This game has yet to customize its help index, so for now you may browse the generic codebase help files. - -Topics ------- -NEWBIE %%t%%t Getting started (for new players). -COMMANDS %%t How to get help with commands. -CREDITS %%t Codebase credits.',0); -INSERT INTO helpsys_helpentry VALUES(2,'Credits','Evennia is a product of a small community of developers, all working towards the continual improvement of the codebase. The following people have made major contributions with the end result being what you are now playing. - -"Kelvin" (Greg Taylor) - Lead developer and original author.',0); -INSERT INTO helpsys_helpentry VALUES(3,'Commands','Commands in Evennia are generally organized into one of two categories: %%cgPublic%%cn or %%cyPrivileged%%cn commands. - -%%cgPublic%%cn commands are more or less available to everyone. None of these commands are prefixed with anything, they are typical, every-day commands like %%chlook%%cn, %%chsay%%cn, and %%chget%%cn. - -%%cyPrivileged%%cn command availability is largely dependent on the privileges and powers bestowed on you by the staff. Privileged commands are generally building/administration related and aren''t of general interest to players. These commands are all pre-fixed by a ''%%ch@%%cn'' character. - -To see a list of all commands, use %%ch@list commands%%cn. If you''d like to learn more about any individual command, you may do so by typing %%chhelp %%cn, where is the name of the command (without the <>''s).',0); diff --git a/apps/news/models.py b/apps/news/models.py index bd9aea749..50847239e 100755 --- a/apps/news/models.py +++ b/apps/news/models.py @@ -5,7 +5,7 @@ class NewsTopic(models.Model): """ Represents a news topic. """ - name = models.CharField(maxlength=75, unique=True) + name = models.CharField(max_length=75, unique=True) description = models.TextField(blank=True) icon = models.ImageField(upload_to='newstopic_icons', default='newstopic_icons/default.png', blank=True, help_text="Image for the news topic.") @@ -26,7 +26,7 @@ class NewsEntry(models.Model): An individual news entry. """ author = models.ForeignKey(User, related_name='author') - title = models.CharField(maxlength=255) + title = models.CharField(max_length=255) body = models.TextField() topic = models.ForeignKey(NewsTopic, related_name='newstopic') date_posted = models.DateTimeField(auto_now_add=True)