This commit is contained in:
Cayo Puigdefabregas 2024-10-07 16:56:58 +02:00
parent 124395a313
commit 472d61bdc2
3 changed files with 6 additions and 4 deletions

View File

@ -13,7 +13,7 @@ class UnassignedDevicesView(InventaryMixin):
breadcrumb = "Devices / Unassigned Devices" breadcrumb = "Devices / Unassigned Devices"
def get_devices(self, user, offset, limit): def get_devices(self, user, offset, limit):
return Device.get_unassigned(self.request.user, offset, limit) return Device.get_unassigned(self.request.user.institution, offset, limit)
class LotDashboardView(InventaryMixin, DetailsMixin): class LotDashboardView(InventaryMixin, DetailsMixin):

View File

@ -1,4 +1,4 @@
# Generated by Django 5.0.6 on 2024-10-04 13:16 # Generated by Django 5.0.6 on 2024-10-07 11:38
import django.db.models.deletion import django.db.models.deletion
from django.conf import settings from django.conf import settings
@ -47,7 +47,9 @@ class Migration(migrations.Migration):
( (
"user", "user",
models.ForeignKey( models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to=settings.AUTH_USER_MODEL, to=settings.AUTH_USER_MODEL,
), ),
), ),

View File

@ -16,7 +16,7 @@ class Annotation(models.Model):
created = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=True)
uuid = models.UUIDField() uuid = models.UUIDField()
owner = models.ForeignKey(Institution, on_delete=models.CASCADE) owner = models.ForeignKey(Institution, on_delete=models.CASCADE)
user = models.ForeignKey(User, on_delete=models.CASCADE) user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True)
type = models.SmallIntegerField(choices=Type) type = models.SmallIntegerField(choices=Type)
key = models.CharField(max_length=STR_EXTEND_SIZE) key = models.CharField(max_length=STR_EXTEND_SIZE)
value = models.CharField(max_length=STR_EXTEND_SIZE) value = models.CharField(max_length=STR_EXTEND_SIZE)