Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Vehicle Edit Form #288

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions vehicles/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def media(self):
"previous_reg",
"features",
"notes",
"rules",
"trustedrules",
]
spare_ticket_machine = forms.BooleanField(
required=False,
Expand Down Expand Up @@ -114,12 +116,20 @@ def media(self):
)
notes = forms.CharField(required=False, max_length=255)
summary = fields.SummaryField(
min_length=10,
max_length=255,
help_text="""Briefly explain your changes,
if they need explaining.
help_text="""Please briefly explain your changes and provide proof of your edit.
E.g. how you *know* a vehicle has *definitely been* withdrawn or repainted,
link to a picture to prove it. Be polite.""",
)
rules = forms.BooleanField(
label="I agree that my edit is made in good faith and complies with the editing rules. I also acknowledge that abusing the vehicle editing feature may lead to a ban",
required=true,
)
trustedrules = forms.BooleanField(
label="I agree that my edit is made in good faith and I am not abusing any additional privilages. I also acknowledge that abusing editing feature may lead to privilaged being removed",
required=true,
)

def clean_other_colour(self):
if self.cleaned_data["other_colour"]:
Expand Down Expand Up @@ -153,6 +163,12 @@ def __init__(self, data, *args, user, vehicle, **kwargs):
or vehicle.operator_id in settings.ALLOW_VEHICLE_NOTES_OPERATORS
):
del self.fields["notes"]


if user.is_trusted:
del self.fields["rules"]
else
del self.fields["trustedrules"]

if vehicle.is_spare_ticket_machine():
del self.fields["notes"]
Expand Down