Skip to content

How to get field input types working? #60

@samjarman

Description

@samjarman

Hi

How do I get field types to work? So far I cant get the html5 date type to work.

Here is my code:

-- listingform.py ---
from django.db import models
from django.forms import ModelForm
from listings.models import Listing

class ListingForm(ModelForm):
class Meta:
model = Listing
fields = ['title', 'description', 'reward', 'contact', 'duration','conditions', 'expires', 'published']

  • (this is all of it)
  • expires is a DateField

---Models.py---
eg expires = models.DateField('date expires')
...others...
but the renderer doesn't seem to be picking up on that?

-- views.py --
def researchers(request):
form = ListingForm()
return render(request, 'listings/list.html', {'form': form })

Please help? Do I need to do more in the html file? currently just `{{ form|bootrap}}
Do I need to do more in the form class?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions