db/change db model name
This commit is contained in:
parent
327bb0d732
commit
7fcff2566a
3 changed files with 5 additions and 5 deletions
|
@ -26,7 +26,7 @@ class Toot(db.Model):
|
||||||
favourites_count = db.Column(db.Integer)
|
favourites_count = db.Column(db.Integer)
|
||||||
language = db.Column(db.Text)
|
language = db.Column(db.Text)
|
||||||
|
|
||||||
class Reblog(db.Model):
|
class Other(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
acct = db.Column(db.Text)
|
acct = db.Column(db.Text)
|
||||||
url = db.Column(db.Text)
|
url = db.Column(db.Text)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
from mastodon import Mastodon
|
from mastodon import Mastodon
|
||||||
from BDSM import db
|
from BDSM import db
|
||||||
from BDSM.models import Reblog, Toot, Tag, Media, Emoji, Poll
|
from BDSM.models import Other, Toot, Tag, Media, Emoji, Poll
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
def app_register(url):
|
def app_register(url):
|
||||||
|
@ -160,7 +160,7 @@ def archive_toot(url):
|
||||||
favourites_count = status['favourites_count']
|
favourites_count = status['favourites_count']
|
||||||
language = status['language']
|
language = status['language']
|
||||||
|
|
||||||
table = Reblog() if is_reblog else Toot()
|
table = Other() if is_reblog else Toot()
|
||||||
table.id=id
|
table.id=id
|
||||||
table.acct = acct
|
table.acct = acct
|
||||||
table.url=url
|
table.url=url
|
||||||
|
|
|
@ -5,7 +5,7 @@ import pytz
|
||||||
from flask import render_template, request, url_for, redirect, flash
|
from flask import render_template, request, url_for, redirect, flash
|
||||||
from flask_sqlalchemy import Pagination
|
from flask_sqlalchemy import Pagination
|
||||||
from BDSM import app, db
|
from BDSM import app, db
|
||||||
from BDSM.models import Media, Settings, Toot, Emoji, Reblog
|
from BDSM.models import Media, Settings, Toot, Emoji, Other
|
||||||
from BDSM.toot import app_register, archive_toot
|
from BDSM.toot import app_register, archive_toot
|
||||||
from mastodon import Mastodon
|
from mastodon import Mastodon
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
|
@ -179,7 +179,7 @@ def process_toot(toots_):
|
||||||
toot = SimpleNamespace(**toot.__dict__)
|
toot = SimpleNamespace(**toot.__dict__)
|
||||||
toot.is_reblog = True
|
toot.is_reblog = True
|
||||||
else:
|
else:
|
||||||
toot = Reblog.query.get(toot.reblog_id)
|
toot = Other.query.get(toot.reblog_id)
|
||||||
toot = SimpleNamespace(**toot.__dict__)
|
toot = SimpleNamespace(**toot.__dict__)
|
||||||
toot.is_reblog = True
|
toot.is_reblog = True
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue