diff --git a/sourcing/model.py b/sourcing/model.py index fc35609..9b452a6 100644 --- a/sourcing/model.py +++ b/sourcing/model.py @@ -155,34 +155,34 @@ class Item(TimeStampedModel): @property def url(self): - return url_for('.view_item', + return url_for('view.view_item', username=self.user.username, hashid=self.hashid) def version_url(self, version): - return url_for('.view_item', + return url_for('view.view_item', username=self.user.username, hashid=self.hashid, v=version) @property def history_url(self): - return url_for('.history', username=self.user.username, hashid=self.hashid) + return url_for('view.history', username=self.user.username, hashid=self.hashid) @property def external_url(self): - return url_for('.view_item', + return url_for('view.view_item', username=self.user.username, hashid=self.hashid, _external=True) @property def edit_url(self): - return url_for('.edit_item', username=self.user.username, hashid=self.hashid) + return url_for('view.edit_item', username=self.user.username, hashid=self.hashid) @property def set_title_url(self): - return url_for('.set_title', username=self.user.username, hashid=self.hashid) + return url_for('view.set_title', username=self.user.username, hashid=self.hashid) def title(self, titles=None): if not titles: @@ -211,8 +211,9 @@ span: {},start=0,length={}'''.format(self.external_url, title_source_doc.externa session.commit() @classmethod - def from_external(cls, url): - home = url_for('.home', _external=True) + def from_external(cls, url, home=None): + if home is None: + home = url_for('view.home', _external=True) if url.startswith(home): username, _, hashid = url[len(home):].partition('/') else: