[mezzanine-users] Re: How to load template based on slug?

2017-11-05 Thread Tom Tanner
When I run `python manage.py runserver`, it shows the info for the 
instance. Mezzanine 4.2.3, Django 1.10.8, Python 2.7.13, and SQLite 
3.16.2...

On Sunday, November 5, 2017 at 8:26:45 PM UTC-5, Tom Tanner wrote:
>
> In my case, I initiated things with `python manage.db createdb --noinput`. 
> I have PostgreSQL on my machine. Mezzanine's info will be in a Postgres 
> database? If so, where must I look in Postgres?
>
> On Sunday, November 5, 2017 at 4:57:12 PM UTC-5, Rainell Dilou Gómez wrote:
>>
>> You can do it using command lines in a terminal, which is very laborious, 
>> or by installing a client that facilitates the work. In any case, it 
>> depends on the type of database you are using. By default Django, and also 
>> Mezzanine, uses sqlite, so you should install a client for that type of 
>> database. I use PostgreSQL as a database and pgAdmin4 as a client. If you 
>> want to simplify the work, I would recommend that you use the *PostgreSQL 
>> installer of enterprisedb 
>> *, 
>> it also install pgAdmin4. PostgreSQL and pgAdmin4 will be installed and 
>> configured very easily, then you will have to change the configuration of 
>> the database in the file local_settings.py of your project, set ENGINE: 
>> "django.db.backends.postgresql_psycopg2". Oh, I forgot, ensure that 
>> *psycopg2 
>> * is installed in your 
>> virtual environment or in your system if you are not using a virtual 
>> environment.
>>
>> Il giorno domenica 5 novembre 2017 00:35:50 UTC+1, Tom Tanner ha scritto:
>>>
>>> Hey everyone,
>>>
>>> When I go to `http://127.0.0.1:8000/projects/some-slug` 
>>> , I want Mezzanine to fetch 
>>> the `project_detail.html` template, which would include `some-slug.html`. 
>>> How do I do this? 
>>>
>>> Here's `urls.py`.
>>> url("^projects/(?P.*)%s$" % _slash, project_detail, name=
>>> "project_detail"), 
>>>
>>>
>>>
>>> `models.py`.
>>> class ProjectLinkPage(Displayable)
>>>  '''
>>>  A page representing the format of the page that 
>>>  has links to standalone, projectlink projectlinks
>>>  '''
>>>
>>>
>>>  # Fields and `class Meta`, etc...
>>>
>>>
>>>  @models.permalink
>>>  def get_absolute_url(self):
>>>  return ("project_detail", (), {"slug": self.slug})
>>>
>>>
>>> `views.py`
>>> def project_detail(request, slug, template=
>>> "projects/project_detail.html", extra_context=None):
>>>  '''
>>>  Custom templates are checked for by using the name
>>>  `projects/project_detail/XXX.html`` where `XXX` is the project slug.
>>>  '''
>>>
>>>
>>>  project = get_object_or_404(Project, slug=slug, status=2)
>>>  context = {
>>>  "project": project,
>>>  "editable_obj": project
>>>  }
>>>  context.update(extra_context or {})
>>>  templates = [u"projects/project_detail/%s.html" % str(slug), template]
>>>  return TemplateResponse(request, templates, context)
>>>
>>> `project_detail.html`
>>> {% extends "base.html" %}
>>> {% load mezzanine_tags keyword_tags %}
>>>
>>>
>>> {% block meta_title %}
>>>  {{ project.meta_title }}
>>> {% endblock %}
>>>
>>>
>>> {% block meta_keywords %}
>>>  {% metablock %}
>>>  {% keywords_for project as tags %}
>>>  {% for tag in tags %}{% if not forloop.first %}, {% endif %}{{ tag }}{% 
>>> endfor %}
>>>  {% endmetablock %}
>>> {% endblock %}
>>>
>>>
>>> {% block meta_description %}
>>>  {% metablock %}{{ project.description }}{% endmetablock %}
>>> {% endblock %}
>>>
>>>
>>> {% block title %}
>>>  {{ project.title }} 
>>> {% endblock %}
>>>
>>>
>>> {% block main %}
>>>  {{ project.content }}
>>> {% endblock %}
>>>
>>> But I'm not sure where to go from here. How do I transfer the slug to 
>>> `project_detail.html` so it knows where to look? In this case, I'd have a 
>>> folder named `slugs` in the same directory as `project_detail.html`. And 
>>> `slugs` would have templates named after slugs.
>>>
>>

-- 
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Re: How to load template based on slug?

2017-11-05 Thread Tom Tanner
In my case, I initiated things with `python manage.db createdb --noinput`. 
I have PostgreSQL on my machine. Mezzanine's info will be in a Postgres 
database? If so, where must I look in Postgres?

On Sunday, November 5, 2017 at 4:57:12 PM UTC-5, Rainell Dilou Gómez wrote:
>
> You can do it using command lines in a terminal, which is very laborious, 
> or by installing a client that facilitates the work. In any case, it 
> depends on the type of database you are using. By default Django, and also 
> Mezzanine, uses sqlite, so you should install a client for that type of 
> database. I use PostgreSQL as a database and pgAdmin4 as a client. If you 
> want to simplify the work, I would recommend that you use the *PostgreSQL 
> installer of enterprisedb 
> *, 
> it also install pgAdmin4. PostgreSQL and pgAdmin4 will be installed and 
> configured very easily, then you will have to change the configuration of 
> the database in the file local_settings.py of your project, set ENGINE: 
> "django.db.backends.postgresql_psycopg2". Oh, I forgot, ensure that *psycopg2 
> * is installed in your 
> virtual environment or in your system if you are not using a virtual 
> environment.
>
> Il giorno domenica 5 novembre 2017 00:35:50 UTC+1, Tom Tanner ha scritto:
>>
>> Hey everyone,
>>
>> When I go to `http://127.0.0.1:8000/projects/some-slug` 
>> , I want Mezzanine to fetch 
>> the `project_detail.html` template, which would include `some-slug.html`. 
>> How do I do this? 
>>
>> Here's `urls.py`.
>> url("^projects/(?P.*)%s$" % _slash, project_detail, name=
>> "project_detail"), 
>>
>>
>>
>> `models.py`.
>> class ProjectLinkPage(Displayable)
>>  '''
>>  A page representing the format of the page that 
>>  has links to standalone, projectlink projectlinks
>>  '''
>>
>>
>>  # Fields and `class Meta`, etc...
>>
>>
>>  @models.permalink
>>  def get_absolute_url(self):
>>  return ("project_detail", (), {"slug": self.slug})
>>
>>
>> `views.py`
>> def project_detail(request, slug, template="projects/project_detail.html"
>> , extra_context=None):
>>  '''
>>  Custom templates are checked for by using the name
>>  `projects/project_detail/XXX.html`` where `XXX` is the project slug.
>>  '''
>>
>>
>>  project = get_object_or_404(Project, slug=slug, status=2)
>>  context = {
>>  "project": project,
>>  "editable_obj": project
>>  }
>>  context.update(extra_context or {})
>>  templates = [u"projects/project_detail/%s.html" % str(slug), template]
>>  return TemplateResponse(request, templates, context)
>>
>> `project_detail.html`
>> {% extends "base.html" %}
>> {% load mezzanine_tags keyword_tags %}
>>
>>
>> {% block meta_title %}
>>  {{ project.meta_title }}
>> {% endblock %}
>>
>>
>> {% block meta_keywords %}
>>  {% metablock %}
>>  {% keywords_for project as tags %}
>>  {% for tag in tags %}{% if not forloop.first %}, {% endif %}{{ tag }}{% 
>> endfor %}
>>  {% endmetablock %}
>> {% endblock %}
>>
>>
>> {% block meta_description %}
>>  {% metablock %}{{ project.description }}{% endmetablock %}
>> {% endblock %}
>>
>>
>> {% block title %}
>>  {{ project.title }} 
>> {% endblock %}
>>
>>
>> {% block main %}
>>  {{ project.content }}
>> {% endblock %}
>>
>> But I'm not sure where to go from here. How do I transfer the slug to 
>> `project_detail.html` so it knows where to look? In this case, I'd have a 
>> folder named `slugs` in the same directory as `project_detail.html`. And 
>> `slugs` would have templates named after slugs.
>>
>

-- 
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Re: How to load template based on slug?

2017-11-05 Thread Rainell Dilou Gómez
You can do it using command lines in a terminal, which is very laborious, 
or by installing a client that facilitates the work. In any case, it 
depends on the type of database you are using. By default Django, and also 
Mezzanine, uses sqlite, so you should install a client for that type of 
database. I use PostgreSQL as a database and pgAdmin4 as a client. If you 
want to simplify the work, I would recommend that you use the *PostgreSQL 
installer of enterprisedb 
*, it 
also install pgAdmin4. PostgreSQL and pgAdmin4 will be installed and 
configured very easily, then you will have to change the configuration of 
the database in the file local_settings.py of your project, set ENGINE: 
"django.db.backends.postgresql_psycopg2". Oh, I forgot, ensure that *psycopg2 
* is installed in your virtual 
environment or in your system if you are not using a virtual environment.

Il giorno domenica 5 novembre 2017 00:35:50 UTC+1, Tom Tanner ha scritto:
>
> Hey everyone,
>
> When I go to `http://127.0.0.1:8000/projects/some-slug` 
> , I want Mezzanine to fetch the 
> `project_detail.html` template, which would include `some-slug.html`. How 
> do I do this? 
>
> Here's `urls.py`.
> url("^projects/(?P.*)%s$" % _slash, project_detail, name=
> "project_detail"), 
>
>
>
> `models.py`.
> class ProjectLinkPage(Displayable)
>  '''
>  A page representing the format of the page that 
>  has links to standalone, projectlink projectlinks
>  '''
>
>
>  # Fields and `class Meta`, etc...
>
>
>  @models.permalink
>  def get_absolute_url(self):
>  return ("project_detail", (), {"slug": self.slug})
>
>
> `views.py`
> def project_detail(request, slug, template="projects/project_detail.html", 
> extra_context=None):
>  '''
>  Custom templates are checked for by using the name
>  `projects/project_detail/XXX.html`` where `XXX` is the project slug.
>  '''
>
>
>  project = get_object_or_404(Project, slug=slug, status=2)
>  context = {
>  "project": project,
>  "editable_obj": project
>  }
>  context.update(extra_context or {})
>  templates = [u"projects/project_detail/%s.html" % str(slug), template]
>  return TemplateResponse(request, templates, context)
>
> `project_detail.html`
> {% extends "base.html" %}
> {% load mezzanine_tags keyword_tags %}
>
>
> {% block meta_title %}
>  {{ project.meta_title }}
> {% endblock %}
>
>
> {% block meta_keywords %}
>  {% metablock %}
>  {% keywords_for project as tags %}
>  {% for tag in tags %}{% if not forloop.first %}, {% endif %}{{ tag }}{% 
> endfor %}
>  {% endmetablock %}
> {% endblock %}
>
>
> {% block meta_description %}
>  {% metablock %}{{ project.description }}{% endmetablock %}
> {% endblock %}
>
>
> {% block title %}
>  {{ project.title }} 
> {% endblock %}
>
>
> {% block main %}
>  {{ project.content }}
> {% endblock %}
>
> But I'm not sure where to go from here. How do I transfer the slug to 
> `project_detail.html` so it knows where to look? In this case, I'd have a 
> folder named `slugs` in the same directory as `project_detail.html`. And 
> `slugs` would have templates named after slugs.
>

-- 
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Case insensitive username login

2017-11-05 Thread Chris Hawes
There are two problems I see with doing this for email addresses.

1) Email addresses could be case sensitive -- not the domain, but the 
host-specific part (though I doubt many hosts actually allow this in 
practice). CHRIS@server could be a different user than chris@server.

2) Mezzanine does not enforce case-insensitive email addresses, unlike 
usernames (see `mezzanine.accounts.forms.ProfileForm.clean_email()`). It is 
possible that existing installations could have users with email addresses 
that differ only by case. Perhaps somebody sneaky posing as multiple users. 
This would have to be a setting so that an admin could look at their 
particular case and see whether it is safe to turn on.

Usernames are different. I think the typical non-tech-savvy web user 
doesn't think about case or even realize that 'c' and 'C' are not the same. 
It's just another name for themselves, and in the real world, names are not 
case sensitive. The name on my birth certificate may be Chris, but when a 
letter arrives at my house addressed to CHRIS, I don't send it back.

Chris



On Sunday, 5 November 2017 15:27:09 UTC-5, Danny S wrote:
>
> On 5/11/2017 1:24 PM, Chris Hawes wrote:
>
> I'm wondering if there is a reason 
> mezzanine.core.auth_backends.MezzanineBackend doesn't support 
> case-insensitive usernames for logging in? 
> mezzanine.accounts.forms.ProfileForm enforces case-insensitive username 
> uniqueness when registering, so it seems like it would be natural to allow 
> them for logging in. It feels to me like a bug that it doesn't. 
>
>
> I bring this up because I've had users of my site write to me bewildered 
> that they can't log in, and then it turns out they had capitalization in 
> their username and just assumed that it wouldn't matter, as is the case on 
> other sites.
>
>
> If others do not agree that it is a bug, perhaps adding a setting for this 
> would be appropriate. In any case I would be happy to work on a PR if there 
> is agreement on a change.
>
>
> I've certainly had the case where users have contacted me because they'd 
> put some capitalisation in their original signup email address and then 
> tried to log in using it in all lowercase -- and in the case of email 
> addresses, case is DEFINITELY not important - so I don't know why it seems 
> to be for the Mezzanine/Django login.
>
> So if usernames are also not case sensitive, we should definitely fix it 
> for both.
>
> Seeya. Danny.
>
>

-- 
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Case insensitive username login

2017-11-05 Thread Danny

On 5/11/2017 1:24 PM, Chris Hawes wrote:


I'm wondering if there is a reason 
|mezzanine.core.auth_backends.MezzanineBackend| doesn't support 
case-insensitive usernames for logging in? 
|mezzanine.accounts.forms.ProfileForm| enforces case-insensitive 
username uniqueness when registering, so it seems like it would be 
natural to allow them for logging in. It feels to me like a bug that 
it doesn't.



I bring this up because I've had users of my site write to me 
bewildered that they can't log in, and then it turns out they had 
capitalization in their username and just assumed that it wouldn't 
matter, as is the case on other sites.



If others do not agree that it is a bug, perhaps adding a setting for 
this would be appropriate. In any case I would be happy to work on a 
PR if there is agreement on a change.




I've certainly had the case where users have contacted me because they'd 
put some capitalisation in their original signup email address and then 
tried to log in using it in all lowercase -- and in the case of email 
addresses, case is DEFINITELY not important - so I don't know why it 
seems to be for the Mezzanine/Django login.


So if usernames are also not case sensitive, we should definitely fix it 
for both.


Seeya. Danny.

--
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Re: How to load template based on slug?

2017-11-05 Thread Tom Tanner
Hi Rainell,

Thanks for replying. Still learning Mezzanine. Where do I access the 
database table?

On Sunday, November 5, 2017 at 6:28:11 AM UTC-5, Rainell Dilou Gómez wrote:
>
> Hello Tom,
> I have not understood your question well, but I will try to help you 
> understand how works your example.
>
> 1. Your model inherits the Displayable class, therefore there will be a 
> slug field in the respective database table. Take a look at the table of 
> your model in the database and you can see the slug field.
>
> 2. In the model you have declared the absolute url, where you specify the 
> name of the urlpattern (project_detail) that must be used and the parameter 
> that must be passed to it (slug).
>
> 3. In the urlpattern you have specified the view that must be called to 
> process that request.
>
> 4. Then, in the view method (def project_detail(...)) called through the 
> urlpatthern, you have declared that this method expects the slug parameter 
> and you have declared the template that will be used 
> (template="projects/project_detail.html").
>
> 5. Queryset is created through get_object_or_404, which in this case would 
> be something like this:
>
> "SELECT * FROM yourapp_projectlinkpage WHERE slug='some-slug' AND status=2"
>
> 6. The view gives the specified template the context with the instance 
> obtained through the queryset.
>
> 7. Template render the page with the instance that has been passed in the 
> context.
>
> An observation about the view method. In the templates variable 
> declaration you should substituting "projects/project_detail /% s.html" 
> with "projects/project_detail_% s.html"
>
> 8. The content you have written when you have created a project through 
> the admin interface, will be rendered by the template through the tag {{ 
> project.content }}
>
>
> Il giorno domenica 5 novembre 2017 00:35:50 UTC+1, Tom Tanner ha scritto:
>>
>> Hey everyone,
>>
>> When I go to `http://127.0.0.1:8000/projects/some-slug` 
>> , I want Mezzanine to fetch 
>> the `project_detail.html` template, which would include `some-slug.html`. 
>> How do I do this? 
>>
>> Here's `urls.py`.
>> url("^projects/(?P.*)%s$" % _slash, project_detail, name=
>> "project_detail"), 
>>
>>
>>
>> `models.py`.
>> class ProjectLinkPage(Displayable)
>>  '''
>>  A page representing the format of the page that 
>>  has links to standalone, projectlink projectlinks
>>  '''
>>
>>
>>  # Fields and `class Meta`, etc...
>>
>>
>>  @models.permalink
>>  def get_absolute_url(self):
>>  return ("project_detail", (), {"slug": self.slug})
>>
>>
>> `views.py`
>> def project_detail(request, slug, template="projects/project_detail.html"
>> , extra_context=None):
>>  '''
>>  Custom templates are checked for by using the name
>>  `projects/project_detail/XXX.html`` where `XXX` is the project slug.
>>  '''
>>
>>
>>  project = get_object_or_404(Project, slug=slug, status=2)
>>  context = {
>>  "project": project,
>>  "editable_obj": project
>>  }
>>  context.update(extra_context or {})
>>  templates = [u"projects/project_detail/%s.html" % str(slug), template]
>>  return TemplateResponse(request, templates, context)
>>
>> `project_detail.html`
>> {% extends "base.html" %}
>> {% load mezzanine_tags keyword_tags %}
>>
>>
>> {% block meta_title %}
>>  {{ project.meta_title }}
>> {% endblock %}
>>
>>
>> {% block meta_keywords %}
>>  {% metablock %}
>>  {% keywords_for project as tags %}
>>  {% for tag in tags %}{% if not forloop.first %}, {% endif %}{{ tag }}{% 
>> endfor %}
>>  {% endmetablock %}
>> {% endblock %}
>>
>>
>> {% block meta_description %}
>>  {% metablock %}{{ project.description }}{% endmetablock %}
>> {% endblock %}
>>
>>
>> {% block title %}
>>  {{ project.title }} 
>> {% endblock %}
>>
>>
>> {% block main %}
>>  {{ project.content }}
>> {% endblock %}
>>
>> But I'm not sure where to go from here. How do I transfer the slug to 
>> `project_detail.html` so it knows where to look? In this case, I'd have a 
>> folder named `slugs` in the same directory as `project_detail.html`. And 
>> `slugs` would have templates named after slugs.
>>
>

-- 
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Re: How to load template based on slug?

2017-11-05 Thread Rainell Dilou Gómez
Hello Tom,
I have not understood your question well, but I will try to help you 
understand how works your example.

1. Your model inherits the Displayable class, therefore there will be a 
slug field in the respective database table. Take a look at the table of 
your model in the database and you can see the slug field.

2. In the model you have declared the absolute url, where you specify the 
name of the urlpattern (project_detail) that must be used and the parameter 
that must be passed to it (slug).

3. In the urlpattern you have specified the view that must be called to 
process that request.

4. Then, in the view method (def project_detail(...)) called through the 
urlpatthern, you have declared that this method expects the slug parameter 
and you have declared the template that will be used 
(template="projects/project_detail.html").

5. Queryset is created through get_object_or_404, which in this case would 
be something like this:

"SELECT * FROM yourapp_projectlinkpage WHERE slug='some-slug' AND status=2"

6. The view gives the specified template the context with the instance 
obtained through the queryset.

7. Template render the page with the instance that has been passed in the 
context.

An observation about the view method. In the templates variable declaration 
you should substituting "projects/project_detail /% s.html" with 
"projects/project_detail_% s.html"

8. The content you have written when you have created a project through the 
admin interface, will be rendered by the template through the tag {{ 
project.content }}


Il giorno domenica 5 novembre 2017 00:35:50 UTC+1, Tom Tanner ha scritto:
>
> Hey everyone,
>
> When I go to `http://127.0.0.1:8000/projects/some-slug` 
> , I want Mezzanine to fetch the 
> `project_detail.html` template, which would include `some-slug.html`. How 
> do I do this? 
>
> Here's `urls.py`.
> url("^projects/(?P.*)%s$" % _slash, project_detail, name=
> "project_detail"), 
>
>
>
> `models.py`.
> class ProjectLinkPage(Displayable)
>  '''
>  A page representing the format of the page that 
>  has links to standalone, projectlink projectlinks
>  '''
>
>
>  # Fields and `class Meta`, etc...
>
>
>  @models.permalink
>  def get_absolute_url(self):
>  return ("project_detail", (), {"slug": self.slug})
>
>
> `views.py`
> def project_detail(request, slug, template="projects/project_detail.html", 
> extra_context=None):
>  '''
>  Custom templates are checked for by using the name
>  `projects/project_detail/XXX.html`` where `XXX` is the project slug.
>  '''
>
>
>  project = get_object_or_404(Project, slug=slug, status=2)
>  context = {
>  "project": project,
>  "editable_obj": project
>  }
>  context.update(extra_context or {})
>  templates = [u"projects/project_detail/%s.html" % str(slug), template]
>  return TemplateResponse(request, templates, context)
>
> `project_detail.html`
> {% extends "base.html" %}
> {% load mezzanine_tags keyword_tags %}
>
>
> {% block meta_title %}
>  {{ project.meta_title }}
> {% endblock %}
>
>
> {% block meta_keywords %}
>  {% metablock %}
>  {% keywords_for project as tags %}
>  {% for tag in tags %}{% if not forloop.first %}, {% endif %}{{ tag }}{% 
> endfor %}
>  {% endmetablock %}
> {% endblock %}
>
>
> {% block meta_description %}
>  {% metablock %}{{ project.description }}{% endmetablock %}
> {% endblock %}
>
>
> {% block title %}
>  {{ project.title }} 
> {% endblock %}
>
>
> {% block main %}
>  {{ project.content }}
> {% endblock %}
>
> But I'm not sure where to go from here. How do I transfer the slug to 
> `project_detail.html` so it knows where to look? In this case, I'd have a 
> folder named `slugs` in the same directory as `project_detail.html`. And 
> `slugs` would have templates named after slugs.
>

-- 
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Re: How does get_absolute_url() work?

2017-11-05 Thread Rainell Dilou Gómez
Following the code example we've seen so far, yes. Note that some-project 
corresponds to the slug parameter expected by the pattern, then it must 
match the slug field of a record.

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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.