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

Closed
wants to merge 8 commits into from
Closed
Changes from 2 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
19 changes: 17 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",
"superrules",
]
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,
)
superrules = forms.BooleanField(
label="I agree that my edit is made in good faith and I am not abusing my 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 @@ -148,11 +158,16 @@ def __init__(self, data, *args, user, vehicle, **kwargs):
self.fields["summary"].required = False

if not user.is_superuser:
del self.fields["superrules"]
if not (
vehicle.notes
or vehicle.operator_id in settings.ALLOW_VEHICLE_NOTES_OPERATORS
):
del self.fields["notes"]


if user.is_superuser:
del self.fields["rules"]

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