Beispiel #1
0
 class Meta:
     model = Project
     fields = ('category', 'name', 'tags', 'description',
          'video', 'goal', 'expiration_date')
     widgets = {
         'category': forms.Select(attrs=
                                    {'class': 'form-control',
                                     'placeholder':'Category',
                                     }),
         'name': forms.TextInput(attrs=
                                    {'class': 'form-control',
                                     'placeholder':'Name',
                                     }),
         'tags': TagWidget(attrs=
                           {'class': 'form-control',
                            'placeholder':'Tags',
                            }),
         'description': forms.Textarea(attrs=
                                       {'class': 'form-control',
                                        'placeholder':'Markdown Description',
                                           }),
         'video': forms.URLInput(attrs=
                                    {'class': 'form-control',
                                     'placeholder':'YT video URL',
                                     }),
         'goal': forms.NumberInput(attrs=
                                   {'class': 'form-control',
                                    'placeholder':'goal',
                                     }),
         'expiration_date': forms.DateInput(attrs=
                                   {'class': 'form-control',
                                    'type': 'date',
                                     }),
         }
Beispiel #2
0
class SubmissionAdmin(admin.ModelAdmin):
    actions = (
        delete_selected,
        censor_selected,
    )

    list_display = (
        'title',
        'creator',
        'featured',
        'censored',
        'hidden',
        'taggit_tags',
        'modified',
    )

    list_editable = (
        'featured',
        'taggit_tags',
    )

    search_fields = ('title', 'summary', 'description', 'taggit_tags__name')

    list_filter = ('censored', 'hidden', 'created', 'modified')

    readonly_fields = ('censored', )

    formfield_overrides = {
        NamespacedTaggableManager: {
            "widget": TagWidget(attrs={"size": 70})
        }
    }

    def queryset(self, request):
        return Submission.admin_manager
Beispiel #3
0
    class Meta:
        """
        Add fields that should have DTP activated in the datetimepicker_fields list
        """

        model = Article
        fields = [
            "heading",
            "ingress_short",
            "ingress",
            "content",
            "image",
            "video",
            "published_date",
            "authors",
            "tags",
            "featured",
        ]

        # Fields should be a mapping between field name and an attribute dictionary
        img_fields = [("image", {"id": "responsive-image-id"})]
        dtp_fields = [("published_date", {})]
        widgetlist = [(DatetimePickerInput, dtp_fields),
                      (SingleImageInput, img_fields)]

        # Multiple widget generator merges results from regular widget_generator into a single widget dict
        widgets = multiple_widget_generator(widgetlist)
        widgets.update({
            "tags":
            TagWidget(
                attrs={"placeholder": "Eksempel: åre, online, kjelleren"})
        })
        labels = {"tags": "Tags"}
Beispiel #4
0
    class Meta:
        model = QuizSection
        fields = [
            'name',
            'short_name',
            #'topic',
            'duration',
            'tags',
        ]

        widgets = {
            # 'content': TextEditorWidget(),
            'position':
            forms.HiddenInput(),
            'name':
            forms.TextInput(attrs={'required': 'true'}),
            #'duration':
            #'topic': apply_select2(forms.Select),
            'tags':
            TagWidget(
                attrs={
                    'class': 'tag_input',
                    'data-role': "tagsinput",
                    'placeholder': 'Add Tags',
                }),
        }

        readonly_fields = ['topic']
Beispiel #5
0
    class Meta:
        """
        Add fields that should have DTP activated in the datetimepicker_fields list
        """

        model = Article
        fields = [
            'heading', 'ingress_short', 'ingress', 'content', 'image', 'video',
            'published_date', 'authors', 'tags', 'featured'
        ]

        # Fields should be a mapping between field name and an attribute dictionary
        img_fields = [('image', {'id': 'responsive-image-id'})]
        dtp_fields = [('published_date', {})]
        widgetlist = [(DatetimePickerInput, dtp_fields),
                      (SingleImageInput, img_fields)]

        # Multiple widget generator merges results from regular widget_generator into a single widget dict
        widgets = multiple_widget_generator(widgetlist)
        widgets.update({
            'tags':
            TagWidget(
                attrs={'placeholder': 'Eksempel: åre, online, kjelleren'})
        })
        labels = {'tags': 'Tags'}
Beispiel #6
0
 class Meta:
     model = Product
     fields = [
         'name', 'slug', 'category', 'brand', 'description',
         'original_price', 'disccount', 'dis', 'tags', 'image',
         'quantity_available', 'alta'
     ]
     widgets = {
         'name':
         forms.TextInput(attrs={'class': 'form-control'}),
         'slug':
         forms.TextInput(attrs={'class': 'form-control'}),
         'category':
         forms.Select(attrs={'class': 'form-control'}),
         'brand':
         forms.Select(attrs={'class': 'form-control'}),
         'description':
         forms.Textarea(attrs={'class': 'form-control'}),
         'original_price':
         forms.TextInput(attrs={'class': 'form-control'}),
         'dis':
         forms.NumberInput(attrs={'class': 'form-control'}),
         'tags':
         TagWidget(attrs={'class': 'form-control'}),
         'quantity_available':
         forms.NumberInput(attrs={'class': 'form-control'}),
     }
Beispiel #7
0
    class Meta:
        model = Products
        images = forms.ImageField(label='Image', required=False)
        exclude = [
            "slug", "image_thumbnail", "created_at", "is_approved",
            "added_by_merchant", "view_count"
        ]

        widgets = {
            'category':
            forms.Select(attrs={'class': 'form-control col-lg-9'}),
            'product_name':
            forms.TextInput(attrs={'class': 'form-control col-lg-9'}),
            'brand':
            forms.TextInput(attrs={'class': 'form-control col-lg-9'}),
            'product_max_price':
            forms.TextInput(attrs={'class': 'form-control col-lg-9'}),
            'product_discount_price':
            forms.TextInput(attrs={'class': 'form-control col-lg-9'}),
            'product_description':
            forms.TextInput(attrs={'class': 'form-control col-lg-9'}),
            'product_long_description':
            forms.TextInput(attrs={'class': 'form-control col-lg-9'}),
            'tags':
            TagWidget(attrs={'class': 'form-control col-lg-9'}),
            'in_stock_total':
            forms.NumberInput(attrs={'class': 'form-control col-lg-9'}),
            'images':
            forms.FileInput(attrs={'class': ''})
        }
Beispiel #8
0
class gundemForm(forms.ModelForm):
    gundem_adi = forms.CharField(
        required=True,
        widget=forms.TextInput(attrs={'class': 'form-control'}),
        label='Gündem Adı :')
    gundem_tarihi = forms.DateField(
        required=True,
        widget=forms.DateInput(attrs={
            'class': 'form-control',
            'placeholder': '12/12/2016'
        }),
        label='Gündem Tarihi:')
    onem_derecesi = forms.ModelChoiceField(
        required=True,
        queryset=OnemDerecesi.objects.all(),
        widget=forms.Select(attrs={'class': 'form-control'}),
        label='Önem Derecesi:')
    gorusler = forms.CharField(
        required=False,
        widget=forms.Textarea(attrs={'class': 'form-control'}),
        label='Görüşleriniz:')
    ekleyen_kullanici = forms.IntegerField(required=False,
                                           widget=forms.HiddenInput())
    tags = TagField(required=False,
                    label="Etiketler",
                    widget=TagWidget(attrs={'class': 'form-control'}))

    class Meta():
        exclude = ["ekleyen_kullanici"]
        model = Gundem
        fields = '__all__'
Beispiel #9
0
class BlockchainNewsForm(forms.ModelForm):
    title = forms.CharField(label='Topic',
                            widget=forms.TextInput(
                                attrs={
                                    'class': 'form-control input-lg',
                                    'name': 'title',
                                    'type': 'text',
                                    'id': 'title',
                                    'placeholder': 'Title'
                                }))
    text = forms.CharField(widget=CKEditorWidget())
    tags = TagField(label_suffix=mark_safe(
        '<br/><small style="margin-top:450px;">Add Comma separated tags here</small>'
    ),
                    widget=TagWidget(attrs={
                        'class': 'form-control input-lg',
                        'placeholder': 'Tags'
                    }),
                    required=False)

    class Meta:
        model = BlockchainNew
        fields = (
            'title',
            'tags',
            'text',
        )
Beispiel #10
0
 class Meta:
     model = Project
     fields = ('name', 'description', 'repositoryType', 'repository',
               'license', 'state', 'tags', 'mail', 'contribution', 'logo')
     labels = {
         'name': 'Nombre',
         'mail': 'Email',
         'description': 'Descripción',
         'repositoryType': 'Host del Repositorio',
         'repository': 'URL del repositorio',
         'license': 'Licencia del software',
         'state': 'Estado del proyecto',
         'contribution': 'Abierto a Contribuciones'
     }
     help_texts = {
         'name': 'Nombre del proyecto',
         'mail': 'Lista de correo o email para ponerse en contacto',
         'description': 'Descripción del proyecto',
         'repositoryType':
         'Donde está hosteado el sistema de versionado del proyecto',
         'repository': 'URL del repositorio del proyecto',
         'license': 'Bajo que licenciacia se distribuye el proyecto',
         'state': 'Si el proyecto se encuentra activo o inactivo',
         'contribution': 'Abierto a contribuciones de la comunidad',
     }
     widgets = {
         'tags': TagWidget(),
     }
Beispiel #11
0
 class Meta(object):
     model = JobListing
     fields = [
         "title",
         "description",
         "skills",
         "compensation",
         "location",
         "location_latitude",
         "location_longitude",
         "remote",
         "employer_name",
         "employer_website",
         "contact_name",
         "contact_email",
     ]
     widgets = {
         "title": forms.TextInput(attrs={"class": "input-block-level"}),
         "description": forms.Textarea(attrs={"class": "input-block-level"}),
         "skills": TagWidget(attrs={"class": "input-block-level"}),
         "compensation": forms.TextInput(attrs={"class": "input-block-level"}),
         "location": forms.TextInput(attrs={"class": "input-block-level"}),
         "location_latitude": forms.HiddenInput(),
         "location_longitude": forms.HiddenInput(),
         "employer_name": forms.TextInput(attrs={"class": "input-block-level"}),
         "employer_website": forms.TextInput(attrs={"class": "input-block-level"}),
         "contact_name": forms.TextInput(attrs={"class": "input-block-level"}),
         "contact_email": forms.TextInput(attrs={"class": "input-block-level"}),
     }
Beispiel #12
0
    class Meta:
        model = Lesson
        fields = [
            'name',
            'short_name',
            'tags',
            'position',
        ]

        widgets = {
            'position':
            forms.HiddenInput(),
            'name':
            forms.TextInput(attrs={
                'required': 'true',
                'class': 'object_name'
            }, ),
            'tags':
            TagWidget(
                attrs={
                    'class': 'tag_input',
                    'data-role': "tagsinput",
                    'placeholder': 'Add Tags',
                }),
        }
 class Meta:
     model = Project
     fields = ('title', 'objectives', 'buckets', 'description', 'tags',
               'collaborators')
     widgets = {
         'tags': TagWidget(),
     }
Beispiel #14
0
 class Meta:
     model = Specialist
     widgets = {'info': RedactorEditor(), 'tags': TagWidget()}
     fields = [
         'photo', 'full_name', 'street_address', 'short_info', 'info',
         'tags', 'categories', 'sex'
     ]
Beispiel #15
0
    class Meta:
        model = blog_post
        title_attrs = {
            'class': 'form-control form-control-lg',
            'id': 'post_title',
            'type': 'text',
            'name': 'title',
            'placeholder': _('str_postForm_title_placeholder')
        }
        subtitle_attrs = {
            'class': 'form-control form-control-lg',
            'id': 'post_subtitle',
            'type': 'text',
            'name': 'subtitle',
            'placeholder': _('str_postForm_subtitle_placeholder')
        }
        unsplash_url_attrs = {
            'class': 'form-control form-control-lg mr-2',
            'id': 'post_unsplash_url',
            'type': 'URL',
            'name': 'unsplash_url',
            'placeholder': fl('{}/{}_url', 'https://unsplash.com',
                              _('str_photo'))
        }
        category_attrs = {
            'class': 'selectpicker',
            'id': 'post_category',
            'name': 'category',
            'data-style': 'bs-select-form-control',
            'data-title': _('str_postForm_category_title'),
            'data-width': '100%'
        }
        tags_attrs = {
            'class': 'form-control form-control-lg,',
            'id': 'post_tags',
            'type': 'text',
            'name': 'tags',
            'placeholder': _('str_postForm_tags_placeholder')
        }
        fields = ('title', 'subtitle', 'image', 'unsplash_URL', 'post_body',
                  'category', 'tags')
        labels = {
            'title': _('str_postForm_title_label'),
            'subtitle': _('str_postForm_subtitle_label'),
            'image': _('str_postForm_image_label'),
            'unsplash_URL': _('str_unsplashURL_label'),
            'category': _('str_postForm_category_label'),
            'tags': _('str_postForm_tags_label'),
            'post_body': _('str_postForm_postBody_label')
        }

        widgets = {
            'title': f.TextInput(attrs=title_attrs),
            'subtitle': f.TextInput(attrs=subtitle_attrs),
            'unsplash_URL': f.URLInput(attrs=unsplash_url_attrs),
            'category': f.Select(attrs=category_attrs),
            'tags': TagWidget(attrs=tags_attrs),
            'post_body': SummernoteWidget(),
        }
Beispiel #16
0
 class Meta:
     model = Post
     fields = ('title', 'text', 'tags')
     widgets = {
         'title': forms.TextInput(attrs={'class': 'form-control'}),
         'text': forms.Textarea(attrs={'class': 'form-control'}),
         'tags': TagWidget(attrs={'class': 'tagit-hidden-field', 'id': 'tag-it'}) 
     }
Beispiel #17
0
 class Meta:
     model = Company
     widgets = {'info': RedactorEditor(), 'company_tags': TagWidget()}
     fields = [
         'logo', 'name', 'street_address', 'short_phone', 'short_info',
         'website', 'categories', 'info', 'email', 'company_tags',
         'latitude', 'longitude'
     ]
Beispiel #18
0
class SolutionForm(forms.ModelForm):

    subject_choice = forms.ModelChoiceField(
        queryset=Subject.objects.all(),
        empty_label="Subject",
        to_field_name="title",
        widget=forms.Select(attrs={
            "'class": 'col s4 indigo',
            'id': 'sol-subject-choice'
        }))

    title = forms.CharField(max_length=40,
                            widget=forms.TextInput(
                                attrs={
                                    'class': 'input-field col s8 validate',
                                    'id': 'sol-title',
                                    'data-length': '40'
                                }),
                            label="Title")

    cause = forms.CharField(
        max_length=80,
        widget=forms.Textarea(
            attrs={
                'class': 'input-field col s12 materialize-textarea validate',
                'id': 'sol-cause',
                'data-length': '80'
            }),
        label="Cause")

    description = forms.CharField(
        max_length=512,
        widget=forms.Textarea(
            attrs={
                'class': 'input-field col s12 materialize-textarea validate',
                'id': 'sol-description',
                'data-length': '512'
            }),
        label="Description")

    post_time = forms.DateTimeField(widget=forms.HiddenInput(),
                                    initial=datetime.now())

    tags = TagField(widget=TagWidget(
        attrs={'placeholder': 'python, programming, django,..'}),
                    label="Tags")

    class Meta:
        model = Solution
        fields = ("title", 'cause', 'description', 'tags', 'subject_choice')
        help_texts = {
            'title': 'Give your solution a title',
            'subject_choice': 'Choose subject',
            'cause': 'Cause',
            'description': 'Description',
            'tags': 'Tags'
        }
        labels = help_texts
Beispiel #19
0
    class Meta:
        model = Ticket
        fields = [
            "title", "ticket_type", "priority", "application", "description",
            "tags"
            #          'assigned_to'
        ]

        widgets = {"tags": TagWidget()}
Beispiel #20
0
class DocumentUploadForm(forms.Form):
    collection_title = forms.CharField(
        label=_('Add all to collection with this title'),
        required=False,
        widget=forms.TextInput(attrs={'class': 'form-control'}),
        help_text=_('Leave empty and no collection will be created'))
    public = forms.BooleanField(
        initial=True,
        required=False,
        label=_('Make documents public'),
        widget=BootstrapCheckboxInput,
    )
    tags = TagField(
        required=False,
        label=_('Tags'),
        help_text=_('These tags will be applied to all documents.'),
        widget=TagWidget(attrs={'class': 'form-control'}))
    language = forms.ChoiceField(
        choices=Document.LANGUAGE_CHOICES,
        initial=settings.LANGUAGE_CODE,
        label=_('Language'),
        help_text=_('Choose the dominant language of the documents.'),
        widget=forms.Select(attrs={'class': 'form-control'}))

    def save(self, user):
        upload_list = self.data.getlist('upload')
        collection = None
        if self.cleaned_data['collection_title']:
            collection = DocumentCollection.objects.create(
                title=self.cleaned_data['collection_title'],
                user=user,
                public=self.cleaned_data['public'])
        doc_count = len(upload_list)
        for upload_url in upload_list:
            document = self.create_document_from_upload(user, upload_url)
            if document is None:
                continue
            if self.cleaned_data['tags']:
                document.tags.set(*self.cleaned_data['tags'])
            if collection:
                CollectionDocument.objects.get_or_create(collection=collection,
                                                         document=document)

        return doc_count

    def create_document_from_upload(self, user, upload_url):
        upload = Upload.objects.get_by_url(upload_url, user=user)
        if upload is None:
            return

        document = Document.objects.create(title=upload.filename, user=user)
        upload.ensure_saving()
        upload.save()

        transaction.on_commit(
            lambda: move_upload_to_document.delay(document.id, upload.id))
        return document
Beispiel #21
0
    class Meta:
        model = Post
        fields = ['title', 'body','tags', 'image']

        widgets = {
            'title' : forms.TextInput(attrs={'class':'textinputclass form-control'}),
            'body' : forms.Textarea(attrs={'class':'editable medium-editor-textarea postcontent form-control'}),
            'tags': TagWidget(attrs={'class':'form-control'}),
            'image': forms.ClearableFileInput(attrs={'class':'form-control-file'})
        }
 class Meta:
     model = KidsGathering
     fields = ['name', 'generated_at', 'presidents_features', 'school']
     widgets = {
         "name":
         forms.TextInput(
             attrs={'placeholder': 'Ejemplo: “Quinto básico C”'}),
         "presidents_features":
         TagWidget(attrs={"max_length": 100})
     }
Beispiel #23
0
	class Meta:
		model = Collection
		fields = {"title", "description", "tags"}
		widgets = {
		    'description': forms.Textarea(attrs={'cols': 40, 'rows': 5, 'class':'form-control', 
		                                         'placeholder':'Tell the story of the collection'}),

		    'title': forms.TextInput(attrs={'class':'form-control', 'placeholder':'Title Your Collection', 'required':'True'}),
            'tags': TagWidget(attrs={'class':'form-control', 'placeholder':'add, tags, with, commas', 'required':'True'}),
		}
Beispiel #24
0
 class Meta:
     model = Image
     exclude = ()
     widgets = {
         'user': forms.HiddenInput(),
         'original': forms.ClearableFileInput(attrs={'multiple': True}),
         'alt_text': forms.TextInput(attrs={'class': 'form-control'}),
         'common': forms.CheckboxInput(attrs={'class': 'form-check-input'}),
         'tags': TagWidget(attrs={'class': 'form-control'}),
     }
Beispiel #25
0
 class Meta:
     model = Assessment
     fields = "__all__"
     exclude = (
         'user',
         "uploadDate",
     )
     widgets = {
         'assessmentDate': DateInput(),
         'tags': TagWidget(),
     }
Beispiel #26
0
class ProfileAdmin(admin.ModelAdmin):

    list_display = (
        'user_name',
        'related_user',
        'fullname',
        'title',
        'organization',
        'location',
        'content_flagging_email',
        'tags',
    )

    list_editable = (
        'content_flagging_email',
        'tags',
    )

    search_fields = (
        'user__username',
        'homepage',
        'title',
        'fullname',
        'organization',
        'location',
        'bio',
        'misc',
        'user__email',
        'tags__name',
    )

    list_filter = ()

    formfield_overrides = {
        NamespacedTaggableManager: {
            "widget": TagWidget(attrs={"size": 45})
        }
    }

    def related_user(self, obj):
        """HTML link to related user account"""
        link = reverse('admin:auth_user_change', args=(obj.user.id, ))
        # TODO: Needs l10n? Maybe not a priority for an admin page.
        return ('<a href="%(link)s"><strong>User %(id)s</strong></a>' %
                dict(link=link, id=obj.user.id, username=obj.user.username))

    related_user.allow_tags = True
    related_user.short_description = 'User account'

    def user_name(self, obj):
        return obj.user.username

    user_name.short_description = 'User name'
Beispiel #27
0
 class Meta:
     model = Image
     fields = (
         'title',
         'url',
         'description',
         'tags',
     )
     widgets = {
         'url': forms.HiddenInput,
         'tags': TagWidget(),
     }
Beispiel #28
0
 class Meta:
     model = Ad
     fields = ('title', 'image', 'tags', 'short_description',
               'long_description')
     widgets = {
         'tags':
         TagWidget(
             attrs={
                 "class":
                 "form-control form-control-lg pr-5 shadow p-1 mb-1 bg-white rounded"
             }),
     }
Beispiel #29
0
 class Meta:
     model = ResponsiveImage
     fields = ["name", "description", "photographer", "tags"]
     widgets = {
         "tags":
         TagWidget(
             attrs={"placeholder": "Eksempel: kontoret, kjelleren, åre"}),
         "photographer":
         forms.TextInput(
             attrs={"placeholder": "Eventuell(e) fotograf(er)..."}),
     }
     labels = {"tags": "Tags"}
Beispiel #30
0
 class Meta:
     model = Listing
     exclude = ['owner', 'active', 'slug', 'created_at']
     widgets = {
         'title': forms.TextInput(attrs={'placeholder': 'Title'}),
         'price': forms.TextInput(attrs={'placeholder': 'Price'}),
         'area': forms.TextInput(attrs={'placeholder': 'Area/Location'}),
         'city': forms.TextInput(attrs={'placeholder': 'City'}),
         'zip_code': forms.TextInput(attrs={'placeholder': 'Zip Code'}),
         'tags': TagWidget(),
         'start_time': DateInput(),
         'end_time': DateInput()
     }