Created
April 19, 2012 23:31
-
-
Save kennethlove/2424848 to your computer and use it in GitHub Desktop.
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
{% for model1 in model1s %} | |
{{ model1}} | |
{% endfor %} |
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
from app1.views import HomepageView | |
urlpatterns = patterns( | |
... | |
url(r'^$', HomepageView.as_view(), name="homepage"), | |
... | |
) |
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
from django.views.generic import TemplateView | |
from app1.models import Model1 | |
from app2.models import Model2 | |
class HomepageView(TemplateView): | |
template_name = "homepage.html" | |
def get_context_data(self, **kwargs): | |
kwargs = super(HomepageView, self).get_context_data(**kwargs) | |
model1s = Model1.objects.all() | |
model2s = Model2.objects.all() | |
kwargs.update({"model1s": model1s, "model2s": model2s}) | |
return kwargs | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment