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

Remove admin_comment from company #3643

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
1 change: 0 additions & 1 deletion lego/apps/companies/fixtures/development_companies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
payment_mail: [email protected]
address: Postboks 134 Sentrum, 0102 Oslo
company_type: 'Konsulent, Data&Komtek'
admin_comment: 'Husk logo på alle sider'

- model: companies.Company
pk: 2
Expand Down
38 changes: 38 additions & 0 deletions lego/apps/companies/migrations/0029_bdb_remove_admin_comment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generated by Django 4.0.10 on 2024-09-25 18:53

from django.db import migrations
from django.conf import settings


def create_comment_with_old_admin_comment(apps, schema_editor):
Company = apps.get_model("companies", "Company")
Comment = apps.get_model("comments", "Comment")
CompanyContentType = apps.get_model("contenttypes", "ContentType").objects.get(
model="company"
)

for c in Company.objects.all():
if c.admin_comment != None:
Comment.objects.create(
text="Autogenerert kommentar fra gammelt notat: \n" + c.admin_comment,
content_type=CompanyContentType,
object_id=c.id,
)


class Migration(migrations.Migration):

dependencies = [
('companies', '0028_alter_companyinterest_other_offers'),
('comments', '0008_alter_comment_created_by_alter_comment_updated_by'),
("contenttypes", "0002_remove_content_type_name"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.RunPython(create_comment_with_old_admin_comment),
migrations.RemoveField(
model_name="company",
name="admin_comment",
),
]
1 change: 0 additions & 1 deletion lego/apps/companies/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class Company(BasisModel):
company_type = models.CharField(max_length=200, blank=True)
website = models.URLField(blank=True)
address = models.CharField(max_length=200, blank=True)
admin_comment = models.CharField(max_length=100, blank=True)
active = models.BooleanField(default=True)
payment_mail = models.EmailField(max_length=100, blank=True)
comments = GenericRelation(Comment)
Expand Down
2 changes: 0 additions & 2 deletions lego/apps/companies/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ class Meta:
"name",
"semester_statuses",
"student_contact",
"admin_comment",
"active",
)

Expand Down Expand Up @@ -203,7 +202,6 @@ class Meta:
"content_target",
"semester_statuses",
"active",
"admin_comment",
"logo",
"files",
"company_contacts",
Expand Down