tunic-tracker-redux/tunictracker/tracker/forms.py

15 lines
667 B
Python

from django import forms
from json import loads
class ServerAddressForm(forms.Form):
with open('tracker/static/tracker/data/listen_address.json', 'r') as address:
read_address = loads(address.read())
if (read_address['address']['user'] != ""):
server_address = read_address['address']['user']
else:
server_address = read_address['address']['default']
server_address_form = forms.URLField(
max_length=1312, initial=server_address, empty_value="http://localhost:8000/", label="")
server_address_form.widget.attrs["class"] = "w-full text-sm rounded-md border-2 border-bluelight-dark bg-[#242424]/10"