I was unable to link up template for the Displayable's Model, i follow the 
example in the source code but failed to link to the template. 

The app name "*TechSpec*", and the template name for the models "
*tsmodel.html*" (path: templates/techspec/tsmodel.html)

*Models:*
class TSModel(Displayable, RichText):
    order = models.IntegerField(_("Ordering"), default=0)
    title = models.charField(_("Title"), max_length=50)

    class Meta:
        verbose_name = _("TS Model")
        verbose_name_plural = _("TS Models")
        ordering = ("order", )


    @models.permalink
    def get_absolute_url(self):
        return ("techspec_model", (), {"slug": self.slug})

*Views:*
from models import TSModel

def tsmodelview(request, slug, template="techspec/tsmodel.html"):
    tsmodels = TSModel.objects.all()

    tsmodel = get_object_or_404(tsmodels, slug=slug)
    context = {"tsmodel": tsmodel}
    templates = [u"techspec/%s.html" % str(slug), template]
    return render(request, templates, context)

*Urls:*
from views import tsmodelview

urlpatterns = patterns("",
    url("^techspec/(?P<slug>.*)%s$" % _slash, tsmodelview, name=
"techspec_model"),
)

Thank you in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to