For a view, especially a simple one like the profile view, I would create a
url in your own project that will match requests that Mezzanine's profile
url would otherwise match.  Put it in your own project's urls before the
mezzanine urls are included that way it will be matched and Mezzanine's
will never be touched.  Then you can point it at any view you like.

Pseudo code:

url.py

      '/acounts/[username]/' - > your_custom_view # before Mezzanine's urls
so that it is found first
      '^' -> Mezzanine urls



On Fri, Feb 7, 2014 at 4:45 AM, oneloop <[email protected]> wrote:

> Yes, that is exactly what I had in mind!
>
> But, how do I override a view (because I want to add custom context)? I
> know how to override a template, but a view?
>
>
>
> On Wednesday, February 5, 2014 6:37:59 PM UTC, Josh Cartmell wrote:
>
>> Hey oneloop, Mezzanine's profiles don't use Pages at all.
>>
>> They just use a normal Django view (https://bitbucket.org/
>> stephenmcd/mezzanine/src/9b7a34c72bb3ec8ba6fa11d576b5d7
>> 86c6d5b1f3/mezzanine/accounts/views.py?at=default#cl-100) that renders a
>> template.  You can override that template to customize the look of profile
>> pages.  You could also override the view to customize the functionality and
>> render any template you want.  Is this what you had in mind?
>>
>>
>> On Wed, Feb 5, 2014 at 9:08 AM, oneloop <[email protected]> wrote:
>>
>>> I want to add a completely custom profile page. How do I do this?
>>>
>>> The off-the-shelf option that Mezzanine gives us is to, as far as I can
>>> tell, create a Link page to /users/. That gives you the default profile.
>>>
>>> I know very little about Mezzanine, so at the moment the best I could do
>>> would be to
>>>
>>> a) in models.py create a ProfilePage subclass off Page with no Fields.
>>>
>>> b) take the accounts_profile.html template, copy it to
>>> myapp/templates/page/accounts_profile.html, and make the necessary
>>> modifications
>>>
>>> c) create the necessary page_processor to add context.
>>>
>>> This solution looks extremely ugly to me, especially step a). Alright,
>>> at least I will have to write a page_processor to add the context (step b),
>>> and I will also have to write the template itself (step c), but seing as
>>> how apparently Mezzanine already knows how to draw pages for Profiles
>>> without the necessity for a ProfilePage, is it possible to avoid step a)?
>>>
>>> EDIT:
>>>
>>> Maybe I can simply define a django-type view and urls and add it to the
>>> Content as a Link page. Is that acceptable?
>>>
>>> --
>>> 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/groups/opt_out.
>>>
>>
>>  --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.

Reply via email to