We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
What categories do we need?
Currently allowed categories include:
- multimedia
- pim
- tools
- games

Anything else?


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `nextcloudappstore/core/models.py`
Content:
```
1 from django.conf import settings  # type: ignore
2 from django.contrib.auth.models import User  # type: ignore
3 from django.db.models import ManyToManyField, ForeignKey, \
4     URLField, IntegerField, CharField, CASCADE, TextField, \
5     DateTimeField, Model, BooleanField  # type: ignore
6 from django.utils.translation import ugettext_lazy as _  # type: ignore
7 from parler.models import TranslatedFields, TranslatableModel  # type: ignore
8 
9 
10 class App(TranslatableModel):
11     id = CharField(max_length=128, unique=True, primary_key=True,
12                    verbose_name=_('Id'),
13                    help_text=_('app id, identical to folder name'))
14     categories = ManyToManyField('Category', verbose_name=_('Category'))
15     translations = TranslatedFields(
16         name=CharField(max_length=128, verbose_name=_('Name'),
17                        help_text=_('Rendered app name for users')),
18         description=TextField(verbose_name=_('Description'), help_text=_(
19             'Will be rendered as Markdown'))
20     )
21     # resources
22     user_docs = URLField(max_length=256, blank=True,
23                          verbose_name=_('User documentation url'))
24     admin_docs = URLField(max_length=256, blank=True,
25                           verbose_name=_('Admin documentation url'))
26     developer_docs = URLField(max_length=256, blank=True,
27                               verbose_name=_('Developer documentation url'))
28     issue_tracker = URLField(max_length=256, blank=True,
29                              verbose_name=_('Issue tracker url'))
30     website = URLField(max_length=256, blank=True, verbose_name=_('Homepage'))
31     created = DateTimeField(auto_now_add=True, editable=False,
32                             verbose_name=_('Created at'))
33     last_modified = DateTimeField(auto_now=True, editable=False, db_index=True,
34                                   verbose_name=_('Updated at'))
35     owner = ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_('App owner'),
36                        on_delete=CASCADE, related_name='owned_apps')
37     co_maintainers = ManyToManyField(settings.AUTH_USER_MODEL, blank=True,
38                                      verbose_name=_('Co-Maintainers'),
39                                      related_name='co_maintained_apps')
40     recommendations = ManyToManyField(settings.AUTH_USER_MODEL, blank=True,
41                                       verbose_name=_('Recommendations'),
42                                       related_name='recommended_apps')
43     featured = BooleanField(verbose_name=_('Featured'), default=False)
44 
45     class Meta:
46         verbose_name = _('App')
47         verbose_name_plural = _('Apps')
48 
49     def __str__(self) -> str:
50         return self.name
51 
52     def can_update(self, user: User) -> bool:
53         return self.owner == user or user in self.co_maintainers.all()
54 
55     def can_delete(self, user: User) -> bool:
56         return self.owner == user
57 
58 
59 class AppRelease(Model):
60     version = CharField(max_length=128, verbose_name=_('Version'),
61                         help_text=_('Version follows Semantic Versioning'))
62     app = ForeignKey('App', on_delete=CASCADE, verbose_name=_('App'),
63                      related_name='releases')
64     # dependencies
65     php_extensions = ManyToManyField('PhpExtension', blank=True,
66                                      through='PhpExtensionDependency',
67                                      verbose_name=_(
68                                          'PHP extension dependency'))
69     databases = ManyToManyField('Database', blank=True,
70                                 through='DatabaseDependency',
71                                 verbose_name=_('Database dependency'))
72     licenses = ManyToManyField('License', verbose_name=_('License'))
73     shell_commands = ManyToManyField('ShellCommand', blank=True,
74                                      verbose_name=_(
75                                          'Shell command dependency'))
76     php_version_spec = CharField(max_length=128,
77                                  verbose_name=_('PHP version requirement'))
78     platform_version_spec = CharField(max_length=128, verbose_name=_(
79         'Platform version requirement'))
80     min_int_size = IntegerField(blank=True, default=32,
81                                 verbose_name=_('Minimum Integer Bits'),
82                                 help_text=_('e.g. 32 for 32bit Integers'))
83     checksum = CharField(max_length=64, verbose_name=_('SHA256 checksum'))
84     download = URLField(max_length=256, blank=True,
85                         verbose_name=_('Archive download Url'))
86     created = DateTimeField(auto_now_add=True, editable=False,
87                             verbose_name=_('Created at'))
88     last_modified = DateTimeField(auto_now=True, editable=False, db_index=True,
89                                   verbose_name=_('Updated at'))
90 
91     class Meta:
92         verbose_name = _('App Release')
93         verbose_name_plural = _('App Releases')
94         unique_together = (('app', 'version'),)
95         ordering = ['-version']
96 
97     def can_update(self, user: User) -> bool:
98         return self.app.owner == user or user in self.app.co_maintainers.all()
99 
100     def can_delete(self, user: User) -> bool:
101         return self.can_update(user)
102 
103     def __str__(self) -> str:
104         return '%s %s' % (self.app, self.version)
105 
106 
107 class Screenshot(Model):
108     url = URLField(max_length=256, verbose_name=_('Image url'))
109     app = ForeignKey('App', on_delete=CASCADE, verbose_name=_('App'),
110                      related_name='screenshots')
111     ordering = IntegerField(verbose_name=_('Ordering'))
112 
113     class Meta:
114         verbose_name = _('Screenshot')
115         verbose_name_plural = _('Screenshots')
116         ordering = ['ordering']
117 
118     def __str__(self) -> str:
119         return self.url
120 
121 
122 class ShellCommand(Model):
123     name = CharField(max_length=128, unique=True, primary_key=True,
124                      verbose_name=_('Shell Command'),
125                      help_text=_(
126                          'Name of a required shell command, e.g. grep'))
127 
128     class Meta:
129         verbose_name = _('Shell Command')
130         verbose_name_plural = _('Shell Commands')
131 
132     def __str__(self) -> str:
133         return self.name
134 
135 
136 class Category(TranslatableModel):
137     id = CharField(max_length=128, unique=True, primary_key=True,
138                    verbose_name=_('Id'),
139                    help_text=_(
140                        'Category id which is used to identify a '
141                        'category. Used to identify categories when '
142                        'uploading an app'))
143     created = DateTimeField(auto_now_add=True, editable=False,
144                             verbose_name=_('Created at'))
145     last_modified = DateTimeField(auto_now=True, editable=False, db_index=True,
146                                   verbose_name=_('Updated at'))
147     translations = TranslatedFields(
148         name=CharField(max_length=128, help_text=_(
149             'Category name which will be presented to the user'),
150                        verbose_name=_('Name')),
151         description=TextField(verbose_name=_('Description'),
152                               help_text=_('Will be rendered as Markdown'))
153     )
154 
155     class Meta:
156         verbose_name = _('Category')
157         verbose_name_plural = _('Categories')
158 
159     def __str__(self) -> str:
160         return self.name
161 
162 
163 class License(Model):
164     id = CharField(max_length=128, unique=True, primary_key=True,
165                    verbose_name=_('Id'),
166                    help_text=_(
167                        'Key which is used to identify a license'))
168     name = CharField(max_length=128, verbose_name=_('Name'),
169                      help_text=_(
170                          'License name which will be presented to '
171                          'the user'))
172 
173     class Meta:
174         verbose_name = _('License')
175         verbose_name_plural = _('Licenses')
176 
177     def __str__(self) -> str:
178         return self.name
179 
180 
181 class Database(Model):
182     id = CharField(max_length=128, unique=True, primary_key=True,
183                    verbose_name=_('Id'),
184                    help_text=_('Key which is used to identify a database'))
185     name = CharField(max_length=128, verbose_name=_('Name'),
186                      help_text=_(
187                          'Database name which will be presented to the user'))
188 
189     class Meta:
190         verbose_name = _('Database')
191         verbose_name_plural = _('Databases')
192 
193     def __str__(self) -> str:
194         return self.name
195 
196 
197 class DatabaseDependency(Model):
198     app_release = ForeignKey('AppRelease', on_delete=CASCADE,
199                              verbose_name=_('App release'),
200                              related_name='databasedependencies')
201     database = ForeignKey('Database', related_name='releasedependencies',
202                           on_delete=CASCADE, verbose_name=_('Database'))
203     version_spec = CharField(max_length=128,
204                              verbose_name=_('Database version requirement'))
205 
206     class Meta:
207         verbose_name = _('Database Dependency')
208         verbose_name_plural = _('Database Dependencies')
209         unique_together = (('app_release', 'database', 'version_spec'),)
210 
211     def __str__(self) -> str:
212         return '%s: %s %s' % (self.app_release, self.database,
213                               self.version_spec)
214 
215 
216 class PhpExtension(Model):
217     id = CharField(max_length=128, unique=True, help_text=_('e.g. libxml'),
218                    primary_key=True, verbose_name=_('PHP extension'))
219 
220     class Meta:
221         verbose_name = _('PHP Extension')
222         verbose_name_plural = _('PHP Extensions')
223 
224     def __str__(self) -> str:
225         return self.id
226 
227 
228 class PhpExtensionDependency(Model):
229     app_release = ForeignKey('AppRelease', on_delete=CASCADE,
230                              verbose_name=_('App Release'),
231                              related_name='phpextensiondependencies')
232     php_extension = ForeignKey('PhpExtension', on_delete=CASCADE,
233                                verbose_name=_('PHP Extension'),
234                                related_name='releasedependencies')
235     version_spec = CharField(max_length=128,
236                              verbose_name=_('Extension version requirement'))
237 
238     class Meta:
239         verbose_name = _('PHP Extension Dependency')
240         verbose_name_plural = _('PHP Extension Dependencies')
241         unique_together = (('app_release', 'php_extension', 'version_spec'),)
242 
243     def __str__(self) -> str:
244         return '%s: %s %s' % (self.app_release.app, self.php_extension,
245                               self.version_spec)
246
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/nextcloudappstore/core/models.py b/nextcloudappstore/core/models.py
--- a/nextcloudappstore/core/models.py
+++ b/nextcloudappstore/core/models.py
@@ -155,6 +155,7 @@
     class Meta:
         verbose_name = _('Category')
         verbose_name_plural = _('Categories')
+        ordering = ['id']
 
     def __str__(self) -> str:
         return self.name

{"golden_diff": "diff --git a/nextcloudappstore/core/models.py b/nextcloudappstore/core/models.py\n--- a/nextcloudappstore/core/models.py\n+++ b/nextcloudappstore/core/models.py\n@@ -155,6 +155,7 @@\n     class Meta:\n         verbose_name = _('Category')\n         verbose_name_plural = _('Categories')\n+        ordering = ['id']\n \n     def __str__(self) -> str:\n         return self.name\n", "issue": "What categories do we need?\nCurrently allowed categories include:\n- multimedia\n- pim\n- tools\n- games\n\nAnything else?\n\n", "before_files": [{"content": "from django.conf import settings  # type: ignore\nfrom django.contrib.auth.models import User  # type: ignore\nfrom django.db.models import ManyToManyField, ForeignKey, \\\n    URLField, IntegerField, CharField, CASCADE, TextField, \\\n    DateTimeField, Model, BooleanField  # type: ignore\nfrom django.utils.translation import ugettext_lazy as _  # type: ignore\nfrom parler.models import TranslatedFields, TranslatableModel  # type: ignore\n\n\nclass App(TranslatableModel):\n    id = CharField(max_length=128, unique=True, primary_key=True,\n                   verbose_name=_('Id'),\n                   help_text=_('app id, identical to folder name'))\n    categories = ManyToManyField('Category', verbose_name=_('Category'))\n    translations = TranslatedFields(\n        name=CharField(max_length=128, verbose_name=_('Name'),\n                       help_text=_('Rendered app name for users')),\n        description=TextField(verbose_name=_('Description'), help_text=_(\n            'Will be rendered as Markdown'))\n    )\n    # resources\n    user_docs = URLField(max_length=256, blank=True,\n                         verbose_name=_('User documentation url'))\n    admin_docs = URLField(max_length=256, blank=True,\n                          verbose_name=_('Admin documentation url'))\n    developer_docs = URLField(max_length=256, blank=True,\n                              verbose_name=_('Developer documentation url'))\n    issue_tracker = URLField(max_length=256, blank=True,\n                             verbose_name=_('Issue tracker url'))\n    website = URLField(max_length=256, blank=True, verbose_name=_('Homepage'))\n    created = DateTimeField(auto_now_add=True, editable=False,\n                            verbose_name=_('Created at'))\n    last_modified = DateTimeField(auto_now=True, editable=False, db_index=True,\n                                  verbose_name=_('Updated at'))\n    owner = ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_('App owner'),\n                       on_delete=CASCADE, related_name='owned_apps')\n    co_maintainers = ManyToManyField(settings.AUTH_USER_MODEL, blank=True,\n                                     verbose_name=_('Co-Maintainers'),\n                                     related_name='co_maintained_apps')\n    recommendations = ManyToManyField(settings.AUTH_USER_MODEL, blank=True,\n                                      verbose_name=_('Recommendations'),\n                                      related_name='recommended_apps')\n    featured = BooleanField(verbose_name=_('Featured'), default=False)\n\n    class Meta:\n        verbose_name = _('App')\n        verbose_name_plural = _('Apps')\n\n    def __str__(self) -> str:\n        return self.name\n\n    def can_update(self, user: User) -> bool:\n        return self.owner == user or user in self.co_maintainers.all()\n\n    def can_delete(self, user: User) -> bool:\n        return self.owner == user\n\n\nclass AppRelease(Model):\n    version = CharField(max_length=128, verbose_name=_('Version'),\n                        help_text=_('Version follows Semantic Versioning'))\n    app = ForeignKey('App', on_delete=CASCADE, verbose_name=_('App'),\n                     related_name='releases')\n    # dependencies\n    php_extensions = ManyToManyField('PhpExtension', blank=True,\n                                     through='PhpExtensionDependency',\n                                     verbose_name=_(\n                                         'PHP extension dependency'))\n    databases = ManyToManyField('Database', blank=True,\n                                through='DatabaseDependency',\n                                verbose_name=_('Database dependency'))\n    licenses = ManyToManyField('License', verbose_name=_('License'))\n    shell_commands = ManyToManyField('ShellCommand', blank=True,\n                                     verbose_name=_(\n                                         'Shell command dependency'))\n    php_version_spec = CharField(max_length=128,\n                                 verbose_name=_('PHP version requirement'))\n    platform_version_spec = CharField(max_length=128, verbose_name=_(\n        'Platform version requirement'))\n    min_int_size = IntegerField(blank=True, default=32,\n                                verbose_name=_('Minimum Integer Bits'),\n                                help_text=_('e.g. 32 for 32bit Integers'))\n    checksum = CharField(max_length=64, verbose_name=_('SHA256 checksum'))\n    download = URLField(max_length=256, blank=True,\n                        verbose_name=_('Archive download Url'))\n    created = DateTimeField(auto_now_add=True, editable=False,\n                            verbose_name=_('Created at'))\n    last_modified = DateTimeField(auto_now=True, editable=False, db_index=True,\n                                  verbose_name=_('Updated at'))\n\n    class Meta:\n        verbose_name = _('App Release')\n        verbose_name_plural = _('App Releases')\n        unique_together = (('app', 'version'),)\n        ordering = ['-version']\n\n    def can_update(self, user: User) -> bool:\n        return self.app.owner == user or user in self.app.co_maintainers.all()\n\n    def can_delete(self, user: User) -> bool:\n        return self.can_update(user)\n\n    def __str__(self) -> str:\n        return '%s %s' % (self.app, self.version)\n\n\nclass Screenshot(Model):\n    url = URLField(max_length=256, verbose_name=_('Image url'))\n    app = ForeignKey('App', on_delete=CASCADE, verbose_name=_('App'),\n                     related_name='screenshots')\n    ordering = IntegerField(verbose_name=_('Ordering'))\n\n    class Meta:\n        verbose_name = _('Screenshot')\n        verbose_name_plural = _('Screenshots')\n        ordering = ['ordering']\n\n    def __str__(self) -> str:\n        return self.url\n\n\nclass ShellCommand(Model):\n    name = CharField(max_length=128, unique=True, primary_key=True,\n                     verbose_name=_('Shell Command'),\n                     help_text=_(\n                         'Name of a required shell command, e.g. grep'))\n\n    class Meta:\n        verbose_name = _('Shell Command')\n        verbose_name_plural = _('Shell Commands')\n\n    def __str__(self) -> str:\n        return self.name\n\n\nclass Category(TranslatableModel):\n    id = CharField(max_length=128, unique=True, primary_key=True,\n                   verbose_name=_('Id'),\n                   help_text=_(\n                       'Category id which is used to identify a '\n                       'category. Used to identify categories when '\n                       'uploading an app'))\n    created = DateTimeField(auto_now_add=True, editable=False,\n                            verbose_name=_('Created at'))\n    last_modified = DateTimeField(auto_now=True, editable=False, db_index=True,\n                                  verbose_name=_('Updated at'))\n    translations = TranslatedFields(\n        name=CharField(max_length=128, help_text=_(\n            'Category name which will be presented to the user'),\n                       verbose_name=_('Name')),\n        description=TextField(verbose_name=_('Description'),\n                              help_text=_('Will be rendered as Markdown'))\n    )\n\n    class Meta:\n        verbose_name = _('Category')\n        verbose_name_plural = _('Categories')\n\n    def __str__(self) -> str:\n        return self.name\n\n\nclass License(Model):\n    id = CharField(max_length=128, unique=True, primary_key=True,\n                   verbose_name=_('Id'),\n                   help_text=_(\n                       'Key which is used to identify a license'))\n    name = CharField(max_length=128, verbose_name=_('Name'),\n                     help_text=_(\n                         'License name which will be presented to '\n                         'the user'))\n\n    class Meta:\n        verbose_name = _('License')\n        verbose_name_plural = _('Licenses')\n\n    def __str__(self) -> str:\n        return self.name\n\n\nclass Database(Model):\n    id = CharField(max_length=128, unique=True, primary_key=True,\n                   verbose_name=_('Id'),\n                   help_text=_('Key which is used to identify a database'))\n    name = CharField(max_length=128, verbose_name=_('Name'),\n                     help_text=_(\n                         'Database name which will be presented to the user'))\n\n    class Meta:\n        verbose_name = _('Database')\n        verbose_name_plural = _('Databases')\n\n    def __str__(self) -> str:\n        return self.name\n\n\nclass DatabaseDependency(Model):\n    app_release = ForeignKey('AppRelease', on_delete=CASCADE,\n                             verbose_name=_('App release'),\n                             related_name='databasedependencies')\n    database = ForeignKey('Database', related_name='releasedependencies',\n                          on_delete=CASCADE, verbose_name=_('Database'))\n    version_spec = CharField(max_length=128,\n                             verbose_name=_('Database version requirement'))\n\n    class Meta:\n        verbose_name = _('Database Dependency')\n        verbose_name_plural = _('Database Dependencies')\n        unique_together = (('app_release', 'database', 'version_spec'),)\n\n    def __str__(self) -> str:\n        return '%s: %s %s' % (self.app_release, self.database,\n                              self.version_spec)\n\n\nclass PhpExtension(Model):\n    id = CharField(max_length=128, unique=True, help_text=_('e.g. libxml'),\n                   primary_key=True, verbose_name=_('PHP extension'))\n\n    class Meta:\n        verbose_name = _('PHP Extension')\n        verbose_name_plural = _('PHP Extensions')\n\n    def __str__(self) -> str:\n        return self.id\n\n\nclass PhpExtensionDependency(Model):\n    app_release = ForeignKey('AppRelease', on_delete=CASCADE,\n                             verbose_name=_('App Release'),\n                             related_name='phpextensiondependencies')\n    php_extension = ForeignKey('PhpExtension', on_delete=CASCADE,\n                               verbose_name=_('PHP Extension'),\n                               related_name='releasedependencies')\n    version_spec = CharField(max_length=128,\n                             verbose_name=_('Extension version requirement'))\n\n    class Meta:\n        verbose_name = _('PHP Extension Dependency')\n        verbose_name_plural = _('PHP Extension Dependencies')\n        unique_together = (('app_release', 'php_extension', 'version_spec'),)\n\n    def __str__(self) -> str:\n        return '%s: %s %s' % (self.app_release.app, self.php_extension,\n                              self.version_spec)\n", "path": "nextcloudappstore/core/models.py"}], "after_files": [{"content": "from django.conf import settings  # type: ignore\nfrom django.contrib.auth.models import User  # type: ignore\nfrom django.db.models import ManyToManyField, ForeignKey, \\\n    URLField, IntegerField, CharField, CASCADE, TextField, \\\n    DateTimeField, Model, BooleanField  # type: ignore\nfrom django.utils.translation import ugettext_lazy as _  # type: ignore\nfrom parler.models import TranslatedFields, TranslatableModel  # type: ignore\n\n\nclass App(TranslatableModel):\n    id = CharField(max_length=128, unique=True, primary_key=True,\n                   verbose_name=_('Id'),\n                   help_text=_('app id, identical to folder name'))\n    categories = ManyToManyField('Category', verbose_name=_('Category'))\n    translations = TranslatedFields(\n        name=CharField(max_length=128, verbose_name=_('Name'),\n                       help_text=_('Rendered app name for users')),\n        description=TextField(verbose_name=_('Description'), help_text=_(\n            'Will be rendered as Markdown'))\n    )\n    # resources\n    user_docs = URLField(max_length=256, blank=True,\n                         verbose_name=_('User documentation url'))\n    admin_docs = URLField(max_length=256, blank=True,\n                          verbose_name=_('Admin documentation url'))\n    developer_docs = URLField(max_length=256, blank=True,\n                              verbose_name=_('Developer documentation url'))\n    issue_tracker = URLField(max_length=256, blank=True,\n                             verbose_name=_('Issue tracker url'))\n    website = URLField(max_length=256, blank=True, verbose_name=_('Homepage'))\n    created = DateTimeField(auto_now_add=True, editable=False,\n                            verbose_name=_('Created at'))\n    last_modified = DateTimeField(auto_now=True, editable=False, db_index=True,\n                                  verbose_name=_('Updated at'))\n    owner = ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_('App owner'),\n                       on_delete=CASCADE, related_name='owned_apps')\n    co_maintainers = ManyToManyField(settings.AUTH_USER_MODEL, blank=True,\n                                     verbose_name=_('Co-Maintainers'),\n                                     related_name='co_maintained_apps')\n    recommendations = ManyToManyField(settings.AUTH_USER_MODEL, blank=True,\n                                      verbose_name=_('Recommendations'),\n                                      related_name='recommended_apps')\n    featured = BooleanField(verbose_name=_('Featured'), default=False)\n\n    class Meta:\n        verbose_name = _('App')\n        verbose_name_plural = _('Apps')\n\n    def __str__(self) -> str:\n        return self.name\n\n    def can_update(self, user: User) -> bool:\n        return self.owner == user or user in self.co_maintainers.all()\n\n    def can_delete(self, user: User) -> bool:\n        return self.owner == user\n\n\nclass AppRelease(Model):\n    version = CharField(max_length=128, verbose_name=_('Version'),\n                        help_text=_('Version follows Semantic Versioning'))\n    app = ForeignKey('App', on_delete=CASCADE, verbose_name=_('App'),\n                     related_name='releases')\n    # dependencies\n    php_extensions = ManyToManyField('PhpExtension', blank=True,\n                                     through='PhpExtensionDependency',\n                                     verbose_name=_(\n                                         'PHP extension dependency'))\n    databases = ManyToManyField('Database', blank=True,\n                                through='DatabaseDependency',\n                                verbose_name=_('Database dependency'))\n    licenses = ManyToManyField('License', verbose_name=_('License'))\n    shell_commands = ManyToManyField('ShellCommand', blank=True,\n                                     verbose_name=_(\n                                         'Shell command dependency'))\n    php_version_spec = CharField(max_length=128,\n                                 verbose_name=_('PHP version requirement'))\n    platform_version_spec = CharField(max_length=128, verbose_name=_(\n        'Platform version requirement'))\n    min_int_size = IntegerField(blank=True, default=32,\n                                verbose_name=_('Minimum Integer Bits'),\n                                help_text=_('e.g. 32 for 32bit Integers'))\n    checksum = CharField(max_length=64, verbose_name=_('SHA256 checksum'))\n    download = URLField(max_length=256, blank=True,\n                        verbose_name=_('Archive download Url'))\n    created = DateTimeField(auto_now_add=True, editable=False,\n                            verbose_name=_('Created at'))\n    last_modified = DateTimeField(auto_now=True, editable=False, db_index=True,\n                                  verbose_name=_('Updated at'))\n\n    class Meta:\n        verbose_name = _('App Release')\n        verbose_name_plural = _('App Releases')\n        unique_together = (('app', 'version'),)\n        ordering = ['-version']\n\n    def can_update(self, user: User) -> bool:\n        return self.app.owner == user or user in self.app.co_maintainers.all()\n\n    def can_delete(self, user: User) -> bool:\n        return self.can_update(user)\n\n    def __str__(self) -> str:\n        return '%s %s' % (self.app, self.version)\n\n\nclass Screenshot(Model):\n    url = URLField(max_length=256, verbose_name=_('Image url'))\n    app = ForeignKey('App', on_delete=CASCADE, verbose_name=_('App'),\n                     related_name='screenshots')\n    ordering = IntegerField(verbose_name=_('Ordering'))\n\n    class Meta:\n        verbose_name = _('Screenshot')\n        verbose_name_plural = _('Screenshots')\n        ordering = ['ordering']\n\n    def __str__(self) -> str:\n        return self.url\n\n\nclass ShellCommand(Model):\n    name = CharField(max_length=128, unique=True, primary_key=True,\n                     verbose_name=_('Shell Command'),\n                     help_text=_(\n                         'Name of a required shell command, e.g. grep'))\n\n    class Meta:\n        verbose_name = _('Shell Command')\n        verbose_name_plural = _('Shell Commands')\n\n    def __str__(self) -> str:\n        return self.name\n\n\nclass Category(TranslatableModel):\n    id = CharField(max_length=128, unique=True, primary_key=True,\n                   verbose_name=_('Id'),\n                   help_text=_(\n                       'Category id which is used to identify a '\n                       'category. Used to identify categories when '\n                       'uploading an app'))\n    created = DateTimeField(auto_now_add=True, editable=False,\n                            verbose_name=_('Created at'))\n    last_modified = DateTimeField(auto_now=True, editable=False, db_index=True,\n                                  verbose_name=_('Updated at'))\n    translations = TranslatedFields(\n        name=CharField(max_length=128, help_text=_(\n            'Category name which will be presented to the user'),\n                       verbose_name=_('Name')),\n        description=TextField(verbose_name=_('Description'),\n                              help_text=_('Will be rendered as Markdown'))\n    )\n\n    class Meta:\n        verbose_name = _('Category')\n        verbose_name_plural = _('Categories')\n        ordering = ['id']\n\n    def __str__(self) -> str:\n        return self.name\n\n\nclass License(Model):\n    id = CharField(max_length=128, unique=True, primary_key=True,\n                   verbose_name=_('Id'),\n                   help_text=_(\n                       'Key which is used to identify a license'))\n    name = CharField(max_length=128, verbose_name=_('Name'),\n                     help_text=_(\n                         'License name which will be presented to '\n                         'the user'))\n\n    class Meta:\n        verbose_name = _('License')\n        verbose_name_plural = _('Licenses')\n\n    def __str__(self) -> str:\n        return self.name\n\n\nclass Database(Model):\n    id = CharField(max_length=128, unique=True, primary_key=True,\n                   verbose_name=_('Id'),\n                   help_text=_('Key which is used to identify a database'))\n    name = CharField(max_length=128, verbose_name=_('Name'),\n                     help_text=_(\n                         'Database name which will be presented to the user'))\n\n    class Meta:\n        verbose_name = _('Database')\n        verbose_name_plural = _('Databases')\n\n    def __str__(self) -> str:\n        return self.name\n\n\nclass DatabaseDependency(Model):\n    app_release = ForeignKey('AppRelease', on_delete=CASCADE,\n                             verbose_name=_('App release'),\n                             related_name='databasedependencies')\n    database = ForeignKey('Database', related_name='releasedependencies',\n                          on_delete=CASCADE, verbose_name=_('Database'))\n    version_spec = CharField(max_length=128,\n                             verbose_name=_('Database version requirement'))\n\n    class Meta:\n        verbose_name = _('Database Dependency')\n        verbose_name_plural = _('Database Dependencies')\n        unique_together = (('app_release', 'database', 'version_spec'),)\n\n    def __str__(self) -> str:\n        return '%s: %s %s' % (self.app_release, self.database,\n                              self.version_spec)\n\n\nclass PhpExtension(Model):\n    id = CharField(max_length=128, unique=True, help_text=_('e.g. libxml'),\n                   primary_key=True, verbose_name=_('PHP extension'))\n\n    class Meta:\n        verbose_name = _('PHP Extension')\n        verbose_name_plural = _('PHP Extensions')\n\n    def __str__(self) -> str:\n        return self.id\n\n\nclass PhpExtensionDependency(Model):\n    app_release = ForeignKey('AppRelease', on_delete=CASCADE,\n                             verbose_name=_('App Release'),\n                             related_name='phpextensiondependencies')\n    php_extension = ForeignKey('PhpExtension', on_delete=CASCADE,\n                               verbose_name=_('PHP Extension'),\n                               related_name='releasedependencies')\n    version_spec = CharField(max_length=128,\n                             verbose_name=_('Extension version requirement'))\n\n    class Meta:\n        verbose_name = _('PHP Extension Dependency')\n        verbose_name_plural = _('PHP Extension Dependencies')\n        unique_together = (('app_release', 'php_extension', 'version_spec'),)\n\n    def __str__(self) -> str:\n        return '%s: %s %s' % (self.app_release.app, self.php_extension,\n                              self.version_spec)\n", "path": "nextcloudappstore/core/models.py"}]}