Skip to content

Commit

Permalink
Merge pull request #420 from nofusscomputing/development
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-nfc authored Dec 9, 2024
2 parents ef12eb9 + 0ceb5a5 commit b76168b
Show file tree
Hide file tree
Showing 118 changed files with 4,180 additions and 1,377 deletions.
3 changes: 3 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

<!-- dont remove tasks below strike through including the checkbox by enclosing in double tidle '~~' -->

- [ ] **Feature Release ONLY** :red_square: Squash migration files :red_square:
_Multiple migration files created as part of this release are to be sqauashed into a few files as possible so as to limit the number of migrations_

- [ ] :firecracker: Contains breaking-change Any Breaking change(s)?

_Breaking Change must also be notated in the commit that introduces it and in [Conventional Commit Format](https://www.conventionalcommits.org/en/v1.0.0/)._
Expand Down
8 changes: 8 additions & 0 deletions Release-Notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## Version 1.5.0

- When v1.4.0 was release the migrations were not merged. As part of the work conducted on this release the v1.4 migrations have been squashed. This should not have any effect on any system that when they updated to v1.4, they ran the migrations and they **completed successfully**. Upgrading from <1.4.0 to this release should also have no difficulties as the migrations required still exist. There are less of them, however with more work per migration.

!!! Note
If you require the previously squashed migrations for what ever reason. Clone the repo and go to commit 17f47040d6737905a1769eee5c45d9d15339fdbf, which is the commit prior to the squashing which is commit ca2da06d2cd393cabb7e172ad47dfb2dd922d952.


## Version 1.4.0

API redesign in preparation for moving the UI out of centurion to it's [own project](https://github.com/nofusscomputing/centurion_erp_ui). This release introduces a **Feature freeze** to the current UI. Only bug fixes will be done for the current UI.
Expand Down
39 changes: 37 additions & 2 deletions app/access/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.contrib import admin
from django.contrib.auth.models import Group
from django.contrib.auth.models import Group, User
from django.contrib.auth.admin import UserAdmin

from .models import *

Expand All @@ -25,6 +26,40 @@ class OrganizationAdmin(admin.ModelAdmin):
list_filter = ["created"]
search_fields = ["team_name"]


admin.site.register(Organization,OrganizationAdmin)


class TeamUserInline(admin.TabularInline):
model = TeamUsers
extra = 0

readonly_fields = ['created', 'modified']
fields = ['team']

fk_name = 'user'


admin.site.unregister(User)
class UsrAdmin(UserAdmin):

fieldsets = (
(None, {"fields": ("username", "password")}),
("Personal info", {"fields": ("first_name", "last_name", "email")}),
(
"Permissions",
{
"fields": (
"is_active",
"is_staff",
"is_superuser",
),

},
),
("Important dates", {"fields": ("last_login", "date_joined")}),
)

inlines = [TeamUserInline]

admin.site.register(User,UsrAdmin)

2 changes: 0 additions & 2 deletions app/access/functions/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ def permission_queryset():
'chordcounter',
'comment',
'groupresult',
'organization'
'settings',
'usersettings',
]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.1.2 on 2024-10-13 15:27
# Generated by Django 5.1.2 on 2024-12-06 06:47

import access.models
import django.db.models.deletion
Expand All @@ -9,11 +9,23 @@
class Migration(migrations.Migration):

dependencies = [
('access', '0002_alter_team_options'),
('access', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.AlterModelOptions(
name='organization',
options={'ordering': ['name'], 'verbose_name': 'Organization', 'verbose_name_plural': 'Organizations'},
),
migrations.AlterModelOptions(
name='team',
options={'ordering': ['team_name'], 'verbose_name': 'Team', 'verbose_name_plural': 'Teams'},
),
migrations.AlterModelOptions(
name='teamusers',
options={'ordering': ['user'], 'verbose_name': 'Team User', 'verbose_name_plural': 'Team Users'},
),
migrations.AlterField(
model_name='organization',
name='id',
Expand Down Expand Up @@ -47,11 +59,31 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='team',
name='organization',
field=models.ForeignKey(help_text='Organization this belongs to', null=True, on_delete=django.db.models.deletion.CASCADE, to='access.organization', validators=[access.models.TenancyObject.validatate_organization_exists], verbose_name='Organization'),
field=models.ForeignKey(help_text='Organization this belongs to', on_delete=django.db.models.deletion.CASCADE, to='access.organization', validators=[access.models.TenancyObject.validatate_organization_exists], verbose_name='Organization'),
),
migrations.AlterField(
model_name='team',
name='team_name',
field=models.CharField(default='', help_text='Name to give this team', max_length=50, verbose_name='Name'),
field=models.CharField(help_text='Name to give this team', max_length=50, verbose_name='Name'),
),
migrations.AlterField(
model_name='teamusers',
name='id',
field=models.AutoField(help_text='ID of this Team User', primary_key=True, serialize=False, unique=True, verbose_name='ID'),
),
migrations.AlterField(
model_name='teamusers',
name='manager',
field=models.BooleanField(blank=True, default=False, help_text='Is this user to be a manager of this team', verbose_name='manager'),
),
migrations.AlterField(
model_name='teamusers',
name='team',
field=models.ForeignKey(help_text='Team user belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='team', to='access.team', verbose_name='Team'),
),
migrations.AlterField(
model_name='teamusers',
name='user',
field=models.ForeignKey(help_text='User who will be added to the team', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User'),
),
]
17 changes: 0 additions & 17 deletions app/access/migrations/0002_alter_team_options.py

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions app/access/migrations/0005_alter_team_team_name.py

This file was deleted.

20 changes: 0 additions & 20 deletions app/access/migrations/0006_alter_team_organization.py

This file was deleted.

7 changes: 5 additions & 2 deletions app/access/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def save(self, force_insert=False, force_update=False, using=None, update_fields
{
"layout": "table",
"name": "Users",
"field": "user",
"field": "users",
},
]
},
Expand Down Expand Up @@ -489,7 +489,10 @@ class Meta:

page_layout: list = []

table_fields: list = []
table_fields: list = [
'user',
'manager'
]


def delete(self, using=None, keep_parents=False):
Expand Down
6 changes: 3 additions & 3 deletions app/access/serializers/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

from access.models import Organization

from api.serializers import common

from app.serializers.user import UserBaseSerializer

from core import fields as centurion_field



class OrganizationBaseSerializer(serializers.ModelSerializer):
Expand Down Expand Up @@ -43,7 +43,6 @@ class Meta:


class OrganizationModelSerializer(
common.CommonModelSerializer,
OrganizationBaseSerializer
):

Expand All @@ -56,6 +55,7 @@ def get_url(self, item) -> dict:
'teams': reverse("v2:_api_v2_organization_team-list", request=self._context['view'].request, kwargs={'organization_id': item.pk}),
}

model_notes = centurion_field.MarkdownField( required = False )

class Meta:

Expand Down
4 changes: 3 additions & 1 deletion app/access/serializers/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

from api.serializers import common

from access.functions.permissions import permission_queryset
from access.serializers.organization import OrganizationBaseSerializer

from app.serializers.permission import PermissionBaseSerializer
from app.serializers.permission import Permission, PermissionBaseSerializer

from core import fields as centurion_field

Expand Down Expand Up @@ -74,6 +75,7 @@ def get_url(self, item) -> dict:

team_name = centurion_field.CharField( autolink = True )

permissions = serializers.PrimaryKeyRelatedField(many = True, queryset=permission_queryset(), required = False)

class Meta:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from api.tests.abstract.api_permissions_viewset import APIPermissions
from api.tests.abstract.api_serializer_viewset import SerializersTestCases
from api.tests.abstract.test_metadata_functional import MetadataAttributesFunctional, MetaDataNavigationEntriesFunctional



Expand Down Expand Up @@ -278,3 +279,16 @@ class OrganizationViewSet(
):

pass



class OrganizationMetadata(
ViewSetBase,
MetadataAttributesFunctional,
MetaDataNavigationEntriesFunctional,
TestCase
):

menu_id = 'access'

menu_entry_id = 'organization'
Loading

0 comments on commit b76168b

Please sign in to comment.