Skip to content

Commit

Permalink
Add host-representative permission
Browse files Browse the repository at this point in the history
  • Loading branch information
didrikmunther committed Nov 9, 2024
1 parent 5b2eac2 commit 84371e1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
17 changes: 17 additions & 0 deletions companies/migrations/0033_add_host_representative.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.2.24 on 2024-11-09 14:39

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('companies', '0032_add_company_type_default'),
]

operations = [
migrations.AlterModelOptions(
name='company',
options={'ordering': ['name'], 'permissions': (('base', 'Companies'), ('host_representative', 'Can be host representative')), 'verbose_name_plural': 'Companies'},
),
]
5 changes: 4 additions & 1 deletion companies/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ def identity_number_allabolag(self):
class Meta:
verbose_name_plural = "Companies"
ordering = ["name"]
permissions = (("base", "Companies"),)
permissions = (
("base", "Companies"),
("host_representative", "Can be host representative"),
)

def __str__(self):
return self.name
Expand Down
1 change: 1 addition & 0 deletions companies/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ def companies_edit(request, year, pk, group_pk=None, responsible_group_pk=None):
for user in users
if (responsible is not None and user in responsible.users.all())
or user.has_perm("companies.base")
or user.has_perm("companies.host_representative")
]

form_responsible.fields["users"].choices = [
Expand Down

0 comments on commit 84371e1

Please sign in to comment.