-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
340 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...x_Django/services/migrations/0005_logentry_event_logentry_host_logentry_staff_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Generated by Django 4.1.3 on 2022-12-21 14:32 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('services', '0001_squashed_0004_alter_host_nagios_alter_host_qualys_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='logentry', | ||
name='event', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='services.event'), | ||
), | ||
migrations.AddField( | ||
model_name='logentry', | ||
name='host', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='services.host'), | ||
), | ||
migrations.AddField( | ||
model_name='logentry', | ||
name='staff', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='services.staff'), | ||
), | ||
migrations.AlterField( | ||
model_name='logentry', | ||
name='service', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='services.service'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from rest_framework import serializers | ||
from services.models import * | ||
|
||
class Service_Serializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Service | ||
fields = '__all__' | ||
|
||
class Host_Serializer(serializers.ModelSerializer): | ||
service = Service_Serializer(read_only=True) | ||
location = serializers.CharField(source='location.site') | ||
availability = serializers.CharField(source='availability.description') | ||
support = serializers.CharField(source='support.hours') | ||
sys_admin = serializers.SerializerMethodField() | ||
poc_primary = serializers.SerializerMethodField() | ||
poc_backup = serializers.SerializerMethodField() | ||
class Meta: | ||
model = Host | ||
fields = ('service', 'location', 'hostname', 'ip_address', | ||
'qualys', 'nagios', 'syslog_standard_10514', 'syslog_relp_10515', | ||
'label', 'availability', 'support', | ||
'sys_admin', 'poc_primary', 'poc_backup', 'host_last_verified') | ||
|
||
def get_sys_admin(self, Host): | ||
return '{}, {}'.format(Host.sys_admin.last_name, Host.sys_admin.name) | ||
def get_poc_primary(self, Host): | ||
return '{}, {}'.format(Host.poc_primary.last_name, Host.poc_primary.name) | ||
def get_poc_backup(self, Host): | ||
return '{}, {}'.format(Host.poc_backup.last_name, Host.poc_backup.name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.