Semi-related question. I want every `project` to be accessed by going to 
`mywebsite.com/projects/some-project/`. Would this be the accepted way to 
do this?

url("^projects/(?P<slug>.*)%s$" % _slash, project_detail, name=
"project_detail"),



On Saturday, November 4, 2017 at 12:07:00 PM UTC-4, Tom Tanner wrote:
>
> Thanks, that worked. 
>
> On Saturday, November 4, 2017 at 7:09:42 AM UTC-4, Rainell Dilou Gómez 
> wrote:
>>
>> *theme* is the name of your application, then you must specify it in the 
>> import
>>
>> from theme.views import project_detail
>>  
>> or
>>
>> from theme import views
>>
>>  in this case do that
>>
>> url("^(?P<slug>.*)%s$" % _slash, views.project_detail, name=
>> "project_detail"),
>>
>>
>> Il giorno domenica 22 ottobre 2017 00:36:31 UTC+2, Tom Tanner ha scritto:
>>>
>>>
>>> Hey all,
>>>
>>> I've started a new Mezzanine site. I'm trying to make a page where I can 
>>> post elements from the Admin menu. Kind of l like the Blog section.
>>>
>>> Here's what my custom class looks like in my app's `models.py`.
>>>
>>>
>>> class ProjectLinkPage(Displayable):
>>>  '''
>>>  A page representing the format of the page that 
>>>  has links to standalone, projectlink projectlinks
>>>  '''
>>>  categories = models.ManyToManyField("ProjectCategory",
>>>  verbose_name=_("Categories"),
>>>  blank=True, related_name="projectlinkposts")
>>>  # allow_comments = models.BooleanField(verbose_name=_("Allow 
>>> comments"),
>>>  # default=False)
>>>  # comments = CommentsField(verbose_name=_("Comments"))
>>>  # featured_image = FileField(verbose_name=_("Featured Image"),
>>>  # upload_to=upload_to("projectlink.ProjectPost.featured_image", 
>>> "projectlink"),
>>>  # format="Image", max_length=255, null=True, blank=True)
>>>  # related_posts = models.ManyToManyField("self",
>>>  # verbose_name=_("Related posts"), blank=True)
>>>  # admin_thumb_field = "featured_image"
>>>
>>>
>>>  class Meta:
>>>  verbose_name=_("Project link")
>>>  verbose_name_plural=_("Project links")
>>>  ordering=("-publish_date",)
>>>
>>>
>>>  def get_absolute_url(self):
>>>  return self.slug
>>>
>>> When I open the Admin section, I see "Project links" on the left-side 
>>> menu. I click it, then click "Add Project Link." I fill out the form and 
>>> click "save." I then click "View on site." My browser tries to open "
>>> http://127.0.0.1:8000/admin/r/32/2/,"; but I get a browser error: "This 
>>> page isn't working. 127.0.0.1 sent an invalid response." My terminal looks 
>>> like this when I clicked "View on site":
>>>
>>> [21/Oct/2017 22:35:39] "GET /admin/r/32/2/ HTTP/1.1" 302 0
>>> [21/Oct/2017 22:35:39] "GET /admin/r/32/2/ HTTP/1.1" 302 0
>>>
>>> I figure I must be defining `get_absolute_url()` wrong. What must I fix 
>>> so that 'View on site" leads to the right address?
>>>
>>

-- 
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