Always use SQLAlchemy objects, not id numbers. This should be `.replied_by = g.user`. Also remember g.user may be None here for older listings. Don't assume there is a g.user.