<commit_before># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.views import generic
from django.shortcuts import render
from . import forms
from django.contrib.auth.mixins import LoginRequiredMixin

# Create your views here.

class addPayment(LoginRequiredMixin, generic.TemplateView):
	template_name = "payments/addPaymentMethod.html"
	http_method_names = ['get', 'post']

	def get(self, request, *args, **kwargs):
		if "paymentForm" not in kwargs:
			kwargs["paymentForm"] = forms.paymentForm()
		return super(addPayment, self).get(request, *args, **kwargs)

	def post(self, request, *args, **kwargs):
		paymentForm = forms.paymentForm(request.POST)
		paymentForm.save()
		messages.success(request, "Payments has been saved!")
		return redirect("payments:paymentmethods")


class paymentMethods(LoginRequiredMixin, generic.TemplateView):
	template_name = "payments/listCreditCard.html"
	http_method_names = ['get', 'post']<commit_msg>Payment Save Updates<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.views import generic
from django.shortcuts import render
from . import forms
from django.contrib.auth.mixins import LoginRequiredMixin

# Create your views here.

class addPayment(LoginRequiredMixin, generic.TemplateView):
	template_name = "payments/addPaymentMethod.html"
	http_method_names = ['get', 'post']

	def get(self, request, *args, **kwargs):
		if "paymentForm" not in kwargs:
			kwargs["paymentForm"] = forms.paymentForm()
		return super(addPayment, self).get(request, *args, **kwargs)

	def post(self, request, *args, **kwargs):
		user = self.request.user
		paymentForm = forms.paymentForm(request.POST)
		payment = paymentForm.save(commit=false)
		payment.user = user
		payment.save()
		messages.success(request, "Payments has been saved!")
		return redirect("payments:paymentmethods")


class paymentMethods(LoginRequiredMixin, generic.TemplateView):
	template_name = "payments/listCreditCard.html"
	http_method_names = ['get', 'post']
{'fraction_non_alphanumeric': 0.11962432031636185, 'fraction_numerical': 0.0009886307464162135, 'mean_word_length': 5.979310344827586, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3268421', 'n_tokens_mistral': 629, 'n_tokens_neox': 599, 'n_words': 155}