Skip to content

Commit

Permalink
Update our hosting provider admin use URLField
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchrisadams committed Sep 13, 2023
1 parent e21fd88 commit 6daae29
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
6 changes: 4 additions & 2 deletions apps/accounts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _managed_objects_markup(self, user, object_list, objects_name):
admin_explanation = f"""
<p>
This user is an admin - they have access to manage all the {objects_name} in the database.<br>
Below is a list of those {objects_name} for which a permission has been granted explicitly for the user,
Below is a list of those {objects_name} for which a permission has been granted explicitly for the user,
rather than based on the admin role.
</p><br>
"""
Expand Down Expand Up @@ -809,7 +809,9 @@ def get_fieldsets(self, request, obj=None):
"Hostingprovider info",
{
"fields": (
("name", "website", "description"),
"name",
"website",
"description",
"country",
"city",
"services",
Expand Down
18 changes: 18 additions & 0 deletions apps/accounts/migrations/0060_alter_hostingprovider_website.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.21 on 2023-09-12 20:31

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('accounts', '0059_merge_20230712_1415'),
]

operations = [
migrations.AlterField(
model_name='hostingprovider',
name='website',
field=models.URLField(max_length=255),
),
]
2 changes: 1 addition & 1 deletion apps/accounts/models/hosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class Hostingprovider(models.Model):
related_name="labels",
)
showonwebsite = models.BooleanField(verbose_name="Show on website", default=False)
website = models.CharField(max_length=255)
website = models.URLField(max_length=255)
datacenter = models.ManyToManyField(
"Datacenter",
through="HostingproviderDatacenter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,13 @@

{% if field.field.name == 'website' %}

<style>
.extra_url {
margin: 1rem;
}
</style>

<a
class="extra_url"
target="_blank"
href="{{ field.field.value|make_url }}">
Visit site
</a>
<style>
.extra_url {
margin: 1rem;
}
</style>



{% if request.user|has_group:"admin" %}
{% link_to_ripe_stat field.field.value %}
Expand Down

0 comments on commit 6daae29

Please sign in to comment.