Skip to content

Commit 1dd6afc

Browse files
committed
Add django model mixin for package activity
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent 1d5b520 commit 1dd6afc

4 files changed

Lines changed: 42 additions & 2 deletions

File tree

aboutcode/federatedcode/contrib/__init__.py

Whitespace-only changes.

aboutcode/federatedcode/contrib/django/__init__.py

Whitespace-only changes.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#
2+
# Copyright (c) nexB Inc. and others. All rights reserved.
3+
# FederatedCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/nexB/federatedcode for support or download.
7+
# See https://aboutcode.org for more information about AboutCode.org OSS projects.
8+
#
9+
10+
from django.db import models
11+
from django.utils.translation import gettext_lazy as _
12+
13+
14+
class FederatedCodePackageActivityMixin(models.Model):
15+
"""Abstract Model for FederatedCode package activity."""
16+
17+
author = models.CharField(
18+
max_length=300,
19+
null=False,
20+
blank=False,
21+
help_text=_("Author of package activity."),
22+
)
23+
24+
content = models.JSONField(
25+
null=False,
26+
blank=False,
27+
help_text=_("Package activity content."),
28+
)
29+
30+
activity_update_date = models.DateTimeField(
31+
null=True,
32+
blank=True,
33+
db_index=True,
34+
help_text=_("Timestamp indicating when original activity was last updated."),
35+
)
36+
37+
class Meta:
38+
abstract = True

pyproject-aboutcode.federatedcode.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ classifiers = [
3535
]
3636

3737
dependencies = [
38-
"packageurl_python >= 0.15.6",
3938
"aboutcode.hashid>=0.2.0",
40-
"python-dotenv>=1.0.1",
4139
"click>=8.1.7",
40+
"Django>=5.1.2",
41+
"packageurl_python >= 0.15.6",
42+
"python-dotenv>=1.0.1",
4243
"requests>=2.32.3",
44+
"saneyaml>=0.6.0",
4345
]
4446

4547
urls = { Homepage = "https://github.com/aboutcode-org/federatedcode" }

0 commit comments

Comments
 (0)