mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-04-11 10:21:08 +00:00
More work to try and get the initial index working. Not sure why this works with Mongonaut but not here
This commit is contained in:
parent
0beeabdcca
commit
a2aa05e53a
3 changed files with 10 additions and 6 deletions
|
|
@ -2,8 +2,11 @@
|
|||
<body>
|
||||
<h1>Index</h1>
|
||||
|
||||
<table>
|
||||
{% for obj in object_list %}
|
||||
{{ obj }}
|
||||
<tr><td>{{ obj. }}</td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -9,6 +9,7 @@ class AppStore(object):
|
|||
for key in module.__dict__.keys():
|
||||
model_candidate = getattr(module, key)
|
||||
if hasattr(model_candidate, 'admin2'):
|
||||
print model_candidate
|
||||
self.add_model(model_candidate)
|
||||
|
||||
def add_model(self, model):
|
||||
|
|
@ -19,16 +20,15 @@ class AppStore(object):
|
|||
def get_admin2s():
|
||||
""" Returns a list of all admin2 implementations for the site """
|
||||
apps = []
|
||||
for app_name in [x for x in settings.INSTALLED_APPS if x != 'admin2']:
|
||||
name = "{0}.admin2".format(app_name)
|
||||
for app_name in [x for x in settings.INSTALLED_APPS]:
|
||||
try:
|
||||
module = import_module(name)
|
||||
module = import_module("%s.admin2" % app_name)
|
||||
except ImportError as e:
|
||||
if str(e) == "No module named admin2":
|
||||
continue
|
||||
print name
|
||||
raise e
|
||||
|
||||
#print app_name, module
|
||||
app_store = AppStore(module)
|
||||
apps.append(dict(
|
||||
app_name=app_name,
|
||||
|
|
|
|||
|
|
@ -4,12 +4,13 @@ from django.conf import settings
|
|||
from django.views.generic import ListView
|
||||
|
||||
from braces.views import LoginRequiredMixin, StaffuserRequiredMixin
|
||||
|
||||
from .utils import get_admin2s
|
||||
|
||||
ADMIN2_THEME_DIRECTORY = getattr(settings, "ADMIN2_THEME_DIRECTORY", "admin2/bootstrap")
|
||||
|
||||
|
||||
class IndexView(LoginRequiredMixin, StaffuserRequiredMixin, ListView):
|
||||
class IndexView(ListView):#(LoginRequiredMixin, StaffuserRequiredMixin, ListView):
|
||||
|
||||
def get_template_names(self):
|
||||
return [join(ADMIN2_THEME_DIRECTORY, "index.html")]
|
||||
|
|
|
|||
Loading…
Reference in a new issue