mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
FIX: pep8/remove debug print
This commit is contained in:
@@ -45,8 +45,7 @@ class CableTypeForm(forms.ModelForm):
|
||||
def clean(self):
|
||||
form_data = self.cleaned_data
|
||||
queryset = models.CableType.objects.filter(Q(plug=form_data['plug']) & Q(socket=form_data['socket']) & Q(circuits=form_data['circuits']) & Q(cores=form_data['cores']))
|
||||
# Being identical to itself doesn't count...
|
||||
print(self.instance.id)
|
||||
# Being identical to itself shouldn't count...
|
||||
if queryset.exists() and self.instance.pk != queryset[0].pk:
|
||||
raise forms.ValidationError("A cable type that exactly matches this one already exists, please use that instead.", code="notunique")
|
||||
return form_data
|
||||
|
||||
@@ -78,7 +78,7 @@ class CableType(models.Model):
|
||||
related_name='socket', blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return "%s → %s" % (self.plug.description, self.socket.description)
|
||||
return "%s → %s" % (self.plug.description, self.socket.description)
|
||||
|
||||
|
||||
@reversion.register
|
||||
@@ -113,7 +113,6 @@ class Asset(models.Model, RevisionMixin):
|
||||
csa = models.DecimalField(decimal_places=2, max_digits=10,
|
||||
blank=True, null=True, help_text='mm^2')
|
||||
|
||||
|
||||
# Hidden asset_id components
|
||||
# For example, if asset_id was "C1001" then asset_id_prefix would be "C" and number "1001"
|
||||
asset_id_prefix = models.CharField(max_length=8, default="")
|
||||
|
||||
@@ -278,7 +278,8 @@ class CableTypeCreate(generic.CreateView):
|
||||
return context
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse("cable_type_detail", kwargs={"pk": self.object.pk })
|
||||
return reverse("cable_type_detail", kwargs={"pk": self.object.pk})
|
||||
|
||||
|
||||
class CableTypeUpdate(generic.UpdateView):
|
||||
model = models.CableType
|
||||
@@ -292,4 +293,4 @@ class CableTypeUpdate(generic.UpdateView):
|
||||
return context
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse("cable_type_detail", kwargs={"pk": self.object.pk })
|
||||
return reverse("cable_type_detail", kwargs={"pk": self.object.pk})
|
||||
|
||||
Reference in New Issue
Block a user