-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split base concerns into separate apps
- Loading branch information
Showing
104 changed files
with
1,111 additions
and
764 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.contrib import admin | ||
|
||
from . import models | ||
|
||
admin.site.register(models.Association) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class AssociationsConfig(AppConfig): | ||
name = 'associations' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 2.0.7 on 2018-07-10 23:19 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Association', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.TextField(unique=True)), | ||
('abbreviation', models.TextField()), | ||
('bhv_id', models.IntegerField(unique=True)), | ||
], | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from django.conf import settings | ||
from django.db import models | ||
from django.urls import reverse | ||
|
||
|
||
class Association(models.Model): | ||
name = models.TextField(unique=True) | ||
abbreviation = models.TextField() | ||
bhv_id = models.IntegerField(unique=True) | ||
|
||
def __str__(self): | ||
return '{} {}'.format(self.bhv_id, self.abbreviation) | ||
|
||
def get_absolute_url(self): | ||
return reverse('associations:detail', kwargs={'bhv_id': self.bhv_id}) | ||
|
||
@staticmethod | ||
def build_source_url(bhv_id): | ||
return settings.ROOT_SOURCE_URL + 'Spielbetrieb/index.php?orgGrpID={}'.format(bhv_id) | ||
|
||
def source_url(self): | ||
return self.build_source_url(self.bhv_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from django.test import TestCase | ||
|
||
|
||
class TestViews(TestCase): | ||
def test_list(self): | ||
response = self.client.get('/verbaende/') | ||
self.assertEqual(response.status_code, 200) | ||
|
||
def test_detail(self): | ||
response = self.client.get('/verbaende/1/') | ||
self.assertEqual(response.status_code, 404) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from django.urls import path, include | ||
|
||
from .views import list, detail | ||
|
||
app_name = 'associations' | ||
|
||
urlpatterns = [ | ||
path('', list, name='list'), | ||
path('<int:bhv_id>/', include([ | ||
path('', detail, name='detail'), | ||
])), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from django.shortcuts import render, get_object_or_404 | ||
|
||
from .models import Association | ||
|
||
|
||
def list(request): | ||
associations = Association.objects.all() | ||
return render(request, 'associations/list.html', {'associations': associations}) | ||
|
||
|
||
def detail(request, bhv_id): | ||
association = get_object_or_404(Association, bhv_id=bhv_id) | ||
return render(request, 'associations/detail.html', {'association': association}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.