Allow users to select their own default engine
Also, add this default engine and the repo to the users view
This commit is contained in:
1 parent
3b574fb62a
commit
0090b64510
6 files changed
+34
-18
No files matched your search
@@ -32,7 +32,6 @@ FRAMEWORK_DEFAULTS = {
|
||||
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' },
|
||||
'nps' : 1500000,
|
||||
'proto' : 'uci',
|
||||
'default' : True,
|
||||
},
|
||||
|
||||
'Laser' : {
|
||||
@@ -44,7 +43,6 @@ FRAMEWORK_DEFAULTS = {
|
||||
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' },
|
||||
'nps' : 625000,
|
||||
'proto' : 'uci',
|
||||
'default' : False,
|
||||
},
|
||||
|
||||
'Weiss' : {
|
||||
@@ -56,7 +54,6 @@ FRAMEWORK_DEFAULTS = {
|
||||
'smpltc' : { 'threads' : 8, 'hash' : 512, 'timecontrol' : '20.0+0.2' },
|
||||
'nps' : 4000000,
|
||||
'proto' : 'uci',
|
||||
'default' : False,
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ class Profile(Model):
|
||||
games = IntegerField(default=0)
|
||||
tests = IntegerField(default=0)
|
||||
repo = CharField(max_length=256, blank=True)
|
||||
engine = CharField(max_length=128, blank=True)
|
||||
enabled = BooleanField(default=False)
|
||||
approver = BooleanField(default=False)
|
||||
updated = DateTimeField(auto_now=True)
|
||||
|
||||
+2
-1
@@ -89,9 +89,10 @@ def viewProfile(request):
|
||||
@login_required(login_url='/login/')
|
||||
def editProfile(request):
|
||||
|
||||
# Update Email & Source Repo
|
||||
# Update Email, Source Repo, and Default Engine
|
||||
profile = Profile.objects.get(user=request.user)
|
||||
profile.user.email = request.POST['email']
|
||||
profile.engine = request.POST['enginename']
|
||||
profile.repo = request.POST['repo']
|
||||
profile.save()
|
||||
|
||||
|
||||
@@ -57,13 +57,14 @@
|
||||
<h3> Engine </h3>
|
||||
<label> Name </label>
|
||||
<select id="enginename" name="enginename" onchange="configure(testMode)">
|
||||
{% for name, data in config.engines.items %}
|
||||
{% if data.default %}
|
||||
<option selected value="{{name}}">{{data.name}}</option>
|
||||
{% for engine in config.engines %}
|
||||
{% if engine == profile.engine %}
|
||||
<option selected value="{{engine}}">{{engine}}</option>
|
||||
{% else %}
|
||||
<option value="{{name}}">{{data.name}}</option>
|
||||
<option value="{{engine}}">{{engine}}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<option value="{{engine}}">{{engine}}</option>
|
||||
</select><br>
|
||||
<label> Source </label>
|
||||
<input value="{{profile.repo}}" name="source"></br>
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
<th class="numeric">Tests</th>
|
||||
<th>Enabled</th>
|
||||
<th>Approver</th>
|
||||
<th>Engine</th>
|
||||
<th>Repo</th>
|
||||
</tr>
|
||||
{% for profile in profiles %}
|
||||
<tr>
|
||||
@@ -22,10 +24,16 @@
|
||||
<td class="numeric">{{profile.tests}}</td>
|
||||
{% if profile.enabled %}
|
||||
<td class="numeric">X</td>
|
||||
{% else %}
|
||||
<td class="numeric"></td>
|
||||
{% endif %}
|
||||
{% if profile.approver %}
|
||||
<td class="numeric">X</td>
|
||||
{% else %}
|
||||
<td class="numeric"></td>
|
||||
{% endif %}
|
||||
<td>{{profile.engine}}</td>
|
||||
<td><a href="{{profile.repo}}">{{profile.repo}}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<table>
|
||||
|
||||
@@ -8,20 +8,28 @@
|
||||
<form method="POST" action="/editProfile/">
|
||||
{% csrf_token %}
|
||||
<label>Username</label>
|
||||
<input readonly value="{{profile.user.username}}" name="username">
|
||||
</br>
|
||||
<input readonly value="{{profile.user.username}}" name="username"></br>
|
||||
<label>Email</label>
|
||||
<input value="{{profile.user.email}}" name="email">
|
||||
</br>
|
||||
<input value="{{profile.user.email}}" name="email"></br>
|
||||
<label>New Password</label>
|
||||
<input type="password" name="password1">
|
||||
</br>
|
||||
<input type="password" name="password1"></br>
|
||||
<label>New Password</label>
|
||||
<input type="password" name="password2">
|
||||
</br>
|
||||
<input type="password" name="password2"></br>
|
||||
<label>Source Repo</label>
|
||||
<input value="{{profile.repo}}" name="repo">
|
||||
</br>
|
||||
<input value="{{profile.repo}}" name="repo"></br>
|
||||
<label>Engine</label>
|
||||
<select id="enginename" name="enginename" onchange="configure(testMode)">
|
||||
{% for engine in config.engines %}
|
||||
{% if profile.engine == engine %}
|
||||
<option selected value="{{engine}}">{{engine}}</option>
|
||||
{% else %}
|
||||
<option value="{{engine}}">{{engine}}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if not profile.engine %}
|
||||
<option selected value=""></option>
|
||||
{% endif %}
|
||||
</select><br>
|
||||
<input type="submit" name="submit" value="Update Profile">
|
||||
</form>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user