~zyga/+junk/lava-data-store

« back to all changes in this revision

Viewing changes to lava_data_store/models.py

  • Committer: Zygmunt Krynicki
  • Date: 2011-09-08 23:07:46 UTC
  • Revision ID: zygmunt.krynicki@linaro.org-20110908230746-dv333slv85losxdy
Initial commit on standalone lava-data-store

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2010, 2011 Linaro Limited
 
2
#
 
3
# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
 
4
#
 
5
# This file is part of LAVA Server.
 
6
#
 
7
# LAVA Server is free software: you can redistribute it and/or modify
 
8
# it under the terms of the GNU Affero General Public License version 3
 
9
# as published by the Free Software Foundation
 
10
#
 
11
# LAVA Server is distributed in the hope that it will be useful,
 
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
# GNU General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU Affero General Public License
 
17
# along with LAVA Server.  If not, see <http://www.gnu.org/licenses/>.
 
18
 
 
19
"""
 
20
Headless model application experiment
 
21
"""
 
22
 
 
23
from django.db import models
 
24
from django.utils.translation import ugettext as _
 
25
 
 
26
from django_restricted_resource.models  import RestrictedResource
 
27
 
 
28
 
 
29
class Project(RestrictedResource):
 
30
    """
 
31
    Project is a container of everything else. Projects are restricted
 
32
    resources and thus belong to a particular user or group and have a "public"
 
33
    flag.
 
34
    """
 
35
 
 
36
    name = models.CharField(
 
37
        null=False,
 
38
        blank=False,
 
39
        max_length=100,
 
40
        verbose_name=_(u"Name"),
 
41
        help_text=_(u"Arbitrary text, up to 100 characters"
 
42
                    u", can be changed later"))
 
43
 
 
44
    is_aggregate = models.BooleanField(
 
45
        blank=True,
 
46
        null=False,
 
47
        verbose_name=_("Aggregate"),
 
48
        help_text=_(u"When selected the project will be treated like a"
 
49
                    u" distribution. Some UI elements are optimized for that case"
 
50
                    u" and behave differently."))
 
51
 
 
52
    def __unicode__(self):
 
53
        return self.name
 
54
 
 
55
    @models.permalink
 
56
    def get_absolute_url(self):
 
57
        return ('lava_data_store.views.project_detail', [self.pk])