Browse Source

Renames

pull/7/head
Pēteris Caune 10 years ago
parent
commit
c8b24495b9
15 changed files with 31 additions and 51 deletions
  1. +6
    -0
      hc/accounts/views.py
  2. +0
    -0
      hc/api/__init__.py
  3. +7
    -0
      hc/api/admin.py
  4. +3
    -2
      hc/api/migrations/0001_initial.py
  5. +0
    -0
      hc/api/migrations/__init__.py
  6. +1
    -4
      hc/api/models.py
  7. +0
    -0
      hc/api/tests.py
  8. +1
    -1
      hc/api/urls.py
  9. +5
    -5
      hc/api/views.py
  10. +0
    -8
      hc/checks/admin.py
  11. +0
    -23
      hc/checks/migrations/0002_auto_20150610_1852.py
  12. +3
    -3
      hc/front/views.py
  13. +1
    -1
      hc/settings.py
  14. +1
    -1
      hc/urls.py
  15. +3
    -3
      templates/checks/index.html

+ 6
- 0
hc/accounts/views.py View File

@ -5,6 +5,7 @@ from django.contrib.auth import authenticate, login as auth_login
from django.contrib.auth.models import User
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.http import HttpResponseBadRequest
from django.shortcuts import redirect, render
from hc.accounts.forms import EmailForm
@ -19,6 +20,11 @@ def login(request):
if form.is_valid():
email = form.cleaned_data["email"]
user = User.objects.get(email=email)
# We don't want to reset passwords of staff users :-)
if user.is_staff:
return HttpResponseBadRequest()
token = str(uuid.uuid4())
user.set_password(token)
user.save()


hc/checks/__init__.py → hc/api/__init__.py View File


+ 7
- 0
hc/api/admin.py View File

@ -0,0 +1,7 @@
from django.contrib import admin
from hc.api.models import Check
@admin.register(Check)
class ChecksAdmin(admin.ModelAdmin):
list_display = ("id", "code", "user", "last_ping")

hc/checks/migrations/0001_initial.py → hc/api/migrations/0001_initial.py View File


hc/checks/migrations/__init__.py → hc/api/migrations/__init__.py View File


hc/checks/models.py → hc/api/models.py View File


hc/checks/tests.py → hc/api/tests.py View File


hc/checks/urls.py → hc/api/urls.py View File


hc/checks/views.py → hc/api/views.py View File


+ 0
- 8
hc/checks/admin.py View File

@ -1,8 +0,0 @@
from django.contrib import admin
from hc.checks.models import Canary
@admin.register(Canary)
class CanaryAdmin(admin.ModelAdmin):
list_display = ("id", "code", "user", "last_ping")

+ 0
- 23
hc/checks/migrations/0002_auto_20150610_1852.py View File

@ -1,23 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('checks', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='canary',
options={'verbose_name_plural': 'canaries'},
),
migrations.AddField(
model_name='canary',
name='last_ping',
field=models.DateTimeField(null=True, blank=True),
),
]

+ 3
- 3
hc/front/views.py View File

@ -1,15 +1,15 @@
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from hc.checks.models import Canary
from hc.api.models import Check
@login_required
def checks(request):
canaries = Canary.objects.filter(user=request.user)
checks = Check.objects.filter(user=request.user)
ctx = {
"canaries": canaries
"checks": checks
}
return render(request, "checks/index.html", ctx)

+ 1
- 1
hc/settings.py View File

@ -40,7 +40,7 @@ INSTALLED_APPS = (
'django.contrib.staticfiles',
'hc.accounts',
'hc.checks',
'hc.api',
'hc.front'
)


+ 1
- 1
hc/urls.py View File

@ -4,6 +4,6 @@ from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/', include('hc.accounts.urls')),
url(r'^', include('hc.checks.urls')),
url(r'^', include('hc.api.urls')),
url(r'^', include('hc.front.urls')),
]

+ 3
- 3
templates/checks/index.html View File

@ -9,10 +9,10 @@
<th>Code</th>
<th>Last Ping</th>
</tr>
{% for canary in canaries %}
{% for check in checks %}
<tr>
<td>{{ canary.code }}</td>
<td>{{ canary.last_ping }}</td>
<td>{{ check.code }}</td>
<td>{{ check.last_ping }}</td>
</tr>
{% endfor %}


Loading…
Cancel
Save