Skip to content

Commit

Permalink
addition of endpoint full path field
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeaowens committed Oct 18, 2024
1 parent 6b79840 commit af8713f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dojo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1633,6 +1633,8 @@ def age(self):


class Endpoint(models.Model):
full_path = models.CharField(null=True, blank=True, max_length=2020, editable=False,
help_text=_("(readonly) The full path of this endpoint, combining protocol, userinfo, host, etc."))
protocol = models.CharField(null=True, blank=True, max_length=20,
help_text=_("The communication protocol/scheme such as 'http', 'ftp', 'dns', etc."))
userinfo = models.CharField(null=True, blank=True, max_length=500,
Expand Down Expand Up @@ -1718,6 +1720,10 @@ def __str__(self):
url += f"#{self.fragment}"
return url

def save(self, *args, **kwargs):
self.full_path = self.__str__
return super().save(*args, **kwargs)

def get_absolute_url(self):
from django.urls import reverse
return reverse("view_endpoint", args=[str(self.id)])
Expand Down

0 comments on commit af8713f

Please sign in to comment.