forked from ietf-tools/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move all state help to /doc. Fixes ietf-tools#3802
- Loading branch information
Showing
7 changed files
with
60 additions
and
69 deletions.
There are no files selected for viewing
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 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 |
---|---|---|
@@ -1,21 +1,13 @@ | ||
from pyquery import PyQuery | ||
|
||
from django.urls import reverse | ||
|
||
import debug # pyflakes:ignore | ||
|
||
from ietf.utils.test_utils import TestCase | ||
from ietf.doc.models import StateType | ||
|
||
class HelpPageTests(TestCase): | ||
|
||
def test_state_index(self): | ||
url = reverse('ietf.help.views.state_index') | ||
r = self.client.get(url) | ||
q = PyQuery(r.content) | ||
content = [ e.text for e in q('#content table td a ') ] | ||
names = StateType.objects.values_list('slug', flat=True) | ||
# The following doesn't cover all doc types, only a selection | ||
for name in names: | ||
if not '-' in name: | ||
self.assertIn(name, content) | ||
# Make sure you get at least a redirect | ||
self.assertEqual(r.status_code,301) |
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 |
---|---|---|
@@ -1,33 +1,20 @@ | ||
# Copyright The IETF Trust 2007, All Rights Reserved | ||
|
||
from django.shortcuts import get_object_or_404, render | ||
|
||
import debug # pyflakes:ignore | ||
|
||
from ietf.doc.models import State, StateType | ||
from ietf.name.models import StreamName | ||
from django.shortcuts import redirect | ||
|
||
# These are just redirects to the new URLs under /doc; can probably go away eventually. | ||
|
||
def state_index(request): | ||
types = StateType.objects.all() | ||
names = [ type.slug for type in types ] | ||
for type in types: | ||
if "-" in type.slug and type.slug.split('-',1)[0] in names: | ||
type.stategroups = None | ||
else: | ||
groups = StateType.objects.filter(slug__startswith=type.slug) | ||
type.stategroups = [ g.slug[len(type.slug)+1:] for g in groups if not g == type ] or "" | ||
|
||
return render(request, 'help/state_index.html', {"types": types}) | ||
return redirect('/doc/help/state/', permanent = True) | ||
|
||
def state(request, doc, type=None): | ||
if type: | ||
streams = [ s.slug for s in StreamName.objects.all() ] | ||
if type in streams: | ||
type = "stream-%s" % type | ||
slug = "%s-%s" % (doc,type) if type else doc | ||
statetype = get_object_or_404(StateType, slug=slug) | ||
states = State.objects.filter(used=True, type=statetype).order_by('order') | ||
if doc == 'draft' and type: | ||
return redirect('/doc/help/state/%s' % slug, permanent = True) | ||
return render(request, 'help/states.html', {"doc": doc, "type": statetype, "states":states} ) | ||
return redirect('/doc/help/state/%s' % slug, permanent = True) | ||
|
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.