Ask Your Question

customize askbot

asked 2012-01-25 06:00:35 -0600

A little girl gravatar image


I want to add more table to the askbot database. Usually, in Django, we can make new file in (or create new file in folder model). Then run syncdb. But, I cannot do that in askbot. What am I missing?

my file is name in models

import re from django.db import models from django.db import connection, transaction from django.contrib.auth.models import User from django.utils.translation import ugettext as _ from askbot.models.base import DeletableContent from askbot.models.base import BaseQuerySetManager from askbot import const

class Subject(models.Model): subject = models.CharField(max_length=64)

class Meta:
    db_table = u'subject'
def __unicode__(self):
    return self.subject

I have used from askbot.models.subject import Subject in in folder models.


edit retag flag offensive close merge delete


I've seen this issue before and don't know the answer. This issue is present in some models files but not others.. Try adding your model to a new .py file within the models module or a different file.

Evgeny gravatar image Evgeny  ( 2012-01-25 06:14:18 -0600 )edit

Someone just suggested to me that you add that model to __all__ list in the askbot/models/, please see if that helps.

Evgeny gravatar image Evgeny  ( 2012-01-25 06:20:06 -0600 )edit

There is no Subject table yet. Should I add the table first and then create the models? Since I am new to Django and Python, I am not sure if my file is correct ... I saw that this file can be compiled and create the file subject.pyc

A little girl gravatar image A little girl  ( 2012-01-25 09:02:46 -0600 )edit

No, syncdb should create a table for you, at the bottom of askbot/models/ there is a list __all__ - add your model there as well.

Evgeny gravatar image Evgeny  ( 2012-01-25 09:05:12 -0600 )edit

I did this by adding a separate directory below (after laboriously moving askbot to that level), and adding a there. It worked. Askbot's install script makes this all a bit harder though.

brycenesbitt gravatar image brycenesbitt  ( 2012-01-27 15:56:45 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2012-02-27 13:20:03 -0600

ajk14 gravatar image

Has this question been resolved? I'm having the exact same problem, where syncdb is not creating the new table that I am expecting.

I've added my model to the __all__ list in models/ but that doesn't seem to have helped.

edit flag offensive delete link more


I don't know what is the issue here, sorry don't have the time to look into this. For you it will be better if you keep your additional code outside of askbot tree, because upgrading askbot code will be easier that way. Try to couple your code to askbot as loosely as possible, it's a better approach, generally speaking.

Evgeny gravatar image Evgeny  ( 2012-02-27 13:34:05 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-01-25 06:00:35 -0600

Seen: 494 times

Last updated: Feb 27 '12