1212from django .urls import reverse
1313from django .utils import timezone
1414# third-party imports
15- from easy_thumbnails .fields import ThumbnailerImageField
15+ from easy_thumbnails .fields import ThumbnailerImageField , ThumbnailerField
1616from django_countries .fields import CountryField
1717
1818
@@ -51,7 +51,6 @@ def __str__(self):
5151class FeatureOption (models .Model ):
5252
5353 feature = models .ForeignKey ('Feature' , models .CASCADE , related_name = 'options' )
54-
5554 slug = models .SlugField (db_index = True , unique = False )
5655 value = models .CharField (max_length = 100 )
5756
@@ -63,6 +62,41 @@ def __str__(self):
6362
6463 pass
6564
65+ # ==============================================
66+ # M2MInfoModel
67+ # ==============================================
68+ #class M2MInfoModel(models.Model):
69+ #slug = models.SlugField(unique=True)
70+ #name = models.CharField(max_length=64)
71+ #url = models.URLField(blank=True, max_length=512)
72+ #description = models.TextField(blank=True, help_text='This field supports Markdown Syntax')
73+
74+ #class Meta:
75+ #ordering = ('name',)
76+ #abstract = True
77+
78+ #def __str__(self):
79+ #return self.name
80+
81+ #pass
82+
83+ # ==============================================
84+ # Tag
85+ # ==============================================
86+ class Tag (models .Model ):
87+ slug = models .SlugField (unique = True )
88+ name = models .CharField (max_length = 64 )
89+ url = models .URLField (blank = True , max_length = 512 )
90+
91+ class Meta :
92+ ordering = ('name' ,)
93+
94+
95+ def __str__ (self ):
96+ return self .name
97+
98+ pass
99+
66100# ==============================================
67101# License
68102# ==============================================
@@ -123,6 +157,7 @@ class ProjectType(models.Model):
123157
124158 slug = models .SlugField (unique = True )
125159 name = models .CharField (max_length = 32 )
160+ description = models .TextField (blank = True , help_text = 'This field supports Markdown Syntax' )
126161
127162 class Meta :
128163 ordering = ('name' ,)
@@ -351,6 +386,11 @@ class SystemVersion(models.Model):
351386 related_name = 'version_acquired_bys' )
352387
353388 # General Information Fields
389+ tags = models .ManyToManyField (
390+ 'Tag' , blank = True ,
391+ related_name = 'tags' ,
392+ verbose_name = 'Tag' )
393+
354394 project_types = models .ManyToManyField (
355395 'ProjectType' , blank = True ,
356396 related_name = 'project_types' ,
@@ -360,7 +400,7 @@ class SystemVersion(models.Model):
360400 blank = True , max_length = 500 ,
361401 help_text = "The original organization that developed the DBMS." )
362402
363- logo = ThumbnailerImageField (
403+ logo = ThumbnailerField (
364404 blank = True , upload_to = 'logos/' )
365405
366406 countries = CountryField (
@@ -413,6 +453,9 @@ def __str__(self):
413453 def get_absolute_url (self ):
414454 return reverse ('system_revision_view' , args = [self .system .slug , self .ver ])
415455
456+ def tags_str (self ):
457+ return ', ' .join ( self .tags .values_list ('name' , flat = True ) )
458+
416459 def project_types_str (self ):
417460 return ', ' .join ( self .project_types .values_list ('name' , flat = True ) )
418461
@@ -600,6 +643,7 @@ def written_in_str(self):
600643 'License' ,
601644 'OperatingSystem' ,
602645 'ProgrammingLanguage' ,
646+ 'Tag' ,
603647 'ProjectType' ,
604648 'Publication' ,
605649 'SuggestedSystem' ,
0 commit comments