fixing url

This commit is contained in:
Cayo Puigdefabregas 2021-06-15 13:11:49 +02:00
parent 80b7b98ec8
commit b1f7b629c7
2 changed files with 14 additions and 23 deletions

View file

@ -5,11 +5,12 @@ Revises: eca457d8b2a4
Create Date: 2021-03-15 17:40:34.410408 Create Date: 2021-03-15 17:40:34.410408
""" """
import sqlalchemy as sa
import citext
import teal
from alembic import op from alembic import op
from alembic import context from alembic import context
from sqlalchemy.dialects import postgresql from sqlalchemy.dialects import postgresql
import sqlalchemy as sa
import citext
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
@ -160,6 +161,7 @@ def upgrade():
sa.Column( sa.Column(
'url', 'url',
citext.CIText(), citext.CIText(),
teal.db.URL(),
nullable=True, nullable=True,
comment='This is the url where resides the document.' comment='This is the url where resides the document.'
), ),

View file

@ -1,28 +1,17 @@
import os
from itertools import chain
from citext import CIText from citext import CIText
from flask import current_app as app, g from flask import g
from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.dialects.postgresql import UUID
from ereuse_devicehub.db import db from ereuse_devicehub.db import db
from ereuse_devicehub.resources.user.models import User from ereuse_devicehub.resources.user.models import User
from sortedcontainers import SortedSet from sortedcontainers import SortedSet
from ereuse_devicehub.resources.models import STR_SM_SIZE, Thing, listener_reset_field_updated_in_actual_time from ereuse_devicehub.resources.models import Thing
from sqlalchemy import BigInteger, Boolean, Column, Float, ForeignKey, Integer, \ from sqlalchemy import BigInteger, Column, Sequence
Sequence, SmallInteger, Unicode, inspect, text from sqlalchemy.orm import backref
from sqlalchemy.ext.declarative import declared_attr from teal.db import CASCADE_OWN, URL
from sqlalchemy.orm import ColumnProperty, backref, relationship, validates
from sqlalchemy.util import OrderedSet
from sqlalchemy_utils import ColorType
from teal.db import CASCADE_OWN, CASCADE_DEL, POLYMORPHIC_ID, POLYMORPHIC_ON, \
check_lower, check_range
from teal.resource import url_for_resource
from ereuse_devicehub.resources.utils import hashcode from ereuse_devicehub.resources.enums import Severity
from ereuse_devicehub.resources.enums import BatteryTechnology, CameraFacing, ComputerChassis, \
DataStorageInterface, DisplayTech, PrinterTechnology, RamFormat, RamInterface, Severity, TransferState
_sorted_documents = { _sorted_documents = {
@ -79,7 +68,7 @@ class TradeDocument(Thing):
file_name.comment = """This is the name of the file when user up the document.""" file_name.comment = """This is the name of the file when user up the document."""
file_hash = Column(db.CIText()) file_hash = Column(db.CIText())
file_hash.comment = """This is the hash of the file produced from frontend.""" file_hash.comment = """This is the hash of the file produced from frontend."""
url = Column(db.CIText()) url = db.Column(URL())
url.comment = """This is the url where resides the document.""" url.comment = """This is the url where resides the document."""
__table_args__ = ( __table_args__ = (