Django is really nice

Ok, I'm diving into Django. I'm gonna start by making a (simple) forum for our World of Warcraft guild, The Undutchables (nothing much to see there at this moment). Since we got about 50+ members in the guild, I think it would be interesting to see how Django holds up on such a low traffic site.

After starting simply (just following the same tutorial as I did the day before yesterday, only adapting it to the new programme), I've seen the first real problem. The tutorial has only one level nesting (a Poll-object which contains Choices), but my application has one more level (a Forum contains a Thread which contains Posts) and the admin interface (which Django creates almost automagically) doesn't seem to handle this correctly. My objects are defined as follows:

class Forum(meta.Model):
        title = meta.CharField(maxlength=200)
        moderators = meta.ManyToManyField(auth.User)
    def __repr__(self):
            return self.title

    class META:
            admin = meta.Admin()

class Thread(meta.Model): forum = meta.ForeignKey(Forum, edit_inline=meta.STACKED) subject = meta.CharField(maxlength=200)

    def __repr__(self):
            return self.subject

class Post(meta.Model): thread = meta.ForeignKey(Thread, edit_inline=meta.STACKED) user = meta.ForeignKey(auth.User) date = meta.DateTimeField(auto_now_add=True) content = meta.TextField()

    def __repr__(self):
            return self.content</pre>

Threads are displayed correctly, but the Posts are nowhere to be found. I posted a message describing my problem to the mailinglist. I hope they'll respond quickly :)

Comments

Comments powered by Disqus