# function' object has no attribute '\_meta' django

**URL:** <https://forum.djangoproject.com/t/function-object-has-no-attribute-meta-django/31801>\
**Category:** Mystery Errors\
**Created:** [June 6, 2024, 3:52pm UTC](https://forum.djangoproject.com/t/function-object-has-no-attribute-meta-django/31801 "2024-06-06T15:52:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WertyXxxeR](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/wertyxxxer/32/21764_2.png) [@WertyXxxeR](https://forum.djangoproject.com/u/WertyXxxeR)\
**Post date:** [June 6, 2024, 3:52pm UTC](https://forum.djangoproject.com/t/function-object-has-no-attribute-meta-django/31801/1 "2024-06-06T15:52:42Z")

</div>

```auto
from django.contrib.auth import login
from django.shortcuts import render, redirect

from .forms import SignUpForm

def frontpage(request):
    return render(request, 'core/frontpage.html')

def signup(request):
    if request.method == 'POST':
        form = SignUpForm(request.POST)

        if form.is_valid():
            user = form.save

            login(request, user)

            return redirect('frontpage')
    else:
        form = SignUpForm()

    return render(request, 'core/signup.html', {'form': form})

```

Here is my code, when i signup and hit the submit button, it tells me, that

> function’ object has no attribute ‘\_meta’ django

the error should be on

> login(request, user)

. Thanks for help !

Here is html:

```auto
{% extends 'core/base.html' %}

{% block title %}Signup | {% endblock %}

{% block content %}
<div class="p-10 lg:p-20 text-center">
    <h1 class="text-3xl lg:text-6xl text-white">Djangochat</h1>
</div>

<form method="post" action="." class="lg:w-1/4 px-4 mx-auto">
    {% csrf_token %}

    <div class="mb-5">
        <label class="text-white">Username</label>
        <input type="text" name="username" class="w-full mt-2 px-4 py-2 rounded-xl">
    </div>
    <div class="mb-5">
        <label class="text-white">Password</label>
        <input type="password" name="password1" class="w-full mt-2 px-4 py-2 rounded-xl">
    </div>
    <div class="mb-5">
        <label class="text-white">Repeat password</label>
        <input type="password" name="password2" class="w-full mt-2 px-4 py-2 rounded-xl">
    </div>

    {% if form.errors %}
        {% for field in form %}
            {% for error in field.errors %}
                <div class="mb-5 p-4 rounded-xl bg-red-300 text-white">
                    <p>{{ error|escape }}</p>
                </div>
            {% endfor %}
        {% endfor %}
    {% endif %}

    <button class="px-5 py-3 rounded-xl text-white bg-teal-800 hover:bg-teal-700">Submit</button>
</form>
{% endblock %}

```

---

<div class="post-metadata">

**Author:** ![antoinehumbert](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/antoinehumbert/32/14851_2.png) [@antoinehumbert](https://forum.djangoproject.com/u/antoinehumbert)\
**Post date:** [June 6, 2024, 8:30pm UTC](https://forum.djangoproject.com/t/function-object-has-no-attribute-meta-django/31801/2 "2024-06-06T20:30:21Z")

</div>

Usign `user = form.save` you actually affect the `save` method to the `user` variable. Hence, you call `login` with `user` being a function (the form method) where it expects a User obejct.

You must change to `user = form.save()` to effectively call the method and retrieve its result (which is a User object)
