Explaining Override Classes

Home » Topics » Technical » Technical questions » Explaining Override Classes
Explaining Override Classes2018-03-24T15:55:27+00:00
  • Author
    Posts
  • Soulilyasoulilya
    Participant
    Post count: 2

    Hallo, i am stuck on overriding classes. Explain please how it work. Now i try overload address and billing form.
    First, i create new app checkout_addresses,
    then in apps.py i config my app

    provides = {
        “front_urls”: [__name__ +’.urls:urlpatterns’],
    }

    next i add view and url pattern

    urlpatterns = (
    url(
    r’^override/$’,
    views.OverrideView.as_view(),
    name=’override’
    ),
    )

    class OverrideView(View):

    def get(self, request):
    
        return HttpResponse(“Hay”)

    http://domain/override returns 404

    Provide please explanation how overriding works. I found on this forum, that overriding works exact way how in django, but what providers mean and how thay work?

    Next, explain please, how can i solve my problem by example from first question.

  • Soulilyasoulilya
    Participant
    Post count: 2

    Ok, i handle with form override, i try replace original url pattern checkout/address with /address
    but when i submit it (before methods) it rise error redirect url not set.

    May be i need init checkout object before that?

    • This reply was modified 8 months, 3 weeks ago by Soulilya soulilya.
  • Tulimakitulimaki
    Keymaster
    Post count: 113

    Hi,

    Overriding the whole /checkout with your own view can be achieved by just overriding /checkout from your projects url after Shuup front urls. This would be the Django way. No need to use Shuup front provides URLs for that.

    If you just need to modify the addresses then you can also define your own address form. Just use this setting https://github.com/shuup/shuup/blob/master/shuup/core/settings.py#L178 in your project.

    Third option would be to override the current checkout view at the front-app. This you can achieve with this setting https://github.com/shuup/shuup/blob/master/shuup/front/settings.py#L52.

    • This reply was modified 8 months, 3 weeks ago by Tulimaki tulimaki.
Reply To: Explaining Override Classes
Your information: