from django import forms
from django.contrib.admin import widgets
from datetimewidget.widgets import DateTimeWidget
from .models import Event


class LoginForm(forms.Form):
    username = forms.CharField(label='Nazwa użytkownika')
    password = forms.CharField(label='Hasło', widget=forms.PasswordInput())


data_time_options = {
    'format': 'dd-mm-yyyy HH:ii'
}

def dt_widget():
    return DateTimeWidget(
        bootstrap_version=3,
        usel10n=True,
        options=data_time_options
    )


class EventForm(forms.ModelForm):

    class Meta:
        model = Event
        fields = (
            'title', 'description',
            'categories', 'start_time',
            'end_time', 'image', 'place',
        )
        widgets = {
            'start_time': dt_widget(),
            'end_time': dt_widget(),
        }

from django import forms
from django.contrib.admin import widgets
from datetimewidget.widgets import DateTimeWidget
from .models import Event


class LoginForm(forms.Form):
    username = forms.CharField(label='Nazwa użytkownika')
    password = forms.CharField(label='Hasło', widget=forms.PasswordInput())


data_time_options = {
    'format': 'dd-mm-yyyy HH:ii'
}

def dt_widget():
    return DateTimeWidget(
        bootstrap_version=3,
        usel10n=True,
        options=data_time_options
    )


class EventForm(forms.ModelForm):

    class Meta:
        model = Event
        fields = (
            'title', 'place',
            'description', 'categories',
            'start_time', 'end_time',
            'image', 'url',
        )
        widgets = {
            'start_time': dt_widget(),
            'end_time': dt_widget(),
        }

Change fields order and add field url.
Change fields order and add field url.

Signed-off-by: Mariusz Fik <e22610367d206dca7aa58af34ebf008b556228c5@fidano.pl>

  from django import forms
  from django.contrib.admin import widgets
  from datetimewidget.widgets import DateTimeWidget
  from .models import Event
  
  
  class LoginForm(forms.Form):
      username = forms.CharField(label='Nazwa użytkownika')
      password = forms.CharField(label='Hasło', widget=forms.PasswordInput())
  
  
  data_time_options = {
      'format': 'dd-mm-yyyy HH:ii'
  }
  
  def dt_widget():
      return DateTimeWidget(
          bootstrap_version=3,
          usel10n=True,
          options=data_time_options
      )
  
  
  class EventForm(forms.ModelForm):
  
      class Meta:
          model = Event
          fields = (
-             'title', 'description',
+             'title', 'place',
-             'categories', 'start_time',
-             'end_time', 'image', 'place',
+             'description', 'categories',
+             'start_time', 'end_time',
+             'image', 'url',
          )
          widgets = {
              'start_time': dt_widget(),
              'end_time': dt_widget(),
          }
  
Change fields order and add field url.
## Code Before:
from django import forms
from django.contrib.admin import widgets
from datetimewidget.widgets import DateTimeWidget
from .models import Event


class LoginForm(forms.Form):
    username = forms.CharField(label='Nazwa użytkownika')
    password = forms.CharField(label='Hasło', widget=forms.PasswordInput())


data_time_options = {
    'format': 'dd-mm-yyyy HH:ii'
}

def dt_widget():
    return DateTimeWidget(
        bootstrap_version=3,
        usel10n=True,
        options=data_time_options
    )


class EventForm(forms.ModelForm):

    class Meta:
        model = Event
        fields = (
            'title', 'description',
            'categories', 'start_time',
            'end_time', 'image', 'place',
        )
        widgets = {
            'start_time': dt_widget(),
            'end_time': dt_widget(),
        }

## Instruction:
Change fields order and add field url.
## Code After:
from django import forms
from django.contrib.admin import widgets
from datetimewidget.widgets import DateTimeWidget
from .models import Event


class LoginForm(forms.Form):
    username = forms.CharField(label='Nazwa użytkownika')
    password = forms.CharField(label='Hasło', widget=forms.PasswordInput())


data_time_options = {
    'format': 'dd-mm-yyyy HH:ii'
}

def dt_widget():
    return DateTimeWidget(
        bootstrap_version=3,
        usel10n=True,
        options=data_time_options
    )


class EventForm(forms.ModelForm):

    class Meta:
        model = Event
        fields = (
            'title', 'place',
            'description', 'categories',
            'start_time', 'end_time',
            'image', 'url',
        )
        widgets = {
            'start_time': dt_widget(),
            'end_time': dt_widget(),
        }
