We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
http:// must be added manually
If in founder URL of an changelog entry, the URL is 'www.something.com', the link is wrong. The user must add 'https://' to make it work properly. I think projecta should handle this ? It might be the same issue in developer URL.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `django_project/changes/forms.py`
Content:
```
1 # coding=utf-8
2 from django import forms
3 from django.core.validators import ValidationError
4 from crispy_forms.helper import FormHelper
5 from crispy_forms.layout import (
6     Layout,
7     Fieldset,
8     Submit,
9     Field,
10 )
11 from models import (
12     Category,
13     Version,
14     Entry,
15     Sponsor,
16     SponsorshipPeriod,
17     SponsorshipLevel
18 )
19 
20 
21 class CategoryForm(forms.ModelForm):
22 
23     # noinspection PyClassicStyleClass
24     class Meta:
25         model = Category
26         fields = ('name', 'sort_number')
27 
28     def __init__(self, *args, **kwargs):
29         self.helper = FormHelper()
30         self.project = kwargs.pop('project')
31         form_title = 'New Category in %s' % self.project.name
32         layout = Layout(
33             Fieldset(
34                 form_title,
35                 Field('name', css_class='form-control'),
36                 Field('sort_number', css_class='form-control'),
37                 css_id='project-form')
38         )
39         self.helper.layout = layout
40         self.helper.html5_required = False
41         super(CategoryForm, self).__init__(*args, **kwargs)
42         self.helper.add_input(Submit('submit', 'Submit'))
43 
44     def save(self, commit=True):
45         instance = super(CategoryForm, self).save(commit=False)
46         instance.project = self.project
47         instance.save()
48         return instance
49 
50     def clean(self):
51         cleaned_data = self.cleaned_data
52 
53         try:
54             Category.objects.get(
55                 name=cleaned_data['name'], project=self.project)
56         except Category.DoesNotExist:
57             pass
58         else:
59             raise ValidationError(
60                 'Category with this name already exists for this project'
61             )
62 
63         return cleaned_data
64 
65 
66 class VersionForm(forms.ModelForm):
67 
68     # noinspection PyClassicStyleClass
69     class Meta:
70         model = Version
71         fields = (
72             'name',
73             'description',
74             'image_file',
75             'release_date'
76         )
77 
78     def __init__(self, *args, **kwargs):
79         self.user = kwargs.pop('user')
80         self.project = kwargs.pop('project')
81         form_title = 'New Version for %s' % self.project.name
82         self.helper = FormHelper()
83         layout = Layout(
84             Fieldset(
85                 form_title,
86                 Field('name', css_class='form-control'),
87                 Field('description', css_class='form-control'),
88                 Field('image_file', css_class='form-control'),
89 
90                 css_id='project-form')
91         )
92         self.helper.layout = layout
93         self.helper.html5_required = False
94         super(VersionForm, self).__init__(*args, **kwargs)
95         self.helper.add_input(Submit('submit', 'Submit'))
96 
97     def save(self, commit=True):
98         instance = super(VersionForm, self).save(commit=False)
99         instance.author = self.user
100         instance.project = self.project
101         instance.approved = False
102         instance.save()
103         return instance
104 
105 
106 class EntryForm(forms.ModelForm):
107 
108     # noinspection PyClassicStyleClass
109     class Meta:
110         model = Entry
111         fields = (
112             'category', 'title', 'description',
113             'image_file', 'image_credits', 'video',
114             'funded_by', 'funder_url', 'developed_by',
115             'developer_url'
116         )
117 
118     def __init__(self, *args, **kwargs):
119         self.user = kwargs.pop('user')
120         self.version = kwargs.pop('version')
121         self.project = kwargs.pop('project')
122         form_title = 'New Entry in %s %s' % (
123             self.project.name,
124             self.version.name
125         )
126         self.helper = FormHelper()
127         layout = Layout(
128             Fieldset(
129                 form_title,
130                 Field('category', css_class='form-control'),
131                 Field('title', css_class='form-control'),
132                 Field('description', css_class='form-control'),
133                 Field('image_file', css_class='form-control'),
134                 Field('image_credits', css_class='form-control'),
135                 Field('video', css_class='form-control'),
136                 Field('funded_by', css_class='form-control'),
137                 Field('funder_url', css_class='form-control'),
138                 Field('developed_by', css_class='form-control'),
139                 Field('developer_url', css_class='form-control'),
140                 css_id='entry-form')
141         )
142         self.helper.layout = layout
143         self.helper.html5_required = False
144         super(EntryForm, self).__init__(*args, **kwargs)
145         self.helper.add_input(Submit('submit', 'Submit'))
146         self.fields['title'].label = 'Feature Title'
147         # Filter the category list when editing so it shows only relevant ones
148         self.fields['category'].queryset = Category.objects.filter(
149             project=self.project).order_by('name')
150 
151     def save(self, commit=True):
152         instance = super(EntryForm, self).save(commit=False)
153         instance.author = self.user
154         instance.version = self.version
155         instance.approved = False
156         instance.save()
157         return instance
158 
159 
160 class SponsorForm(forms.ModelForm):
161 
162     # noinspection PyClassicStyleClass
163     class Meta:
164         model = Sponsor
165         fields = (
166             'name',
167             'contact_title',
168             'address',
169             'country',
170             'sponsor_url',
171             'contact_person',
172             'sponsor_email',
173             'agreement',
174             'logo',
175             'invoice_number',
176             'project',
177         )
178 
179     def __init__(self, *args, **kwargs):
180         self.user = kwargs.pop('user')
181         self.project = kwargs.pop('project')
182         form_title = 'New Sponsor for %s' % self.project.name
183         self.helper = FormHelper()
184         layout = Layout(
185             Fieldset(
186                 form_title,
187                 Field('name', css_class='form-control'),
188                 Field('contact_title', css_class='form-control'),
189                 Field('address', css_class='form-control'),
190                 Field('country', css_class='form-control chosen-select'),
191                 Field('sponsor_url', css_class='form-control'),
192                 Field('contact_person', css_class='form-control'),
193                 Field('sponsor_email', css_class='form-control'),
194                 Field('agreement', css_class='form-control'),
195                 Field('logo', css_class='form-control'),
196                 Field('invoice_number', css_class='form-control'),
197                 css_id='project-form')
198         )
199         self.helper.layout = layout
200         self.helper.html5_required = False
201         super(SponsorForm, self).__init__(*args, **kwargs)
202         self.fields['project'].initial = self.project
203         self.fields['project'].widget = forms.HiddenInput()
204         self.helper.add_input(Submit('submit', 'Submit'))
205 
206     def save(self, commit=True):
207         instance = super(SponsorForm, self).save(commit=False)
208         instance.author = self.user
209         instance.approved = False
210         instance.save()
211         return instance
212 
213 
214 class SponsorshipLevelForm(forms.ModelForm):
215 
216     # noinspection PyClassicStyleClass
217     class Meta:
218         model = SponsorshipLevel
219         fields = (
220             'name',
221             'value',
222             'currency',
223             'logo'
224         )
225 
226     def __init__(self, *args, **kwargs):
227         self.user = kwargs.pop('user')
228         self.project = kwargs.pop('project')
229         form_title = 'Sponsorship Level Form for %s' % self.project.name
230         self.helper = FormHelper()
231         layout = Layout(
232             Fieldset(
233                 form_title,
234                 Field('name', css_class='form-control'),
235                 Field('value', css_class='form-control'),
236                 Field('currency', css_class='form-control'),
237                 Field('logo', css_class='form-control'),
238                 css_id='project-form')
239         )
240         self.helper.layout = layout
241         self.helper.html5_required = False
242         super(SponsorshipLevelForm, self).__init__(*args, **kwargs)
243         self.helper.add_input(Submit('submit', 'Submit'))
244 
245     def save(self, commit=True):
246         instance = super(SponsorshipLevelForm, self).save(commit=False)
247         instance.author = self.user
248         instance.project = self.project
249         instance.save()
250         return instance
251 
252 
253 class SponsorshipPeriodForm(forms.ModelForm):
254 
255     # noinspection PyClassicStyleClass
256     class Meta:
257         model = SponsorshipPeriod
258         fields = (
259             'sponsor',
260             'sponsorship_level',
261             'start_date',
262             'end_date',
263             'amount_sponsored',
264             'currency'
265         )
266 
267     def __init__(self, *args, **kwargs):
268         self.user = kwargs.pop('user')
269         self.project = kwargs.pop('project')
270         form_title = 'Sponsorship Period Form for %s' % self.project.name
271         self.helper = FormHelper()
272         layout = Layout(
273             Fieldset(
274                 form_title,
275                 Field('sponsor', css_class='form-control chosen-select'),
276                 Field(
277                     'sponsorship_level',
278                     css_class='form-control chosen-select'),
279                 Field('start_date', css_class='form-control'),
280                 Field('end_date', css_class='form-control'),
281                 Field('amount_sponsored', css_class='form-control'),
282                 Field('currency', css_class='form-control'),
283                 css_id='project-form')
284         )
285         self.helper.layout = layout
286         self.helper.html5_required = False
287         super(SponsorshipPeriodForm, self).__init__(*args, **kwargs)
288         # Filter items to only show the approved items in the same project
289         self.fields['sponsor'].queryset = \
290             Sponsor.objects.filter(
291                 project=self.project, approved=True).order_by('name')
292         self.fields['sponsorship_level'].queryset = \
293             SponsorshipLevel.objects.filter(
294                 project=self.project, approved=True).order_by('name')
295         self.helper.add_input(Submit('submit', 'Submit'))
296 
297     def save(self, commit=True):
298         instance = super(SponsorshipPeriodForm, self).save(commit=False)
299         instance.author = self.user
300         instance.project = self.project
301         instance.save()
302         return instance
303
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/django_project/changes/forms.py b/django_project/changes/forms.py
--- a/django_project/changes/forms.py
+++ b/django_project/changes/forms.py
@@ -1,5 +1,6 @@
 # coding=utf-8
 from django import forms
+from django.forms.widgets import TextInput
 from django.core.validators import ValidationError
 from crispy_forms.helper import FormHelper
 from crispy_forms.layout import (
@@ -144,6 +145,10 @@
         super(EntryForm, self).__init__(*args, **kwargs)
         self.helper.add_input(Submit('submit', 'Submit'))
         self.fields['title'].label = 'Feature Title'
+        self.fields['funder_url'] = forms.URLField(
+                initial="http://", widget=TextInput)
+        self.fields['developer_url'] = forms.URLField(
+                initial="http://", widget=TextInput)
         # Filter the category list when editing so it shows only relevant ones
         self.fields['category'].queryset = Category.objects.filter(
             project=self.project).order_by('name')

{"golden_diff": "diff --git a/django_project/changes/forms.py b/django_project/changes/forms.py\n--- a/django_project/changes/forms.py\n+++ b/django_project/changes/forms.py\n@@ -1,5 +1,6 @@\n # coding=utf-8\n from django import forms\n+from django.forms.widgets import TextInput\n from django.core.validators import ValidationError\n from crispy_forms.helper import FormHelper\n from crispy_forms.layout import (\n@@ -144,6 +145,10 @@\n         super(EntryForm, self).__init__(*args, **kwargs)\n         self.helper.add_input(Submit('submit', 'Submit'))\n         self.fields['title'].label = 'Feature Title'\n+        self.fields['funder_url'] = forms.URLField(\n+                initial=\"http://\", widget=TextInput)\n+        self.fields['developer_url'] = forms.URLField(\n+                initial=\"http://\", widget=TextInput)\n         # Filter the category list when editing so it shows only relevant ones\n         self.fields['category'].queryset = Category.objects.filter(\n             project=self.project).order_by('name')\n", "issue": "http:// must be added manually\nIf in founder URL of an changelog entry, the URL is 'www.something.com', the link is wrong. The user must add 'https://' to make it work properly. I think projecta should handle this ? It might be the same issue in developer URL.\n", "before_files": [{"content": "# coding=utf-8\nfrom django import forms\nfrom django.core.validators import ValidationError\nfrom crispy_forms.helper import FormHelper\nfrom crispy_forms.layout import (\n    Layout,\n    Fieldset,\n    Submit,\n    Field,\n)\nfrom models import (\n    Category,\n    Version,\n    Entry,\n    Sponsor,\n    SponsorshipPeriod,\n    SponsorshipLevel\n)\n\n\nclass CategoryForm(forms.ModelForm):\n\n    # noinspection PyClassicStyleClass\n    class Meta:\n        model = Category\n        fields = ('name', 'sort_number')\n\n    def __init__(self, *args, **kwargs):\n        self.helper = FormHelper()\n        self.project = kwargs.pop('project')\n        form_title = 'New Category in %s' % self.project.name\n        layout = Layout(\n            Fieldset(\n                form_title,\n                Field('name', css_class='form-control'),\n                Field('sort_number', css_class='form-control'),\n                css_id='project-form')\n        )\n        self.helper.layout = layout\n        self.helper.html5_required = False\n        super(CategoryForm, self).__init__(*args, **kwargs)\n        self.helper.add_input(Submit('submit', 'Submit'))\n\n    def save(self, commit=True):\n        instance = super(CategoryForm, self).save(commit=False)\n        instance.project = self.project\n        instance.save()\n        return instance\n\n    def clean(self):\n        cleaned_data = self.cleaned_data\n\n        try:\n            Category.objects.get(\n                name=cleaned_data['name'], project=self.project)\n        except Category.DoesNotExist:\n            pass\n        else:\n            raise ValidationError(\n                'Category with this name already exists for this project'\n            )\n\n        return cleaned_data\n\n\nclass VersionForm(forms.ModelForm):\n\n    # noinspection PyClassicStyleClass\n    class Meta:\n        model = Version\n        fields = (\n            'name',\n            'description',\n            'image_file',\n            'release_date'\n        )\n\n    def __init__(self, *args, **kwargs):\n        self.user = kwargs.pop('user')\n        self.project = kwargs.pop('project')\n        form_title = 'New Version for %s' % self.project.name\n        self.helper = FormHelper()\n        layout = Layout(\n            Fieldset(\n                form_title,\n                Field('name', css_class='form-control'),\n                Field('description', css_class='form-control'),\n                Field('image_file', css_class='form-control'),\n\n                css_id='project-form')\n        )\n        self.helper.layout = layout\n        self.helper.html5_required = False\n        super(VersionForm, self).__init__(*args, **kwargs)\n        self.helper.add_input(Submit('submit', 'Submit'))\n\n    def save(self, commit=True):\n        instance = super(VersionForm, self).save(commit=False)\n        instance.author = self.user\n        instance.project = self.project\n        instance.approved = False\n        instance.save()\n        return instance\n\n\nclass EntryForm(forms.ModelForm):\n\n    # noinspection PyClassicStyleClass\n    class Meta:\n        model = Entry\n        fields = (\n            'category', 'title', 'description',\n            'image_file', 'image_credits', 'video',\n            'funded_by', 'funder_url', 'developed_by',\n            'developer_url'\n        )\n\n    def __init__(self, *args, **kwargs):\n        self.user = kwargs.pop('user')\n        self.version = kwargs.pop('version')\n        self.project = kwargs.pop('project')\n        form_title = 'New Entry in %s %s' % (\n            self.project.name,\n            self.version.name\n        )\n        self.helper = FormHelper()\n        layout = Layout(\n            Fieldset(\n                form_title,\n                Field('category', css_class='form-control'),\n                Field('title', css_class='form-control'),\n                Field('description', css_class='form-control'),\n                Field('image_file', css_class='form-control'),\n                Field('image_credits', css_class='form-control'),\n                Field('video', css_class='form-control'),\n                Field('funded_by', css_class='form-control'),\n                Field('funder_url', css_class='form-control'),\n                Field('developed_by', css_class='form-control'),\n                Field('developer_url', css_class='form-control'),\n                css_id='entry-form')\n        )\n        self.helper.layout = layout\n        self.helper.html5_required = False\n        super(EntryForm, self).__init__(*args, **kwargs)\n        self.helper.add_input(Submit('submit', 'Submit'))\n        self.fields['title'].label = 'Feature Title'\n        # Filter the category list when editing so it shows only relevant ones\n        self.fields['category'].queryset = Category.objects.filter(\n            project=self.project).order_by('name')\n\n    def save(self, commit=True):\n        instance = super(EntryForm, self).save(commit=False)\n        instance.author = self.user\n        instance.version = self.version\n        instance.approved = False\n        instance.save()\n        return instance\n\n\nclass SponsorForm(forms.ModelForm):\n\n    # noinspection PyClassicStyleClass\n    class Meta:\n        model = Sponsor\n        fields = (\n            'name',\n            'contact_title',\n            'address',\n            'country',\n            'sponsor_url',\n            'contact_person',\n            'sponsor_email',\n            'agreement',\n            'logo',\n            'invoice_number',\n            'project',\n        )\n\n    def __init__(self, *args, **kwargs):\n        self.user = kwargs.pop('user')\n        self.project = kwargs.pop('project')\n        form_title = 'New Sponsor for %s' % self.project.name\n        self.helper = FormHelper()\n        layout = Layout(\n            Fieldset(\n                form_title,\n                Field('name', css_class='form-control'),\n                Field('contact_title', css_class='form-control'),\n                Field('address', css_class='form-control'),\n                Field('country', css_class='form-control chosen-select'),\n                Field('sponsor_url', css_class='form-control'),\n                Field('contact_person', css_class='form-control'),\n                Field('sponsor_email', css_class='form-control'),\n                Field('agreement', css_class='form-control'),\n                Field('logo', css_class='form-control'),\n                Field('invoice_number', css_class='form-control'),\n                css_id='project-form')\n        )\n        self.helper.layout = layout\n        self.helper.html5_required = False\n        super(SponsorForm, self).__init__(*args, **kwargs)\n        self.fields['project'].initial = self.project\n        self.fields['project'].widget = forms.HiddenInput()\n        self.helper.add_input(Submit('submit', 'Submit'))\n\n    def save(self, commit=True):\n        instance = super(SponsorForm, self).save(commit=False)\n        instance.author = self.user\n        instance.approved = False\n        instance.save()\n        return instance\n\n\nclass SponsorshipLevelForm(forms.ModelForm):\n\n    # noinspection PyClassicStyleClass\n    class Meta:\n        model = SponsorshipLevel\n        fields = (\n            'name',\n            'value',\n            'currency',\n            'logo'\n        )\n\n    def __init__(self, *args, **kwargs):\n        self.user = kwargs.pop('user')\n        self.project = kwargs.pop('project')\n        form_title = 'Sponsorship Level Form for %s' % self.project.name\n        self.helper = FormHelper()\n        layout = Layout(\n            Fieldset(\n                form_title,\n                Field('name', css_class='form-control'),\n                Field('value', css_class='form-control'),\n                Field('currency', css_class='form-control'),\n                Field('logo', css_class='form-control'),\n                css_id='project-form')\n        )\n        self.helper.layout = layout\n        self.helper.html5_required = False\n        super(SponsorshipLevelForm, self).__init__(*args, **kwargs)\n        self.helper.add_input(Submit('submit', 'Submit'))\n\n    def save(self, commit=True):\n        instance = super(SponsorshipLevelForm, self).save(commit=False)\n        instance.author = self.user\n        instance.project = self.project\n        instance.save()\n        return instance\n\n\nclass SponsorshipPeriodForm(forms.ModelForm):\n\n    # noinspection PyClassicStyleClass\n    class Meta:\n        model = SponsorshipPeriod\n        fields = (\n            'sponsor',\n            'sponsorship_level',\n            'start_date',\n            'end_date',\n            'amount_sponsored',\n            'currency'\n        )\n\n    def __init__(self, *args, **kwargs):\n        self.user = kwargs.pop('user')\n        self.project = kwargs.pop('project')\n        form_title = 'Sponsorship Period Form for %s' % self.project.name\n        self.helper = FormHelper()\n        layout = Layout(\n            Fieldset(\n                form_title,\n                Field('sponsor', css_class='form-control chosen-select'),\n                Field(\n                    'sponsorship_level',\n                    css_class='form-control chosen-select'),\n                Field('start_date', css_class='form-control'),\n                Field('end_date', css_class='form-control'),\n                Field('amount_sponsored', css_class='form-control'),\n                Field('currency', css_class='form-control'),\n                css_id='project-form')\n        )\n        self.helper.layout = layout\n        self.helper.html5_required = False\n        super(SponsorshipPeriodForm, self).__init__(*args, **kwargs)\n        # Filter items to only show the approved items in the same project\n        self.fields['sponsor'].queryset = \\\n            Sponsor.objects.filter(\n                project=self.project, approved=True).order_by('name')\n        self.fields['sponsorship_level'].queryset = \\\n            SponsorshipLevel.objects.filter(\n                project=self.project, approved=True).order_by('name')\n        self.helper.add_input(Submit('submit', 'Submit'))\n\n    def save(self, commit=True):\n        instance = super(SponsorshipPeriodForm, self).save(commit=False)\n        instance.author = self.user\n        instance.project = self.project\n        instance.save()\n        return instance\n", "path": "django_project/changes/forms.py"}], "after_files": [{"content": "# coding=utf-8\nfrom django import forms\nfrom django.forms.widgets import TextInput\nfrom django.core.validators import ValidationError\nfrom crispy_forms.helper import FormHelper\nfrom crispy_forms.layout import (\n    Layout,\n    Fieldset,\n    Submit,\n    Field,\n)\nfrom models import (\n    Category,\n    Version,\n    Entry,\n    Sponsor,\n    SponsorshipPeriod,\n    SponsorshipLevel\n)\n\n\nclass CategoryForm(forms.ModelForm):\n\n    # noinspection PyClassicStyleClass\n    class Meta:\n        model = Category\n        fields = ('name', 'sort_number')\n\n    def __init__(self, *args, **kwargs):\n        self.helper = FormHelper()\n        self.project = kwargs.pop('project')\n        form_title = 'New Category in %s' % self.project.name\n        layout = Layout(\n            Fieldset(\n                form_title,\n                Field('name', css_class='form-control'),\n                Field('sort_number', css_class='form-control'),\n                css_id='project-form')\n        )\n        self.helper.layout = layout\n        self.helper.html5_required = False\n        super(CategoryForm, self).__init__(*args, **kwargs)\n        self.helper.add_input(Submit('submit', 'Submit'))\n\n    def save(self, commit=True):\n        instance = super(CategoryForm, self).save(commit=False)\n        instance.project = self.project\n        instance.save()\n        return instance\n\n    def clean(self):\n        cleaned_data = self.cleaned_data\n\n        try:\n            Category.objects.get(\n                name=cleaned_data['name'], project=self.project)\n        except Category.DoesNotExist:\n            pass\n        else:\n            raise ValidationError(\n                'Category with this name already exists for this project'\n            )\n\n        return cleaned_data\n\n\nclass VersionForm(forms.ModelForm):\n\n    # noinspection PyClassicStyleClass\n    class Meta:\n        model = Version\n        fields = (\n            'name',\n            'description',\n            'image_file',\n            'release_date'\n        )\n\n    def __init__(self, *args, **kwargs):\n        self.user = kwargs.pop('user')\n        self.project = kwargs.pop('project')\n        form_title = 'New Version for %s' % self.project.name\n        self.helper = FormHelper()\n        layout = Layout(\n            Fieldset(\n                form_title,\n                Field('name', css_class='form-control'),\n                Field('description', css_class='form-control'),\n                Field('image_file', css_class='form-control'),\n\n                css_id='project-form')\n        )\n        self.helper.layout = layout\n        self.helper.html5_required = False\n        super(VersionForm, self).__init__(*args, **kwargs)\n        self.helper.add_input(Submit('submit', 'Submit'))\n\n    def save(self, commit=True):\n        instance = super(VersionForm, self).save(commit=False)\n        instance.author = self.user\n        instance.project = self.project\n        instance.approved = False\n        instance.save()\n        return instance\n\n\nclass EntryForm(forms.ModelForm):\n\n    # noinspection PyClassicStyleClass\n    class Meta:\n        model = Entry\n        fields = (\n            'category', 'title', 'description',\n            'image_file', 'image_credits', 'video',\n            'funded_by', 'funder_url', 'developed_by',\n            'developer_url'\n        )\n\n    def __init__(self, *args, **kwargs):\n        self.user = kwargs.pop('user')\n        self.version = kwargs.pop('version')\n        self.project = kwargs.pop('project')\n        form_title = 'New Entry in %s %s' % (\n            self.project.name,\n            self.version.name\n        )\n        self.helper = FormHelper()\n        layout = Layout(\n            Fieldset(\n                form_title,\n                Field('category', css_class='form-control'),\n                Field('title', css_class='form-control'),\n                Field('description', css_class='form-control'),\n                Field('image_file', css_class='form-control'),\n                Field('image_credits', css_class='form-control'),\n                Field('video', css_class='form-control'),\n                Field('funded_by', css_class='form-control'),\n                Field('funder_url', css_class='form-control'),\n                Field('developed_by', css_class='form-control'),\n                Field('developer_url', css_class='form-control'),\n                css_id='entry-form')\n        )\n        self.helper.layout = layout\n        self.helper.html5_required = False\n        super(EntryForm, self).__init__(*args, **kwargs)\n        self.helper.add_input(Submit('submit', 'Submit'))\n        self.fields['title'].label = 'Feature Title'\n        self.fields['funder_url'] = forms.URLField(\n                initial=\"http://\", widget=TextInput)\n        self.fields['developer_url'] = forms.URLField(\n                initial=\"http://\", widget=TextInput)\n        # Filter the category list when editing so it shows only relevant ones\n        self.fields['category'].queryset = Category.objects.filter(\n            project=self.project).order_by('name')\n\n    def save(self, commit=True):\n        instance = super(EntryForm, self).save(commit=False)\n        instance.author = self.user\n        instance.version = self.version\n        instance.approved = False\n        instance.save()\n        return instance\n\n\nclass SponsorForm(forms.ModelForm):\n\n    # noinspection PyClassicStyleClass\n    class Meta:\n        model = Sponsor\n        fields = (\n            'name',\n            'contact_title',\n            'address',\n            'country',\n            'sponsor_url',\n            'contact_person',\n            'sponsor_email',\n            'agreement',\n            'logo',\n            'invoice_number',\n            'project',\n        )\n\n    def __init__(self, *args, **kwargs):\n        self.user = kwargs.pop('user')\n        self.project = kwargs.pop('project')\n        form_title = 'New Sponsor for %s' % self.project.name\n        self.helper = FormHelper()\n        layout = Layout(\n            Fieldset(\n                form_title,\n                Field('name', css_class='form-control'),\n                Field('contact_title', css_class='form-control'),\n                Field('address', css_class='form-control'),\n                Field('country', css_class='form-control chosen-select'),\n                Field('sponsor_url', css_class='form-control'),\n                Field('contact_person', css_class='form-control'),\n                Field('sponsor_email', css_class='form-control'),\n                Field('agreement', css_class='form-control'),\n                Field('logo', css_class='form-control'),\n                Field('invoice_number', css_class='form-control'),\n                css_id='project-form')\n        )\n        self.helper.layout = layout\n        self.helper.html5_required = False\n        super(SponsorForm, self).__init__(*args, **kwargs)\n        self.fields['project'].initial = self.project\n        self.fields['project'].widget = forms.HiddenInput()\n        self.helper.add_input(Submit('submit', 'Submit'))\n\n    def save(self, commit=True):\n        instance = super(SponsorForm, self).save(commit=False)\n        instance.author = self.user\n        instance.approved = False\n        instance.save()\n        return instance\n\n\nclass SponsorshipLevelForm(forms.ModelForm):\n\n    # noinspection PyClassicStyleClass\n    class Meta:\n        model = SponsorshipLevel\n        fields = (\n            'name',\n            'value',\n            'currency',\n            'logo'\n        )\n\n    def __init__(self, *args, **kwargs):\n        self.user = kwargs.pop('user')\n        self.project = kwargs.pop('project')\n        form_title = 'Sponsorship Level Form for %s' % self.project.name\n        self.helper = FormHelper()\n        layout = Layout(\n            Fieldset(\n                form_title,\n                Field('name', css_class='form-control'),\n                Field('value', css_class='form-control'),\n                Field('currency', css_class='form-control'),\n                Field('logo', css_class='form-control'),\n                css_id='project-form')\n        )\n        self.helper.layout = layout\n        self.helper.html5_required = False\n        super(SponsorshipLevelForm, self).__init__(*args, **kwargs)\n        self.helper.add_input(Submit('submit', 'Submit'))\n\n    def save(self, commit=True):\n        instance = super(SponsorshipLevelForm, self).save(commit=False)\n        instance.author = self.user\n        instance.project = self.project\n        instance.save()\n        return instance\n\n\nclass SponsorshipPeriodForm(forms.ModelForm):\n\n    # noinspection PyClassicStyleClass\n    class Meta:\n        model = SponsorshipPeriod\n        fields = (\n            'sponsor',\n            'sponsorship_level',\n            'start_date',\n            'end_date',\n            'amount_sponsored',\n            'currency'\n        )\n\n    def __init__(self, *args, **kwargs):\n        self.user = kwargs.pop('user')\n        self.project = kwargs.pop('project')\n        form_title = 'Sponsorship Period Form for %s' % self.project.name\n        self.helper = FormHelper()\n        layout = Layout(\n            Fieldset(\n                form_title,\n                Field('sponsor', css_class='form-control chosen-select'),\n                Field(\n                    'sponsorship_level',\n                    css_class='form-control chosen-select'),\n                Field('start_date', css_class='form-control'),\n                Field('end_date', css_class='form-control'),\n                Field('amount_sponsored', css_class='form-control'),\n                Field('currency', css_class='form-control'),\n                css_id='project-form')\n        )\n        self.helper.layout = layout\n        self.helper.html5_required = False\n        super(SponsorshipPeriodForm, self).__init__(*args, **kwargs)\n        # Filter items to only show the approved items in the same project\n        self.fields['sponsor'].queryset = \\\n            Sponsor.objects.filter(\n                project=self.project, approved=True).order_by('name')\n        self.fields['sponsorship_level'].queryset = \\\n            SponsorshipLevel.objects.filter(\n                project=self.project, approved=True).order_by('name')\n        self.helper.add_input(Submit('submit', 'Submit'))\n\n    def save(self, commit=True):\n        instance = super(SponsorshipPeriodForm, self).save(commit=False)\n        instance.author = self.user\n        instance.project = self.project\n        instance.save()\n        return instance\n", "path": "django_project/changes/forms.py"}]}