[mezzanine-users] LOGIN_URL troubles

2016-11-07 Thread Chris Hawes

I'm having a strange problem with LOGIN_URL.

I have SITE_PREFIX set to 'content'. So, I can login by going to 
/content/accounts/login. This works as expected.

However: I also have COMMENTS_ACCOUNT_REQUIRED = True. The problem is that 
when I try to post a comment from a non-logged in browser, it redirects me 
to '/accounts/login', which results in a 404. Poking through 
generic/views.py, it seems that it's redirecting to LOGIN_URL, which is 
still '/accounts/login'.

So, I think to myself, I must need to set LOGIN_URL in my settings.py. So I 
add this to my settings:

LOGIN_URL = '/content/accounts/login'

But after doing that, when I try to load /content/accounts/login, I get a 
404 from the mezzanine.pages.views.page. It seems to me it should not be 
getting into the page view; it should be in the 
mezzanine.accounts.views.login view.

I thought maybe another URL was interfering or something, so I reduced my 
urlconf to just this, still getting 404:

urlpatterns = [
url(r'^%s/' % SITE_PREFIX, include("mezzanine.urls")),
]

Anyone have any ideas what is wrong here?

-- 
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] Cartridge: How to override the name of the product and variations in the cart / checkout?

2016-11-07 Thread Ryne Everett
Thanks, I'll probably use that some time. However, I'd likely use the
class_prepared signal
(https://docs.djangoproject.com/en/stable/ref/signals/#class-prepared)
so I'm not reliant on my app being after `cartridge.shop` in
`INSTALLED_APPS`.

-- 
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] Cartridge: How to override the name of the product and variations in the cart / checkout?

2016-11-07 Thread Pete Dermott
Thanks Ryne.

I agree that a cartridge setting for it would be overkill, maybe some 
changes to cartridge to present it a different way would be nice but as 
variation options are so subjective I totally see why it works the way that 
it currently does.

In the end I just monkey patched it to remove the variation from the 
product name. The code to do so was pretty simple, in my_shop/models.py: 

# Monkey patching! This will override the name of the product in the cart to
# produce a version without the variant name, instead this will be shown 
via the SKU field.
def product_variation_str(self):
"""
 Display the option names and values for the variation.
 """
result = u"%s" % (str(self.product))
return result.strip()

ProductVariation.__str__ = product_variation_str

Not ideal but it works well enough.

On Friday, November 4, 2016 at 7:31:25 PM UTC, Ryne Everett wrote:
>
> I agree that the current default behavior isn't great for everybody. I'm 
> not thrilled by it myself but have lived with it so far. 
>
> One approach would be to improve the default behavior in cartridge, 
> though I don't have a proposal for a more generally acceptable format at 
> hand. 
>
> Another approach would be to add a cartridge setting for a function that 
> formats this string, but I'm not sure that can be justified. 
>
> Perhaps monkey-patching the ProductVariation.__str__ method would be the 
> best approach. I don't think I've monkey-patched model methods before 
> but you might come up with a sensible way to do it with experimentation 
> and/or searching the web. 
>
> Please give a report if you come up with anything. 
>
> On 11/02/2016 05:20 AM, Pete Dermott wrote: 
> > Hi Everyone, 
> > 
> > I'm looking to create a Cartridge store that offers the ability for 
> > customers to buy low cost samples of our products, my thought was to 
> > use the variations system to do so. 
> > 
> > However, when I get to the checkout the system puts the items in the 
> > cart as $ProductName $ProductOptionType: $ProductOptionName so for 
> > example, with my product option type of "Shippable" this turns into 
> > "Product Name Shipable: Sample" which isn't really ideal. 
> > 
> > What I would like to do instead is remove the modification of the 
> > product description and show the original description and a separate 
> > field for the products SKU instead. 
> > 
> > I believe the modification to the name is taking place 
> > incartridge.models.ProductVariation file's __str__ method 
> > <
> https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/models.py#L229>
>  
>
> > but I've got no idea how I can modify this without causing issues with 
> > other parts of the site. 
> > 
> > What is my best option here? 
> > -- 
> > 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-use...@googlegroups.com  
> > . 
> > 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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.