Mercurial > agora-palash
annotate 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 |
rev | line source |
---|---|
151
c7be7def8b57
Bundles! (basic functionality)
dellsystem <ilostwaldo@gmail.com>
parents:
diff
changeset
|
1 from django import forms |
c7be7def8b57
Bundles! (basic functionality)
dellsystem <ilostwaldo@gmail.com>
parents:
diff
changeset
|
2 |
c7be7def8b57
Bundles! (basic functionality)
dellsystem <ilostwaldo@gmail.com>
parents:
diff
changeset
|
3 from apps.bundle.models import Bundle |
c7be7def8b57
Bundles! (basic functionality)
dellsystem <ilostwaldo@gmail.com>
parents:
diff
changeset
|
4 |
c7be7def8b57
Bundles! (basic functionality)
dellsystem <ilostwaldo@gmail.com>
parents:
diff
changeset
|
5 |
c7be7def8b57
Bundles! (basic functionality)
dellsystem <ilostwaldo@gmail.com>
parents:
diff
changeset
|
6 class BundleForm(forms.ModelForm): |
c7be7def8b57
Bundles! (basic functionality)
dellsystem <ilostwaldo@gmail.com>
parents:
diff
changeset
|
7 class Meta: |
c7be7def8b57
Bundles! (basic functionality)
dellsystem <ilostwaldo@gmail.com>
parents:
diff
changeset
|
8 model = Bundle |
177
86129d185ddb
Add versioning to bundles
dellsystem <ilostwaldo@gmail.com>
parents:
151
diff
changeset
|
9 fields = ('name', 'description', 'free_license') |
151
c7be7def8b57
Bundles! (basic functionality)
dellsystem <ilostwaldo@gmail.com>
parents:
diff
changeset
|
10 |
c7be7def8b57
Bundles! (basic functionality)
dellsystem <ilostwaldo@gmail.com>
parents:
diff
changeset
|
11 file = forms.FileField(help_text=("Upload a plain text file or an \ |
c7be7def8b57
Bundles! (basic functionality)
dellsystem <ilostwaldo@gmail.com>
parents:
diff
changeset
|
12 archive file.")) |
177
86129d185ddb
Add versioning to bundles
dellsystem <ilostwaldo@gmail.com>
parents:
151
diff
changeset
|
13 |
86129d185ddb
Add versioning to bundles
dellsystem <ilostwaldo@gmail.com>
parents:
151
diff
changeset
|
14 |
86129d185ddb
Add versioning to bundles
dellsystem <ilostwaldo@gmail.com>
parents:
151
diff
changeset
|
15 class BundleEditForm(forms.ModelForm): |
86129d185ddb
Add versioning to bundles
dellsystem <ilostwaldo@gmail.com>
parents:
151
diff
changeset
|
16 """ |
86129d185ddb
Add versioning to bundles
dellsystem <ilostwaldo@gmail.com>
parents:
151
diff
changeset
|
17 Like BundleForm, but for editing bundles. A new form is needed because |
86129d185ddb
Add versioning to bundles
dellsystem <ilostwaldo@gmail.com>
parents:
151
diff
changeset
|
18 the name field should not be editable after creation, and because the |
86129d185ddb
Add versioning to bundles
dellsystem <ilostwaldo@gmail.com>
parents:
151
diff
changeset
|
19 file field shouldn't be required in this case |
86129d185ddb
Add versioning to bundles
dellsystem <ilostwaldo@gmail.com>
parents:
151
diff
changeset
|
20 """ |
86129d185ddb
Add versioning to bundles
dellsystem <ilostwaldo@gmail.com>
parents:
151
diff
changeset
|
21 class Meta: |
86129d185ddb
Add versioning to bundles
dellsystem <ilostwaldo@gmail.com>
parents:
151
diff
changeset
|
22 model = Bundle |
86129d185ddb
Add versioning to bundles
dellsystem <ilostwaldo@gmail.com>
parents:
151
diff
changeset
|
23 fields = ('description', 'free_license') |
86129d185ddb
Add versioning to bundles
dellsystem <ilostwaldo@gmail.com>
parents:
151
diff
changeset
|
24 |
86129d185ddb
Add versioning to bundles
dellsystem <ilostwaldo@gmail.com>
parents:
151
diff
changeset
|
25 file = forms.FileField(help_text=("Upload a plain text file or an \ |
86129d185ddb
Add versioning to bundles
dellsystem <ilostwaldo@gmail.com>
parents:
151
diff
changeset
|
26 archive file to update the version."), required=False) |