Skip to content

Commit

Permalink
Update models to adapt to haikang system
Browse files Browse the repository at this point in the history
  • Loading branch information
pkuGenuine committed Feb 15, 2025
1 parent 7416a3d commit 2d69356
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Appointment/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ def Rstatus_display(self, obj):
)


@admin.register(EntranceGuard)
class EntranceGuardAdmin(admin.ModelAdmin):
pass


@admin.register(Appoint)
class AppointAdmin(admin.ModelAdmin):
actions_on_top = True
Expand Down
17 changes: 17 additions & 0 deletions Appointment/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
'Appoint',
'LongTermAppoint',
'CardCheckInfo',
'EntranceGuard',
]


Expand Down Expand Up @@ -58,6 +59,7 @@ class Meta:
verbose_name='学号',
primary_key=True,
)
cross_sys_uid = models.CharField('跨系统id', max_length=32, null=True)

@property
def name(self) -> str:
Expand Down Expand Up @@ -196,6 +198,21 @@ def __str__(self):
return self.Rid + ' ' + self.Rtitle


class EntranceGuard(models.Model):

class Meta:
verbose_name = '门禁设备'
verbose_name_plural = verbose_name

door_id = models.IntegerField('门禁编号', primary_key=True)
ip = models.GenericIPAddressField('IP地址', unique=True)
port = models.IntegerField('端口', default=8000)
username = models.CharField('用户名', max_length=32)
password = models.CharField('密码', max_length=32)
room = models.ForeignKey(Room, on_delete=models.SET_NULL, verbose_name='对应房间',
null=True, related_name='entrance_guards')


class AppointQuerySet(models.QuerySet['Appoint']):
def not_canceled(self):
return self.exclude(Astatus=Appoint.Status.CANCELED)
Expand Down

0 comments on commit 2d69356

Please sign in to comment.