diff --git a/ereuse_devicehub/forms.py b/ereuse_devicehub/forms.py index 0194a855..7dddf884 100644 --- a/ereuse_devicehub/forms.py +++ b/ereuse_devicehub/forms.py @@ -79,11 +79,6 @@ class ProfileForm(FlaskForm): [validators.Length(min=2, max=35)], render_kw={'class': "form-control"}, ) - last_name = StringField( - 'Last name', - [validators.Length(min=2, max=35)], - render_kw={'class': "form-control"}, - ) email = StringField( 'Email Address', [validators.Length(min=6, max=35)], @@ -101,7 +96,6 @@ class ProfileForm(FlaskForm): super().__init__(*args, **kwargs) if user: self.name.data = user.name - self.last_name.data = user.last_name self.email.data = user.email self.telephone.data = user.telephone if user.country: @@ -110,7 +104,6 @@ class ProfileForm(FlaskForm): def save(self, commit=True): agent = g.user.individual agent.name = self.name.data - agent.last_name = self.last_name.data agent.email = self.email.data agent.telephone = self.telephone.data agent.country = self.country.data diff --git a/ereuse_devicehub/migrations/versions/1b61613d1c19_add_new_fields_in_agent.py b/ereuse_devicehub/migrations/versions/1b61613d1c19_add_new_fields_in_agent.py deleted file mode 100644 index 13d71b82..00000000 --- a/ereuse_devicehub/migrations/versions/1b61613d1c19_add_new_fields_in_agent.py +++ /dev/null @@ -1,35 +0,0 @@ -"""add new fields in agent - -Revision ID: 1b61613d1c19 -Revises: 8571fb32c912 -Create Date: 2022-04-06 12:23:37.644108 - -""" -import citext -import sqlalchemy as sa -from alembic import context, op - -# revision identifiers, used by Alembic. -revision = '1b61613d1c19' -down_revision = '8571fb32c912' -branch_labels = None -depends_on = None - - -def get_inv(): - INV = context.get_x_argument(as_dictionary=True).get('inventory') - if not INV: - raise ValueError("Inventory value is not specified") - return INV - - -def upgrade(): - op.add_column( - "agent", - sa.Column("last_name", citext.CIText(), nullable=True), - schema=f'{get_inv()}', - ) - - -def downgrade(): - op.drop_column('agent', 'last_name', schema=f'{get_inv()}') diff --git a/ereuse_devicehub/resources/agent/models.py b/ereuse_devicehub/resources/agent/models.py index 36d7fcd8..51dd7ab3 100644 --- a/ereuse_devicehub/resources/agent/models.py +++ b/ereuse_devicehub/resources/agent/models.py @@ -31,7 +31,6 @@ class Agent(Thing): id = Column(UUID(as_uuid=True), primary_key=True, default=uuid4) type = Column(Unicode, nullable=False) name = Column(CIText()) - last_name = Column(CIText()) name.comment = """The name of the organization or person.""" tax_id = Column(Unicode(length=STR_SM_SIZE), check_lower('tax_id')) tax_id.comment = """The Tax / Fiscal ID of the organization, @@ -50,8 +49,6 @@ class Agent(Thing): @property def get_full_name(self): - if self.last_name: - return "{} {}".format(self.name, self.last_name) return self.name @declared_attr diff --git a/ereuse_devicehub/templates/ereuse_devicehub/user_profile.html b/ereuse_devicehub/templates/ereuse_devicehub/user_profile.html index 782b92c8..f6560eb5 100644 --- a/ereuse_devicehub/templates/ereuse_devicehub/user_profile.html +++ b/ereuse_devicehub/templates/ereuse_devicehub/user_profile.html @@ -42,10 +42,6 @@ -