it show page not found (404)... On Tuesday, January 27, 2015 at 12:16:18 AM UTC+8, Josh Cartmell wrote: > > What happened when you tried what you posted above? > > I don't think this has anything to do with using Displayable (I don't > think Displayable does anything to templates) and more likely has to do > with the view. > > On Mon, Jan 26, 2015 at 5:16 AM, S.C. <[email protected] <javascript:>> > wrote: > >> 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] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > >
-- 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.
