Scraping weather conditions for mountain peeks I have built a website in Django in which I tried for the first time to create a complex app. It's an app that scrapes weather conditions on a peak in mountains, which are 17. I wanted to show a detailed forecast in separate templates, so I have 17 views which look almost the same.
Only 4 views:
class KasprowyWierchForecastView(TemplateView):
    &quot;&quot;&quot;
    class for rendering view of detailed weather forecast for
    Kasprowy Wierch peak
    &quot;&quot;&quot;
    template_name = 'mountain_base.html'

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['Peak'] = PeakForecast.objects.filter(
            name_of_peak='Kasprowy').order_by('date')
        print(context['Peak'])
        return context


class KoscielecForecastView(TemplateView):
    &quot;&quot;&quot;
    class for rendering view of detailed weather forecast for
        Koscielec peak
    &quot;&quot;&quot;
    template_name = 'mountain_base.html'

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['Peak'] = PeakForecast.objects.filter(
            name_of_peak='Koscielec').order_by('date')
        return context


class KrivanForecastView(TemplateView):
    &quot;&quot;&quot;
    class for rendering view of detailed weather forecast for Krivan peak
    &quot;&quot;&quot;
    template_name = 'mountain_base.html'

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['Peak'] = PeakForecast.objects.filter(
            name_of_peak='Krivan').order_by('date')
        return context


class MieguszowieckiForecastView(TemplateView):
    &quot;&quot;&quot;
    class for rendering view of detailed weather forecast for
    Mieguszowiecki peak
    &quot;&quot;&quot;
    template_name = 'mountain_base.html'

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['Peak'] = PeakForecast.objects.filter(
            name_of_peak='Mieguszowiecki').order_by('date')
        return context


class MnichForecastView(TemplateView):
    &quot;&quot;&quot;
    class for rendering view of detailed weather forecast for
    Mnich peak
    &quot;&quot;&quot;
    template_name = 'mountain_base.html'

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['Peak'] = PeakForecast.objects.filter(
            name_of_peak='Mnich').order_by('date')
        return context

Only the name of the view class and context['Peak'] are different. The rest of the code is redundant. As my experience is based only on my self learning process I've not found any nice solution on how to fix or refactor.
One option is to modify your TemplateView class to include the peak's name  as an instance attribute (say peak_name) and make the get_context_data method make use of it:
class  TemplateView():
    # Class attributes

    def __init__(self, peak_name):
        # Instance attributes
        # ...
        self.peak_name = peak_name

    # Class methods

    # Modification of the get_context_data method
    def get_context_data(self, **kwargs):
        context['Peak'] = PeakForecast.objects.filter(
            name_of_peak=self.peak_name).order_by('date')  #&lt;- Modification here
        print(context['Peak'])
        return context

And then you can generate your peak views as instances of that class:
krivan_view = TemplateView('Krivan')
krivan_view.get_context_data(arg1='arg1', arg2='arg2')