# My ModelForm is not rendering on broswer. Only save button is visible

**URL:** <https://forum.djangoproject.com/t/my-modelform-is-not-rendering-on-broswer-only-save-button-is-visible/41295>\
**Category:** Mystery Errors\
**Created:** [June 5, 2025, 6:51pm UTC](https://forum.djangoproject.com/t/my-modelform-is-not-rendering-on-broswer-only-save-button-is-visible/41295 "2025-06-05T18:51:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![shanAweb](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shanaweb/32/28797_2.png) [@shanAweb](https://forum.djangoproject.com/u/shanAweb)\
**Post date:** [June 5, 2025, 6:51pm UTC](https://forum.djangoproject.com/t/my-modelform-is-not-rendering-on-broswer-only-save-button-is-visible/41295/1 "2025-06-05T18:51:26Z")

</div>

Hi Everyone!  
I am new to learning Django. I created a modelform and rendering it on browser to send data from front-end to back end but all I am seeing is just save button on browser not form’s input fields. Here is my code:

```auto
from django.db import models

class Reservation(models.Model):
    first_name = models.CharField(max_length=255)
    last_name = models.CharField(max_length=255)
    days = models.IntegerField()
    room_no = models.CharField(max_length=3)
    comments = models.CharField(max_length=500)

```

```auto
from django import forms
from .models import Reservation

class ReservationForm(forms.ModelForm):
    class Meta:
        fields = " __all__"

```

```auto
from django.shortcuts import render
from django.views import View
from django.http import HttpResponse
from .forms import Reservation
# Create your views here.

def Reservationview(request):
    form = Reservation(request)
    if request.method == "POST":
        form = Reservation(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponse("Submission is successful")
    return render(request, 'index.html', {'form': form})

```

```auto
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Hotel Reservation</title>
  </head>
  <body>
    <form mathod="POST">
      {% csrf_token %} {{form.as_p}}
      <button type="submit">Save</button>
    </form>
  </body>
</html>

```

First chunk of code: models  
Second chunk of code: forms  
Third chunk of code: views  
fourth chunk of code: index.html

Anyone please who could help me in this. I shall be very thankful to you.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [June 5, 2025, 6:53pm UTC](https://forum.djangoproject.com/t/my-modelform-is-not-rendering-on-broswer-only-save-button-is-visible/41295/2 "2025-06-05T18:53:02Z")

</div>

Welcome @shanAweb !

Side Note: When posting code here, enclose the code between lines of three  
backtick - ` characters. This means you’ll have a line of ```, then your code,  
then another line of ```. This forces the forum software to keep your code  
properly formatted. (I have taken the liberty of correcting your original post.  
Please remember to do this in the future.)

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [June 5, 2025, 7:02pm UTC](https://forum.djangoproject.com/t/my-modelform-is-not-rendering-on-broswer-only-save-button-is-visible/41295/3 "2025-06-05T19:02:09Z")

</div>

There are three things I see right away.

First:  
You’re not identifying the model associated with your `ReservationForm`. You should have a `model` attribute defined in your `Meta` class within the form class definition. See the example at [Creating forms from models | Django documentation | Django](https://docs.djangoproject.com/en/5.2/topics/forms/modelforms/#django.forms.ModelForm)

Second:

> [@shanAweb](#):
>
> ```auto
> form = Reservation(request)
> ^^^^^^^ - This is not correct.
> 
> ```

You don’t pass the request in to the form class. See the example at [Working with forms | Django documentation | Django](https://docs.djangoproject.com/en/5.2/topics/forms/#id4)

Third:

> [@shanAweb](#):
>
> ```auto
> <form mathod="POST">
> ^^^^^^ - Typo
> 
> ```

This should be “method”, not “mathod”

---

<div class="post-metadata">

**Author:** ![shanAweb](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shanaweb/32/28797_2.png) [@shanAweb](https://forum.djangoproject.com/u/shanAweb)\
**Post date:** [June 6, 2025, 4:55am UTC](https://forum.djangoproject.com/t/my-modelform-is-not-rendering-on-broswer-only-save-button-is-visible/41295/4 "2025-06-06T04:55:08Z")

</div>

Thanks, sir, it’s my first post here on the forum, so I had no idea. Thank you for these guidelines and for editing the post.

---

<div class="post-metadata">

**Author:** ![shanAweb](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shanaweb/32/28797_2.png) [@shanAweb](https://forum.djangoproject.com/u/shanAweb)\
**Post date:** [June 6, 2025, 4:56am UTC](https://forum.djangoproject.com/t/my-modelform-is-not-rendering-on-broswer-only-save-button-is-visible/41295/5 "2025-06-06T04:56:28Z")

</div>

I will correct all these mistakes and come back to mark the solution (given by you) for the problem. Thank you

---

<div class="post-metadata">

**Author:** ![shanAweb](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shanaweb/32/28797_2.png) [@shanAweb](https://forum.djangoproject.com/u/shanAweb)\
**Post date:** [June 8, 2025, 12:32pm UTC](https://forum.djangoproject.com/t/my-modelform-is-not-rendering-on-broswer-only-save-button-is-visible/41295/6 "2025-06-08T12:32:35Z")

</div>

```auto
from django.urls import path
from . import views
urlpatterns = [
    path("reserve", views.Reservationview)
]

```

```auto
from django.shortcuts import render
from django.views import View
from django.http import HttpResponse
from .forms import Reservation
# Create your views here.

def Reservationview(request):
    form = Reservation()
    if request.method == "POST":
        form = Reservation(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponse("Submission is successful")
    return render(request, 'index.html', {'form': form})

```

```auto
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Hotel Reservation</title>
  </head>
  <body>
    <form method="POST">
      {% csrf_token %} {{form.as_p}}
      <button type="submit">Save</button>
    </form>
  </body>
</html>

```

```auto
from django import forms
from .models import Reservation

class ReservationForm(forms.ModelForm):
    class Meta:
        model = Reservation
        fields = " __all__"

```

```auto
from django.db import models

class Reservation(models.Model):
    first_name = models.CharField(max_length=255)
    last_name = models.CharField(max_length=255)
    days = models.IntegerField()
    room_no = models.CharField(max_length=3)
    comments = models.CharField(max_length=500)
    

```

I have corrected the above mistakes, still the issue is same

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [June 8, 2025, 1:03pm UTC](https://forum.djangoproject.com/t/my-modelform-is-not-rendering-on-broswer-only-save-button-is-visible/41295/7 "2025-06-08T13:03:49Z")

</div>

The name of the form that you are importing in your view:

> [@shanAweb](#):
>
> `from .forms import Reservation`

is not the same as the name of the form class that you are showing here:

> [@shanAweb](#):
>
> `class ReservationForm(forms.ModelForm):`

---

<div class="post-metadata">

**Author:** ![shanAweb](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shanaweb/32/28797_2.png) [@shanAweb](https://forum.djangoproject.com/u/shanAweb)\
**Post date:** [June 8, 2025, 1:28pm UTC](https://forum.djangoproject.com/t/my-modelform-is-not-rendering-on-broswer-only-save-button-is-visible/41295/8 "2025-06-08T13:28:56Z")

</div>

Thanks, sir. It’s solved with your guidance!
