Files
@ 770f4f6c261d
Branch filter:
Location: website/conservancy/usethesource/forms.py - annotation
770f4f6c261d
1.7 KiB
text/x-python
usethesource: Add prototype "upload offer for source"
e340f18ec9fa e340f18ec9fa 770f4f6c261d e340f18ec9fa e340f18ec9fa e340f18ec9fa c0a4fe5f39d0 c0a4fe5f39d0 e340f18ec9fa e340f18ec9fa 9ff46824209a 2a23a0a55ea0 2a23a0a55ea0 2a23a0a55ea0 2a23a0a55ea0 e340f18ec9fa e340f18ec9fa e340f18ec9fa 84daddb4ff55 770f4f6c261d 770f4f6c261d 770f4f6c261d 770f4f6c261d 770f4f6c261d 770f4f6c261d 770f4f6c261d 770f4f6c261d 770f4f6c261d 770f4f6c261d 770f4f6c261d | from django import forms
from .models import Comment, SourceOffer
class CommentForm(forms.ModelForm):
post_to_list = forms.BooleanField(required=False)
class Meta:
model = Comment
fields = ['time', 'attribute_to', 'message', 'post_to_list']
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['time'].widget.input_type = 'datetime-local'
class DownloadForm(forms.Form):
agree = forms.BooleanField(label="I understand that the goal of this process is to determine compliance with FOSS licenses, and that in downloading the source code candidate and/or firmware image, I am assisting SFC as a volunteer to investigate that question. I, therefore, promise and represent that I will not copy, distribute, modify, or otherwise use this source code candidate and/or firmware image for any purpose other than to help SFC evaluate the source code candidate for compliance with the terms of FOSS licenses, including but not limited to any version of the GNU General Public License. Naturally, if I determine in good faith that portions of the source code candidate and/or firmware image are subject to a FOSS license and are compliant with it, I may copy, distribute, modify, or otherwise use those portions in accordance with the FOSS license, and I take full responsibility for that determination and subsequent use.")
class SourceOfferForm(forms.ModelForm):
class Meta:
model = SourceOffer
fields = ['vendor', 'device', 'photo']
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['photo'].widget.attrs['capture'] = 'camera'
self.fields['photo'].widget.attrs['accept'] = 'image/*'
|