Anonymous avatar Anonymous committed 2430038

fixed error in 'content' column type definition

Comments (0)

Files changed (1)

smallpress/model/models.py

 
 import os
 from datetime import datetime
-from tgext.datahelpers.fields import AttachedImage
+from tgext.datahelpers.fields import Attachment as DatahelpersAttachment, AttachedFile
 from smallpress.model import DeclarativeBase, DBSession
 from tgext.pluggable import app_model, primary_key
 from tgext.pluggable import call_partial
 except ImportError:
     sqla_events = False
 
-AttachmentType = tg.config.get('_smallpress',{}).get('attachment_type', AttachedImage)
+AttachmentType = tg.config.get('_smallpress',{}).get('attachment_type', AttachedFile)
 
 class Blog(DeclarativeBase):
     __tablename__ = 'smallpress_blogs'
 
     uid = Column(Integer, autoincrement=True, primary_key=True)
     name = Column(Unicode(16), nullable=False)
-    content = Column(AttachmentType)
+    content = Column(DatahelpersAttachment(AttachmentType))
 
     article_id = Column(Integer, ForeignKey(Article.uid))
     article = relation(Article, backref=backref('attachments', cascade='all, delete-orphan'))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.