Skip to content

Commit

Permalink
🔥 [#315] Removed otp_yubikey from the installed apps
Browse files Browse the repository at this point in the history
  • Loading branch information
ErhanCitil committed Jun 6, 2023
1 parent 1af1c11 commit 0c9d29b
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 29 deletions.
1 change: 0 additions & 1 deletion src/objects/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
"django_otp.plugins.otp_static",
"django_otp.plugins.otp_totp",
"two_factor",
"otp_yubikey",
# Project applications.
"objects.accounts",
"objects.api",
Expand Down
1 change: 1 addition & 0 deletions src/objects/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ObjectTypeAdmin(admin.ModelAdmin):
list_display = ("_name", "uuid", "_version")
readonly_fields = ("_name",)


class ObjectRecordInline(admin.TabularInline):
model = ObjectRecord
extra = 1
Expand Down
21 changes: 21 additions & 0 deletions src/objects/core/migrations/0028_objecttype__version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 2.2.28 on 2023-06-06 10:21

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("core", "0027_auto_20211203_1209"),
]

operations = [
migrations.AddField(
model_name="objecttype",
name="_version",
field=models.IntegerField(
blank=True,
help_text="Cached version of the objecttype retrieved from the Objecttype API",
null=True,
),
),
]
8 changes: 6 additions & 2 deletions src/objects/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ class ObjectType(models.Model):
help_text=_("Cached name of the objecttype retrieved from the Objecttype API"),
)
_version = models.IntegerField(
help_text=_("Cached version of the objecttype retrieved from the Objecttype API"),
null=True, blank=True
help_text=_(
"Cached version of the objecttype retrieved from the Objecttype API"
),
null=True,
blank=True,
)

objects = ObjectTypeQuerySet.as_manager()
Expand Down Expand Up @@ -58,6 +61,7 @@ def clean(self):
if not self._version:
self._version = object_type_data["version"]


class Object(models.Model):
uuid = models.UUIDField(
unique=True, default=uuid.uuid4, help_text="Unique identifier (UUID4)"
Expand Down
31 changes: 15 additions & 16 deletions src/objects/tests/v2/test_auth_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,19 +418,18 @@ def test_search_with_fields_auth(self):
)

self.assertEqual(response.status_code, status.HTTP_200_OK)
# self.assertEqual(
# response.json()["results"],
# [
# {
# "url": f"http://testserver{reverse('object-detail', args=[record.object.uuid])}",
# "type": self.object_type.url,
# "record": {
# "geometry": {
# "type": "Point",
# "coordinates": [4.905289, 52.369918],
# }
# },
# }
# ],
# )
assert False, record
self.assertEqual(
response.json()["results"],
[
{
"url": f"http://testserver{reverse('object-detail', args=[record.object.uuid])}",
"type": self.object_type.url,
"record": {
"geometry": {
"type": "Point",
"coordinates": [4.905289, 52.369918],
}
},
}
],
)
8 changes: 4 additions & 4 deletions src/objects/token/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class PermissionAdmin(admin.ModelAdmin):

def get_uuid(self, obj):
return obj.object_type.uuid

def get_version(self, obj):
return obj.object_type._version

get_version.short_description = "Version"
get_uuid.short_description = "UUID"

Expand Down Expand Up @@ -131,10 +131,10 @@ class PermissionInline(EditInlineAdminMixin, admin.TabularInline):

def get_uuid(self, obj):
return obj.object_type.uuid

def get_version(self, obj):
return obj.object_type._version

get_version.short_description = "Version"
get_uuid.short_description = "UUID"

Expand Down
11 changes: 5 additions & 6 deletions src/objects/token/migrations/0010_auto_20230602_1057.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@


class Migration(migrations.Migration):

dependencies = [
('token', '0009_auto_20230519_1105'),
("token", "0009_auto_20230519_1105"),
]

operations = [
migrations.RemoveField(
model_name='permission',
name='object_record',
model_name="permission",
name="object_record",
),
migrations.RemoveField(
model_name='tokenauth',
name='object_records',
model_name="tokenauth",
name="object_records",
),
]

0 comments on commit 0c9d29b

Please sign in to comment.