Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Move document state help to /doc (#7206)
* Redirect /help/state/draft/* to /doc/help/state/draft-* * Adjust document state index to use /doc/help/state for URLs * Move all state help to /doc. Fixes #3802 * Move state index redirect into urls file.
- Loading branch information
Showing
8 changed files
with
65 additions
and
82 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 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
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,30 +1,17 @@ | ||
# 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 | ||
|
||
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}) | ||
# This is just a redirect to the new URL under /doc; can probably go away eventually. | ||
|
||
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') | ||
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.