Skip to content

Commit

Permalink
Merge pull request #3 from jyssy/main
Browse files Browse the repository at this point in the history
TAGS, URLS, context_processor, removed Notes from Export, added ability to handle multiple IP addresses
  • Loading branch information
jpnavarro authored Oct 1, 2024
2 parents 139a37f + eeda154 commit e7f8ed5
Show file tree
Hide file tree
Showing 22 changed files with 289 additions and 54 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,5 @@ provision/web/Operations_Registry_Django.conf
operations-app.access-ci.org.key
operations-app.access-ci.org.pub
**/.DS_Store
{{ app_home }}/
.idea/
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
v2.2.0 2024-08-29 jlambertson
- Added 'service_tags' and 'host_tags' to models, forms, and a few templates to enter and view user-added tags to both categories
- Removed Notes from the export API, otherwise viewable while logged in
- Increased character limit for host.ip_addresses and edited single grammar to include plural options
- increased username character limit from 16 to 25
- added a table, misc_urls, to models to include urls for various possible links being added to the site; as well as a name column by which the specific context urls can be queried


v2.1.1 2023-03-22 JP
- Remove API login requirement, contact names but no phone or emails are returned

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,23 @@
'allauth.socialaccount',
'allauth.socialaccount.providers.cilogon',
'bootstrap5',
# 'django_extensions',
]

SITE_ID = 1

#SOCIALACCOUNT_PROVIDERS = {
# SOCIALACCOUNT_PROVIDERS = {
# 'cilogon': {
# # For each OAuth based provider, either add a ``SocialApp``
# # (``socialaccount`` app) containing the required client
# # credentials, or list them here:
# # credentials, or lis t them here:
# 'APP': {
# 'client_id': CONF['SOCIAL_CLIENT_ID'],
# 'secret': CONF['SOCIAL_SECRET'],
# 'key': ''
# }
# }
#}
# }

ACCOUNT_EMAIL_VERIFICATION = 'none'
ACCOUNT_LOGOUT_REDIRECT_URL = '/accounts/cilogon/login/'
Expand All @@ -92,6 +93,7 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
# 'allauth.account.middleware.AccountMiddleware',
]

AUTHENTICATION_BACKENDS = [
Expand Down Expand Up @@ -132,7 +134,9 @@
'context_processors': [
'django.contrib.messages.context_processors.messages',
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.request',
'django.template'
'.context_processors.request',
'services.context_processors.misc_urls_processor',
# 'django.template.context_processors.debug',
],
},
Expand Down
Empty file.
5 changes: 5 additions & 0 deletions Operations_ServiceIndex_Django/services/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,8 @@ class HostEventLogAdmin(admin.ModelAdmin):
ordering = ['timestamp']
search_fields = ['event', 'host']
admin.site.register(HostEventLog, HostEventLogAdmin)

class Misc_urlsAdmin(admin.ModelAdmin):
list_display = ('name',) # tag loc list
search_fields = ('urls',)
admin.site.register(Misc_urls, Misc_urlsAdmin)
18 changes: 18 additions & 0 deletions Operations_ServiceIndex_Django/services/context_processors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# myapp/context_processors.py
from .models import Misc_urls

def misc_urls_processor(request):
# Create a dictionary to hold the URL mappings
url_mapping = {}

# Fetch all entries in the Misc_urls table
misc_urls = Misc_urls.objects.all()

# Populate the dictionary with names as keys and URLs as values
for entry in misc_urls:
url_mapping[entry.name] = entry.urls

# Return the dictionary so it can be accessed in templates
return {
'MISC_URLS': url_mapping
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.13 on 2024-08-08 12:53

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('services', '0005_logentry_event_logentry_host_logentry_staff_and_more'),
]

operations = [
migrations.AddField(
model_name='service',
name='service_tags',
field=models.CharField(blank=True, max_length=256, null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.13 on 2024-08-08 13:08

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('services', '0006_service_service_tags'),
]

operations = [
migrations.AddField(
model_name='host',
name='host_tags',
field=models.CharField(blank=True, max_length=256, null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 4.1.13 on 2024-08-08 13:50

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('services', '0007_host_host_tags'),
]

operations = [
migrations.AlterField(
model_name='editlock',
name='username',
field=models.CharField(max_length=25),
),
migrations.AlterField(
model_name='hosteventlog',
name='username',
field=models.CharField(max_length=25),
),
migrations.AlterField(
model_name='logentry',
name='username',
field=models.CharField(max_length=25),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.13 on 2024-08-13 13:16

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('services', '0008_alter_editlock_username_alter_hosteventlog_username_and_more'),
]

operations = [
migrations.AlterField(
model_name='host',
name='ip_address',
field=models.CharField(blank=True, max_length=256),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.13 on 2024-08-13 15:22

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('services', '0009_alter_host_ip_address'),
]

operations = [
migrations.RenameField(
model_name='host',
old_name='ip_address',
new_name='ip_addresses',
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.1.13 on 2024-08-28 18:10

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('services', '0010_rename_ip_address_host_ip_addresses'),
]

operations = [
migrations.CreateModel(
name='Misc_urls',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50)),
('urls', models.URLField(max_length=512)),
],
options={
'db_table': '"serviceindex"."misc_urls"',
},
),
]
Loading

0 comments on commit e7f8ed5

Please sign in to comment.