Hi everyone

2 views
Skip to first unread message

Taavi

unread,
Apr 24, 2007, 8:41:47 PM4/24/07
to snapboard-discuss
I just wanted to say hi to everyone here and offer my help with the
project.

I was originally making a site with Vanilla as the forum component but
I don't want users to need 2 accounts for the site so I've been
searching for a django powered forum. Snapboard seems like the best
fit as it's light-weight and includes a registration component.

If you guys are interested, I can post any changes, bug fixes and
improvements I come up with on here. If that works out, I'm possibly
interested in helping out with some of the development.

Let me know what you guys think and I'll keep you updated on my
progress.

Taavi Taijala


P.S. I believe the current trunk has a bug in it where the front page
is throwing an error if there are any threads on it. The problem
stems from the thread_index template, specifically right after the
'last updated' part where it references a thread's date attribute,
which as of this writing, doesn't exist. I added in a function to the
Thread model that either returns the most recent post's date (in that
thread) or if it doesn't have any posts yet, the string 'never'. I
had this problem as of yesterday afternoon, so it may have already
been fixed, but I wanted to let you guys know.

Bo Shi

unread,
Apr 25, 2007, 11:21:41 AM4/25/07
to snapboar...@googlegroups.com
Hi Taavi,

Regarding the error, can you provide details?

The date attribute is added to the thread QuerySet via the
ThreadManager class and a bit of SQL (see /snapboard/managers.py).
You should not need to add any custom functions to the Thread model.

Regards,
Bo

Taavi

unread,
Apr 26, 2007, 7:12:28 PM4/26/07
to snapboard-discuss
You can see it for yourself if you go to http://www.ahscalculus.com/snapboard/

I found that by removing the indicated section below from
thread_index, that it no longer produced an error.

</p>
<span style="color: #677; font-size: small; float:right;">
last updated
<span class="datetime">***REMOVED***{{ thread.date|
date:"r T" }}***END***</span>
{% ifnotequal thread.last_poster thread.starter %}
by {{ thread.last_poster }}
{% endifnotequal %}

After looking into it more, it seems my assumption that the thread
object didn't have a date was a bit hasty. I believe is the format in
which the date attribute is being presented. It appears that it is a
string when the template tag wants a datetime instance. Let me know
if you need more info; I'll leave the error page up for the next
couple days.

Taavi

Bo Shi

unread,
Apr 27, 2007, 1:05:08 AM4/27/07
to snapboar...@googlegroups.com
Hrm... I don't know a whole lot about timezone issues (which this
looks like). Can you try something for me? Can you remove the " T"
in date:"r T" and try running it?

Taavi

unread,
Apr 28, 2007, 3:29:30 AM4/28/07
to snapboard-discuss
I removed the T and it still gives an error (although slightly
different). I have a thought though.

In managers.py under the ThreadManager the following code appears:

return super(ThreadManager, self).get_query_set().extra(
select = {
'post_count': extra_post_count,
'starter': extra_starter,
#'last_updated': extra_last_updated, # bug:
http://code.djangoproject.com/ticket/2210
# the bug is that any extra columns must match their
names
# TODO: sorting on boolean fields is undefined in SQL
theory
'date': extra_last_updated,
'last_poster': extra_last_poster,
},).order_by('-gsticky', '-date')

I don't pretend to know anything about raw SQL queries, but my guess
is that the 'date' line adds a date attribute to the each Thread
model. If that's the case, I'm willing to bet that the date that's
being added is in the format YYYY-MM-DD HH:MM:SS which is not a
datetime object. If we can somehow coerce that into a datetime object
(I'm thinking that strptime() would work) before it gets to the
template, the problem should be fixed.

Unfortuneately, I don't know exactly where to put in the strptime()
function. :-)

Taavi Taijala

On Apr 26, 10:05 pm, "Bo Shi" <bs1...@gmail.com> wrote:
> Hrm... I don't know a whole lot about timezone issues (which this
> looks like). Can you try something for me? Can you remove the " T"
> in date:"r T" and try running it?
>

> On 4/26/07, Taavi <t...@taijala.com> wrote:
>
>
>
> > You can see it for yourself if you go tohttp://www.ahscalculus.com/snapboard/

Reply all
Reply to author
Forward
0 new messages