def catda_post_create(request): title = 'Create' form = PostForm(request.POST or None, request.FILES or None) author = get_author(request.user) if request.method == "POST": if form.is_valid(): form.instance.author = author form.save() return redirect(reverse("backend-posts")) context = {'title': title, 'form': form} return render(request, "backend/admin/posts/create.html", context)
def create_splayer(request): title = 'Create Player' form = CatdaSoccerPlayersForm(request.POST or None, request.FILES or None) author = get_author(request.user) if request.method == "POST": if form.is_valid(): form.instance.author = author form.save() return redirect(reverse("backend-players")) context = {'title': title, 'form': form} return render(request, "backend/admin/players/create.html", context)