We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
use settings.AUTH_USER_MODEL
use settings.AUTH_USER_MODEL to refer to the auth usr model.

See https://docs.djangoproject.com/en/1.9/topics/auth/customizing/#referencing-the-user-model


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

{"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@@ -1,3 +1,4 @@\n+from django.conf import settings  # type: ignore\n from django.contrib.auth.models import User  # type: ignore\n from django.db import models  # type: ignore\n from django.utils.translation import ugettext_lazy as _  # type: ignore\n@@ -32,14 +33,15 @@\n                                    verbose_name=_('Created at'))\n     last_modified = models.DateTimeField(auto_now=True, editable=False,\n                                          verbose_name=_('Updated at'))\n-    owner = models.ForeignKey('auth.User', verbose_name=_('App owner'),\n+    owner = models.ForeignKey(settings.AUTH_USER_MODEL,\n+                              verbose_name=_('App owner'),\n                               on_delete=models.CASCADE,\n                               related_name='owned_apps')\n-    co_maintainers = models.ManyToManyField('auth.User',\n+    co_maintainers = models.ManyToManyField(settings.AUTH_USER_MODEL,\n                                             verbose_name=_('Co-Maintainers'),\n                                             related_name='co_maintained_apps',\n                                             blank=True)\n-    recommendations = models.ManyToManyField('auth.User',\n+    recommendations = models.ManyToManyField(settings.AUTH_USER_MODEL,\n                                              verbose_name=_('Recommendations'),\n                                              related_name='recommended_apps',\n                                              blank=True)\n", "issue": "use settings.AUTH_USER_MODEL\nuse settings.AUTH_USER_MODEL to refer to the auth usr model.\n\nSee https://docs.djangoproject.com/en/1.9/topics/auth/customizing/#referencing-the-user-model\n\n", "before_files": [{"content": "from django.contrib.auth.models import User  # type: ignore\nfrom django.db import models  # 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 = models.CharField(max_length=128, unique=True, primary_key=True,\n                          verbose_name=_('Id'),\n                          help_text=_('app id, same as the folder name'))\n    categories = models.ManyToManyField('Category', verbose_name=_('Category'))\n    translations = TranslatedFields(\n        name=models.CharField(max_length=128, verbose_name=_('Name'),\n                              help_text=_('Rendered app name for users')),\n        description=models.TextField(verbose_name=_('Description'),\n                                     help_text=_(\n                                         'Will be rendered as Markdown'))\n    )\n    # resources\n    user_docs = models.URLField(max_length=256, blank=True,\n                                verbose_name=_('User documentation url'))\n    admin_docs = models.URLField(max_length=256, blank=True,\n                                 verbose_name=_('Admin documentation url'))\n    developer_docs = models.URLField(max_length=256, blank=True,\n                                     verbose_name=_(\n                                         'Developer documentation url'))\n    issue_tracker = models.URLField(max_length=256, blank=True,\n                                    verbose_name=_('Issue tracker url'))\n    website = models.URLField(max_length=256, blank=True,\n                              verbose_name=_('Homepage'))\n    created = models.DateTimeField(auto_now_add=True, editable=False,\n                                   verbose_name=_('Created at'))\n    last_modified = models.DateTimeField(auto_now=True, editable=False,\n                                         verbose_name=_('Updated at'))\n    owner = models.ForeignKey('auth.User', verbose_name=_('App owner'),\n                              on_delete=models.CASCADE,\n                              related_name='owned_apps')\n    co_maintainers = models.ManyToManyField('auth.User',\n                                            verbose_name=_('Co-Maintainers'),\n                                            related_name='co_maintained_apps',\n                                            blank=True)\n    recommendations = models.ManyToManyField('auth.User',\n                                             verbose_name=_('Recommendations'),\n                                             related_name='recommended_apps',\n                                             blank=True)\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(models.Model):\n    version = models.CharField(max_length=128, verbose_name=_('Version'),\n                               help_text=_(\n                                   'Version follows Semantic Versioning'))\n    app = models.ForeignKey('App', on_delete=models.CASCADE,\n                            verbose_name=_('App'), related_name='releases')\n    # dependencies\n    php_extensions = models.ManyToManyField('PhpExtension',\n                                            through='PhpExtensionDependency',\n                                            verbose_name=_(\n                                                'PHP extension dependency'),\n                                            blank=True)\n    databases = models.ManyToManyField('Database',\n                                       through='DatabaseDependency',\n                                       verbose_name=_('Database dependency'),\n                                       blank=True)\n    licenses = models.ManyToManyField('License',\n                                      verbose_name=_('License'))\n    shell_commands = models.ManyToManyField('ShellCommand', verbose_name=_(\n        'Shell command dependency'), blank=True)\n    php_min_version = models.CharField(max_length=128,\n                                       verbose_name=_('PHP minimum version'),\n                                       blank=True)\n    php_max_version = models.CharField(max_length=128, blank=True,\n                                       verbose_name=_('PHP maximum version'))\n    platform_min_version = models.CharField(max_length=128,\n                                            verbose_name=_(\n                                                'Platform minimum version'))\n    platform_max_version = models.CharField(max_length=128, blank=True,\n                                            verbose_name=_(\n                                                'Platform maximum version'))\n    min_int_size = models.IntegerField(blank=True, default=0,\n                                       verbose_name=_('Minimum Integer Bits'),\n                                       help_text=_(\n                                           'e.g. 32 for 32bit Integers'))\n    checksum = models.CharField(max_length=64,\n                                verbose_name=_('SHA256 checksum'))\n    download = models.URLField(max_length=256, blank=True,\n                               verbose_name=_('Archive download Url'))\n    created = models.DateTimeField(auto_now_add=True, editable=False,\n                                   verbose_name=_('Created at'))\n    last_modified = models.DateTimeField(auto_now=True, editable=False,\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\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(models.Model):\n    url = models.URLField(max_length=256, verbose_name=_('Image url'))\n    app = models.ForeignKey('App', on_delete=models.CASCADE,\n                            verbose_name=_('App'), related_name='screenshots')\n    ordering = models.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(models.Model):\n    name = models.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 = models.CharField(max_length=128, unique=True, primary_key=True,\n                          help_text=_(\n                              'Category id which is used to identify a '\n                              'category. Used to identify categories when '\n                              'uploading an app'), verbose_name=_('Id'))\n    created = models.DateTimeField(auto_now_add=True, editable=False,\n                                   verbose_name=_('Created at'))\n    last_modified = models.DateTimeField(auto_now=True, editable=False,\n                                         verbose_name=_('Updated at'))\n    translations = TranslatedFields(\n        name=models.CharField(max_length=128, help_text=_(\n            'Category name which will be presented to the user'),\n                              verbose_name=_('Name')),\n        description=models.TextField(verbose_name=_('Description'),\n                                     help_text=_(\n                                         '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(models.Model):\n    id = models.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 = models.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(models.Model):\n    id = models.CharField(max_length=128, unique=True, primary_key=True,\n                          verbose_name=_('Id'),\n                          help_text=_(\n                              'Key which is used to identify a database'))\n    name = models.CharField(max_length=128, verbose_name=_('Name'),\n                            help_text=_(\n                                'Database name which will be presented to '\n                                '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(models.Model):\n    app_release = models.ForeignKey('AppRelease', on_delete=models.CASCADE,\n                                    verbose_name=_('App release'),\n                                    related_name='databasedependencies')\n    database = models.ForeignKey('Database', on_delete=models.CASCADE,\n                                 verbose_name=_('Database'),\n                                 related_name='releasedependencies')\n    min_version = models.CharField(max_length=128,\n                                   verbose_name=_(\n                                       'Database minimum version'))\n    max_version = models.CharField(max_length=128, blank=True,\n                                   verbose_name=_(\n                                       'Database maximum version'))\n\n    class Meta:\n        verbose_name = _('Database Dependency')\n        verbose_name_plural = _('Database Dependencies')\n        unique_together = (('app_release', 'database', 'min_version',\n                            'max_version'),)\n\n    def __str__(self) -> str:\n        return '%s: %s >=%s, <=%s' % (self.app_release, self.database,\n                                      self.min_version,\n                                      self.max_version)\n\n\nclass PhpExtension(models.Model):\n    id = models.CharField(max_length=128, unique=True, primary_key=True,\n                          verbose_name=_('PHP extension'),\n                          help_text=_('e.g. libxml'))\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(models.Model):\n    app_release = models.ForeignKey('AppRelease', on_delete=models.CASCADE,\n                                    verbose_name=_('App Release'),\n                                    related_name='phpextensiondependencies')\n    php_extension = models.ForeignKey('PhpExtension', on_delete=models.CASCADE,\n                                      verbose_name=_('PHP Extension'),\n                                      related_name='releasedependencies')\n    min_version = models.CharField(max_length=128,\n                                   verbose_name=_(\n                                       'Extension minimum version'))\n    max_version = models.CharField(max_length=128,\n                                   verbose_name=_(\n                                       'Extension maximum version'),\n                                   blank=True)\n\n    class Meta:\n        verbose_name = _('PHP Extension Dependency')\n        verbose_name_plural = _('PHP Extension Dependencies')\n        unique_together = (('app_release', 'php_extension', 'min_version',\n                            'max_version'),)\n\n    def __str__(self) -> str:\n        return '%s: %s >=%s, <=%s' % (self.app_release.app, self.php_extension,\n                                      self.min_version,\n                                      self.max_version)\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 import models  # 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 = models.CharField(max_length=128, unique=True, primary_key=True,\n                          verbose_name=_('Id'),\n                          help_text=_('app id, same as the folder name'))\n    categories = models.ManyToManyField('Category', verbose_name=_('Category'))\n    translations = TranslatedFields(\n        name=models.CharField(max_length=128, verbose_name=_('Name'),\n                              help_text=_('Rendered app name for users')),\n        description=models.TextField(verbose_name=_('Description'),\n                                     help_text=_(\n                                         'Will be rendered as Markdown'))\n    )\n    # resources\n    user_docs = models.URLField(max_length=256, blank=True,\n                                verbose_name=_('User documentation url'))\n    admin_docs = models.URLField(max_length=256, blank=True,\n                                 verbose_name=_('Admin documentation url'))\n    developer_docs = models.URLField(max_length=256, blank=True,\n                                     verbose_name=_(\n                                         'Developer documentation url'))\n    issue_tracker = models.URLField(max_length=256, blank=True,\n                                    verbose_name=_('Issue tracker url'))\n    website = models.URLField(max_length=256, blank=True,\n                              verbose_name=_('Homepage'))\n    created = models.DateTimeField(auto_now_add=True, editable=False,\n                                   verbose_name=_('Created at'))\n    last_modified = models.DateTimeField(auto_now=True, editable=False,\n                                         verbose_name=_('Updated at'))\n    owner = models.ForeignKey(settings.AUTH_USER_MODEL,\n                              verbose_name=_('App owner'),\n                              on_delete=models.CASCADE,\n                              related_name='owned_apps')\n    co_maintainers = models.ManyToManyField(settings.AUTH_USER_MODEL,\n                                            verbose_name=_('Co-Maintainers'),\n                                            related_name='co_maintained_apps',\n                                            blank=True)\n    recommendations = models.ManyToManyField(settings.AUTH_USER_MODEL,\n                                             verbose_name=_('Recommendations'),\n                                             related_name='recommended_apps',\n                                             blank=True)\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(models.Model):\n    version = models.CharField(max_length=128, verbose_name=_('Version'),\n                               help_text=_(\n                                   'Version follows Semantic Versioning'))\n    app = models.ForeignKey('App', on_delete=models.CASCADE,\n                            verbose_name=_('App'), related_name='releases')\n    # dependencies\n    php_extensions = models.ManyToManyField('PhpExtension',\n                                            through='PhpExtensionDependency',\n                                            verbose_name=_(\n                                                'PHP extension dependency'),\n                                            blank=True)\n    databases = models.ManyToManyField('Database',\n                                       through='DatabaseDependency',\n                                       verbose_name=_('Database dependency'),\n                                       blank=True)\n    licenses = models.ManyToManyField('License',\n                                      verbose_name=_('License'))\n    shell_commands = models.ManyToManyField('ShellCommand', verbose_name=_(\n        'Shell command dependency'), blank=True)\n    php_min_version = models.CharField(max_length=128,\n                                       verbose_name=_('PHP minimum version'),\n                                       blank=True)\n    php_max_version = models.CharField(max_length=128, blank=True,\n                                       verbose_name=_('PHP maximum version'))\n    platform_min_version = models.CharField(max_length=128,\n                                            verbose_name=_(\n                                                'Platform minimum version'))\n    platform_max_version = models.CharField(max_length=128, blank=True,\n                                            verbose_name=_(\n                                                'Platform maximum version'))\n    min_int_size = models.IntegerField(blank=True, default=0,\n                                       verbose_name=_('Minimum Integer Bits'),\n                                       help_text=_(\n                                           'e.g. 32 for 32bit Integers'))\n    checksum = models.CharField(max_length=64,\n                                verbose_name=_('SHA256 checksum'))\n    download = models.URLField(max_length=256, blank=True,\n                               verbose_name=_('Archive download Url'))\n    created = models.DateTimeField(auto_now_add=True, editable=False,\n                                   verbose_name=_('Created at'))\n    last_modified = models.DateTimeField(auto_now=True, editable=False,\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\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(models.Model):\n    url = models.URLField(max_length=256, verbose_name=_('Image url'))\n    app = models.ForeignKey('App', on_delete=models.CASCADE,\n                            verbose_name=_('App'), related_name='screenshots')\n    ordering = models.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(models.Model):\n    name = models.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 = models.CharField(max_length=128, unique=True, primary_key=True,\n                          help_text=_(\n                              'Category id which is used to identify a '\n                              'category. Used to identify categories when '\n                              'uploading an app'), verbose_name=_('Id'))\n    created = models.DateTimeField(auto_now_add=True, editable=False,\n                                   verbose_name=_('Created at'))\n    last_modified = models.DateTimeField(auto_now=True, editable=False,\n                                         verbose_name=_('Updated at'))\n    translations = TranslatedFields(\n        name=models.CharField(max_length=128, help_text=_(\n            'Category name which will be presented to the user'),\n                              verbose_name=_('Name')),\n        description=models.TextField(verbose_name=_('Description'),\n                                     help_text=_(\n                                         '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(models.Model):\n    id = models.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 = models.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(models.Model):\n    id = models.CharField(max_length=128, unique=True, primary_key=True,\n                          verbose_name=_('Id'),\n                          help_text=_(\n                              'Key which is used to identify a database'))\n    name = models.CharField(max_length=128, verbose_name=_('Name'),\n                            help_text=_(\n                                'Database name which will be presented to '\n                                '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(models.Model):\n    app_release = models.ForeignKey('AppRelease', on_delete=models.CASCADE,\n                                    verbose_name=_('App release'),\n                                    related_name='databasedependencies')\n    database = models.ForeignKey('Database', on_delete=models.CASCADE,\n                                 verbose_name=_('Database'),\n                                 related_name='releasedependencies')\n    min_version = models.CharField(max_length=128,\n                                   verbose_name=_(\n                                       'Database minimum version'))\n    max_version = models.CharField(max_length=128, blank=True,\n                                   verbose_name=_(\n                                       'Database maximum version'))\n\n    class Meta:\n        verbose_name = _('Database Dependency')\n        verbose_name_plural = _('Database Dependencies')\n        unique_together = (('app_release', 'database', 'min_version',\n                            'max_version'),)\n\n    def __str__(self) -> str:\n        return '%s: %s >=%s, <=%s' % (self.app_release, self.database,\n                                      self.min_version,\n                                      self.max_version)\n\n\nclass PhpExtension(models.Model):\n    id = models.CharField(max_length=128, unique=True, primary_key=True,\n                          verbose_name=_('PHP extension'),\n                          help_text=_('e.g. libxml'))\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(models.Model):\n    app_release = models.ForeignKey('AppRelease', on_delete=models.CASCADE,\n                                    verbose_name=_('App Release'),\n                                    related_name='phpextensiondependencies')\n    php_extension = models.ForeignKey('PhpExtension', on_delete=models.CASCADE,\n                                      verbose_name=_('PHP Extension'),\n                                      related_name='releasedependencies')\n    min_version = models.CharField(max_length=128,\n                                   verbose_name=_(\n                                       'Extension minimum version'))\n    max_version = models.CharField(max_length=128,\n                                   verbose_name=_(\n                                       'Extension maximum version'),\n                                   blank=True)\n\n    class Meta:\n        verbose_name = _('PHP Extension Dependency')\n        verbose_name_plural = _('PHP Extension Dependencies')\n        unique_together = (('app_release', 'php_extension', 'min_version',\n                            'max_version'),)\n\n    def __str__(self) -> str:\n        return '%s: %s >=%s, <=%s' % (self.app_release.app, self.php_extension,\n                                      self.min_version,\n                                      self.max_version)\n", "path": "nextcloudappstore/core/models.py"}]}