Add parent shipment
parent
0cf4531bbc
commit
b94e424cee
|
@ -81,6 +81,7 @@ class FaceshieldRequestAdmin(ModelView):
|
|||
'adapter_secura_dar_required', 'adapter_secura_dar_delivered',
|
||||
'handling_orga',
|
||||
'created', 'ua', 'ip', 'status', 'remarks',
|
||||
'parent_id',
|
||||
'shipping_name', 'shipping_street', 'shipping_postalcode', 'shipping_city',
|
||||
'shipping_latitude', 'shipping_longitude',
|
||||
'postalcode_info',
|
||||
|
|
|
@ -74,11 +74,13 @@ class FaceshieldRequest(db.Model):
|
|||
shipping_longitude = db.Column(db.Float)
|
||||
|
||||
postalcode_info = db.relationship(PostalCode, primaryjoin='remote(PostalCode.postalcode) == foreign(FaceshieldRequest.shipping_postalcode)')
|
||||
parent_id = db.Column(db.Integer, db.ForeignKey(id))
|
||||
parent_shipment = db.relationship('FaceshieldRequest', remote_side=id, backref='children')
|
||||
|
||||
handling_orga = db.Column(db.String, default='hswaw', server_default='hswaw', nullable=False)
|
||||
|
||||
def __str__(self):
|
||||
return '#{} {} ({})'.format(self.id, self.entity_info, self.status.name)
|
||||
return Markup('<a href="/admin/request_unfiltered/edit/?id={}">#{} {}</a> ({})').format(self.id, self.id, self.entity_info, self.status.name)
|
||||
|
||||
@property
|
||||
def label_count(self):
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
"""Add parent_shipment
|
||||
|
||||
Revision ID: d96448542014
|
||||
Revises: fc5645f54f55
|
||||
Create Date: 2020-04-16 11:21:27.336222
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd96448542014'
|
||||
down_revision = 'fc5645f54f55'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('faceshield_request', sa.Column('parent_id', sa.Integer(), nullable=True))
|
||||
op.create_foreign_key(None, 'faceshield_request', 'faceshield_request', ['parent_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'faceshield_request', type_='foreignkey')
|
||||
op.drop_column('faceshield_request', 'parent_id')
|
||||
# ### end Alembic commands ###
|
Loading…
Reference in New Issue