Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] Dodanie pola website_url do modelu Brand #3919

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions pola/company/migrations/0033_brand_website_url.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.16 on 2024-06-21 10:26

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('company', '0032_alter_brand_logotype'),
]

operations = [
migrations.AddField(
model_name='brand',
name='website_url',
field=models.CharField(default='example.pl', max_length=128, verbose_name='URL marki'),
),
]
1 change: 1 addition & 0 deletions pola/company/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ class Brand(TimeStampedModel):
region_name='eu-central-1',
),
)
website_url = models.CharField(max_length=128, null=False, blank=False, verbose_name=_("URL marki"), default="example.pl")

def __str__(self):
return self.common_name or self.name
Expand Down
3 changes: 2 additions & 1 deletion pola/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ def get_result_from_code(code, multiple_company_supported=False, report_as_objec

def serialize_brand(brand):
logotype_url = brand.logotype.url if brand.logotype else None
return {'name': str(brand), 'logotype_url': logotype_url}
website_url = brand.website_url if brand.website_url else None
return {'name': str(brand), 'logotype_url': logotype_url, 'website_url': website_url}


def handle_companies_when_multiple_companies_are_not_supported(
Expand Down
2 changes: 2 additions & 0 deletions pola/rpc_api/openapi-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ components:
logotype_url:
type: string
nullable: true
website_url:
type: string
required:
- name
- logotype_url
Expand Down
Loading