Exemplo n.º 1
0
     "Find the cards that are played the most or have the highest winrate."


class MyCardStatsView(LoginRequiredMixin, RequestMetaMixin, TemplateView):
    template_name = "cards/my_card_stats.html"
    title = "My Cards"


class CardGalleryView(RequestMetaMixin, TemplateView):
    template_name = "cards/card_gallery.html"
    title = "Hearthstone Card Gallery"
    description = "View all collectible cards in Hearthstone. Filter by cost, rarity, " \
     "set, type, race and mechanics. Examine detailed statistics for any card."


@method_decorator(view_requires_feature_access("cardeditor"), name="dispatch")
class CardEditorView(RequestMetaMixin, TemplateView):
    template_name = "cards/card_editor.html"
    title = "Hearthstone Card Editor"
    stylesheets = (
        "fonts/belwefs_extrabold_macroman/stylesheet.css",
        "fonts/franklingothicfs_mediumcondensed_macroman/stylesheet.css",
    )


class CardDetailView(DetailView):
    model = Card

    def get_object(self, queryset=None):
        if queryset is None:
            queryset = self.get_queryset()
Exemplo n.º 2
0
from django.contrib.auth.mixins import LoginRequiredMixin
from django.utils.decorators import method_decorator
from django.views.generic import TemplateView
from hsreplaynet.features.decorators import view_requires_feature_access
from hsreplaynet.utils.html import RequestMetaMixin


@method_decorator(view_requires_feature_access("profiles"), name="dispatch")
class HighlightsView(LoginRequiredMixin, RequestMetaMixin, TemplateView):
    template_name = "profiles/highlights.html"


@method_decorator(view_requires_feature_access("packs"), name="dispatch")
class PackListView(LoginRequiredMixin, RequestMetaMixin, TemplateView):
    template_name = "profiles/packs.html"

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context["packs"] = self.request.user.pack_set.all()
        return context
Exemplo n.º 3
0
from django.contrib.auth.mixins import LoginRequiredMixin
from django.utils.decorators import method_decorator

from hsreplaynet.features.decorators import view_requires_feature_access

from . import SimpleReactView


@method_decorator(view_requires_feature_access("leaderboards"),
                  name="dispatch")
class LeaderboardsView(LoginRequiredMixin, SimpleReactView):
    bundle = "leaderboards"
Exemplo n.º 4
0
        elif snapshot.as_of > staging[snapshot_date].as_of:
            staging[snapshot_date] = snapshot

    response = {}
    for snapshot_date, snapshot in staging.items():
        response[snapshot_date] = {
            "id": snapshot.id,
            "latest": snapshot.latest,
            "live": snapshot.live_in_production
        }

    return HttpResponse(content=json.dumps(response, indent="\t"),
                        content_type="application/json")


@method_decorator(view_requires_feature_access("archetype-training"),
                  name="dispatch")
class SingleClusterUpdateView(View):
    def _get_cluster(self, snapshot_id, cluster_id):
        cluster = ClusterSnapshot.objects.filter(
            class_cluster__cluster_set__id=snapshot_id,
            cluster_id=int(cluster_id)).first()
        return cluster

    def get(self, request, snapshot_id, cluster_id):
        cluster = self._get_cluster(snapshot_id, cluster_id)
        return JsonResponse({"cluster_id": cluster.cluster_id}, status=200)

    def patch(self, request, snapshot_id, cluster_id):
        cluster = self._get_cluster(snapshot_id, cluster_id)
Exemplo n.º 5
0
        elif "set_default" in request.POST:
            # Set the default payment method
            stripe_customer = customer.api_retrieve()
            stripe_customer.default_source = card.stripe_id
            stripe_customer.save()
            customer.__class__.sync_from_stripe_data(stripe_customer)

        return True

    def post(self, request):
        self.handle_form(request)
        return redirect(self.success_url)


@method_decorator(view_requires_feature_access("billing"), name="dispatch")
class PremiumDetailView(RequestMetaMixin, TemplateView):
    template_name = "premium/premium_detail.html"
    title = "HearthSim Premium"
    description = "More filters, more features, more data: Gain access to advanced " \
     "Hearthstone statistics backed by millions of games with HearthSim Premium " \
     "for HSReplay.net."

    quotes = [
        "It only cost my soul!",
        "Mind if I roll Need?",
        "I hope you like my invention.",
        "Who knows what secrets we'll uncover?",
        "You require my assistance?",
        "Don't worry love, the cavalry's here!",
        "Put your faith in the stats.",