view apps/bundle/forms.py @ 177:86129d185ddb

Add versioning to bundles Some other bundle-related changes were made, including: * Editing the snippetform CSS and HTML to allow bundle/form.djhtml to be reused for editing * Changing {% block title %} to {% block section %} in the base template for bundles to allow for more flexibility when creating breadcrumbs * Saved common URL patterns in variables in bundle/urls.py * Renamed explore.html to explore.djhtml for consistency You should now be able to upload new versions as well as view the files (or a particular file) for a bundle at a specific version. Coming soon: the ability to add a timestamp and a comment for each new uploaded version (if this feature is desirable).
author dellsystem <ilostwaldo@gmail.com>
date Sat, 20 Oct 2012 23:28:50 -0400
parents c7be7def8b57
children cdcbfaa65cfe
line wrap: on
line source

from django import forms

from apps.bundle.models import Bundle


class BundleForm(forms.ModelForm):
    class Meta:
        model = Bundle
        fields = ('name', 'description', 'free_license')

    file = forms.FileField(help_text=("Upload a plain text file or an \
        archive file."))


class BundleEditForm(forms.ModelForm):
    """
    Like BundleForm, but for editing bundles. A new form is needed because
    the name field should not be editable after creation, and because the
    file field shouldn't be required in this case
    """
    class Meta:
        model = Bundle
        fields = ('description', 'free_license')

    file = forms.FileField(help_text=("Upload a plain text file or an \
        archive file to update the version."), required=False)