wbnews 2.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. wbnews-2.2.1/.gitignore +181 -0
  2. wbnews-2.2.1/PKG-INFO +8 -0
  3. wbnews-2.2.1/pyproject.toml +31 -0
  4. wbnews-2.2.1/wbnews/.coveragerc +23 -0
  5. wbnews-2.2.1/wbnews/__init__.py +1 -0
  6. wbnews-2.2.1/wbnews/admin.py +27 -0
  7. wbnews-2.2.1/wbnews/apps.py +9 -0
  8. wbnews-2.2.1/wbnews/factories.py +33 -0
  9. wbnews-2.2.1/wbnews/fixtures/wbnews.yaml +1 -0
  10. wbnews-2.2.1/wbnews/import_export/__init__.py +0 -0
  11. wbnews-2.2.1/wbnews/import_export/backends/__init__.py +1 -0
  12. wbnews-2.2.1/wbnews/import_export/backends/news.py +35 -0
  13. wbnews-2.2.1/wbnews/import_export/handlers/__init__.py +1 -0
  14. wbnews-2.2.1/wbnews/import_export/handlers/news.py +25 -0
  15. wbnews-2.2.1/wbnews/import_export/parsers/__init__.py +0 -0
  16. wbnews-2.2.1/wbnews/import_export/parsers/emails/__init__.py +0 -0
  17. wbnews-2.2.1/wbnews/import_export/parsers/emails/news.py +48 -0
  18. wbnews-2.2.1/wbnews/import_export/parsers/emails/utils.py +61 -0
  19. wbnews-2.2.1/wbnews/import_export/parsers/rss/__init__.py +0 -0
  20. wbnews-2.2.1/wbnews/import_export/parsers/rss/news.py +63 -0
  21. wbnews-2.2.1/wbnews/locale/de/LC_MESSAGES/django.po +112 -0
  22. wbnews-2.2.1/wbnews/migrations/0001_initial_squashed_0005_alter_news_import_source.py +349 -0
  23. wbnews-2.2.1/wbnews/migrations/0006_alter_news_language.py +122 -0
  24. wbnews-2.2.1/wbnews/migrations/0007_auto_20240103_0955.py +43 -0
  25. wbnews-2.2.1/wbnews/migrations/0008_alter_news_language.py +123 -0
  26. wbnews-2.2.1/wbnews/migrations/0009_newsrelationship_analysis_newsrelationship_sentiment.py +94 -0
  27. wbnews-2.2.1/wbnews/migrations/__init__.py +0 -0
  28. wbnews-2.2.1/wbnews/models/__init__.py +3 -0
  29. wbnews-2.2.1/wbnews/models/llm/cleaned_news.py +63 -0
  30. wbnews-2.2.1/wbnews/models/news.py +116 -0
  31. wbnews-2.2.1/wbnews/models/relationships.py +20 -0
  32. wbnews-2.2.1/wbnews/models/sources.py +43 -0
  33. wbnews-2.2.1/wbnews/serializers.py +83 -0
  34. wbnews-2.2.1/wbnews/signals.py +4 -0
  35. wbnews-2.2.1/wbnews/tests/__init__.py +0 -0
  36. wbnews-2.2.1/wbnews/tests/conftest.py +6 -0
  37. wbnews-2.2.1/wbnews/tests/test_models.py +15 -0
  38. wbnews-2.2.1/wbnews/tests/tests.py +12 -0
  39. wbnews-2.2.1/wbnews/urls.py +29 -0
  40. wbnews-2.2.1/wbnews/viewsets/__init__.py +12 -0
  41. wbnews-2.2.1/wbnews/viewsets/buttons.py +23 -0
  42. wbnews-2.2.1/wbnews/viewsets/display.py +133 -0
  43. wbnews-2.2.1/wbnews/viewsets/endpoints.py +18 -0
  44. wbnews-2.2.1/wbnews/viewsets/menu.py +23 -0
  45. wbnews-2.2.1/wbnews/viewsets/titles.py +39 -0
  46. wbnews-2.2.1/wbnews/viewsets/views.py +140 -0
@@ -0,0 +1,181 @@
1
+ ~
2
+
3
+ # Docker volumes
4
+ volumes/
5
+ # Poetry auth file
6
+ auth.toml
7
+
8
+ media/*
9
+ media/
10
+ mediafiles/
11
+ mediafiles/*
12
+ test/*
13
+ staticfiles/*
14
+ staticfiles/
15
+ #
16
+ # Byte-compiled / optimized / DLL files
17
+ __pycache__/
18
+ *.py[cod]
19
+ *$py.class
20
+
21
+ # C extensions
22
+ *.so
23
+
24
+ # Distribution / packaging
25
+ .Python
26
+ build/
27
+ develop-eggs/
28
+ dist/
29
+ info/
30
+ downloads/
31
+ eggs/
32
+ .eggs/
33
+ lib/
34
+ lib64/
35
+ parts/
36
+ sdist/
37
+ var/
38
+ wheels/
39
+ share/python-wheels/
40
+ *.egg-info/
41
+ .installed.cfg
42
+ *.egg
43
+ MANIFEST
44
+
45
+ # PyInstaller
46
+ # Usually these files are written by a python script from a template
47
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
48
+ *.manifest
49
+ *.spec
50
+
51
+ # Installer logs
52
+ pip-log.txt
53
+ pip-delete-this-directory.txt
54
+
55
+ # Unit test / coverage reports
56
+ htmlcov/
57
+ .tox/
58
+ .nox/
59
+ .coverage
60
+ .coverage.*
61
+ .cache
62
+ .dccache
63
+ nosetests.xml
64
+ coverage.xml
65
+ *.cover
66
+ *.py,cover
67
+ .hypothesis/
68
+ .pytest_cache/
69
+ cover/
70
+ report.xml
71
+ */report.xml
72
+
73
+ # Translations
74
+ *.mo
75
+ *.pot
76
+
77
+ # Django stuff:
78
+ *.log
79
+ local_settings.py
80
+ *.sqlite3
81
+ db.sqlite3-journal
82
+
83
+ # Flask stuff:
84
+ instance/
85
+ .webassets-cache
86
+
87
+ # Scrapy stuff:
88
+ .scrapy
89
+
90
+ # Sphinx documentation
91
+ docs/_build/
92
+
93
+ # PyBuilder
94
+ .pybuilder/
95
+ target/
96
+
97
+ # Jupyter Notebook
98
+ .ipynb_checkpoints
99
+ *.ipynb
100
+ # IPython
101
+ profile_default/
102
+ ipython_config.py
103
+
104
+ # pyenv
105
+ # For a library or package, you might want to ignore these files since the code is
106
+ # intended to run in multiple environments; otherwise, check them in:
107
+ # .python-version
108
+
109
+ # pipenv
110
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
111
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
112
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
113
+ # install all needed dependencies.
114
+ #Pipfile.lock
115
+
116
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
117
+ __pypackages__/
118
+
119
+ # Celery stuff
120
+ celerybeat-schedule
121
+ celerybeat.pid
122
+
123
+ # SageMath parsed files
124
+ *.sage.py
125
+
126
+ # Environments
127
+ .env
128
+ .envrc
129
+ .venv
130
+ env/
131
+ venv/
132
+ ENV/
133
+ env.bak/
134
+ venv.bak/
135
+ .vscode/
136
+ .idea/
137
+ .idea.bkp/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+ crm/
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # Gitlab Runner
164
+ builds
165
+ builds/
166
+
167
+ # Integrator Office 365 : reverse proxy tunnel for outlook365
168
+ ngrok
169
+ */ngrok
170
+ /modules/**/system/
171
+
172
+ /modules/wbmailing/files/*
173
+ /modules/wbmailing/mailing/*
174
+
175
+ /projects/*/requirements.txt
176
+ public
177
+
178
+ # Ignore archive localization generated folder
179
+ backend/modules/**/archive/*
180
+ **/**/requirements.txt
181
+ CHANGELOG-*
wbnews-2.2.1/PKG-INFO ADDED
@@ -0,0 +1,8 @@
1
+ Metadata-Version: 2.3
2
+ Name: wbnews
3
+ Version: 2.2.1
4
+ Summary: A workbench module for managing news.
5
+ Author-email: Christopher Wittlinger <c.wittlinger@stainly.com>
6
+ Requires-Dist: feedparser==6.*
7
+ Requires-Dist: langdetect==1.*
8
+ Requires-Dist: wbcore
@@ -0,0 +1,31 @@
1
+ [project]
2
+ name = "wbnews"
3
+ description = "A workbench module for managing news."
4
+ authors = [{ name = "Christopher Wittlinger", email = "c.wittlinger@stainly.com"}]
5
+ dynamic = ["version"]
6
+
7
+ dependencies = [
8
+ "wbcore",
9
+ "feedparser == 6.*",
10
+ "langdetect == 1.*",
11
+ ]
12
+
13
+ [tool.uv.sources]
14
+ wbcore = { workspace = true }
15
+
16
+ [tool.uv]
17
+ package = true
18
+
19
+ [tool.hatch.version]
20
+ path = "../../pyproject.toml"
21
+
22
+ [tool.hatch.build.targets.sdist]
23
+ include = ["wbnews/*"]
24
+
25
+ [tool.hatch.build.targets.wheel]
26
+ packages = ["wbnews"]
27
+ only-packages = true
28
+
29
+ [build-system]
30
+ requires = ["hatchling"]
31
+ build-backend = "hatchling.build"
@@ -0,0 +1,23 @@
1
+ [report]
2
+ exclude_lines =
3
+ print()
4
+ def api_endpoints_root
5
+ def get_or_create_model_sql
6
+ def profile_check
7
+ if hasattr
8
+ raise Exception
9
+ raise Http404
10
+ except:
11
+
12
+
13
+ [run]
14
+ omit = */migrations/*
15
+ manage.py
16
+ */tests/*
17
+ */wbnews_config/*
18
+ */apps.py
19
+ */docs/*
20
+ */dynamic_preferences_registry.py
21
+ */permissions.py
22
+ */preferences/*
23
+ */.venv/*
@@ -0,0 +1 @@
1
+ __version__ = "1.0.0"
@@ -0,0 +1,27 @@
1
+ from django.contrib import admin
2
+
3
+ from .models import News, NewsRelationship, NewsSource
4
+
5
+
6
+ @admin.register(NewsRelationship)
7
+ class NewsRelationshipAdmin(admin.ModelAdmin):
8
+ list_display = ["news", "content_object"]
9
+ autocomplete_fields = ["news"]
10
+
11
+
12
+ @admin.register(News)
13
+ class NewsAdmin(admin.ModelAdmin):
14
+ search_fields = ("title", "description")
15
+ raw_id_fields = ["import_source"]
16
+ autocomplete_fields = [
17
+ "source",
18
+ ]
19
+ list_display = ["title", "language", "tags", "source", "datetime"]
20
+
21
+ list_filter = ("source",)
22
+
23
+
24
+ @admin.register(NewsSource)
25
+ class NewsSourceAdmin(admin.ModelAdmin):
26
+ search_fields = ("type", "title", "identifier", "description", "author", "url")
27
+ list_filter = ("type",)
@@ -0,0 +1,9 @@
1
+ from django.apps import AppConfig
2
+ from django.utils.module_loading import autodiscover_modules
3
+
4
+
5
+ class NewConfig(AppConfig):
6
+ name = "wbnews"
7
+
8
+ def ready(self) -> None:
9
+ autodiscover_modules("news")
@@ -0,0 +1,33 @@
1
+ import factory
2
+ from django.conf.global_settings import LANGUAGES
3
+ from django.utils import timezone
4
+ from faker import Factory
5
+ from wbnews.models import News, NewsSource
6
+
7
+ langs = [n for (n, v) in LANGUAGES]
8
+ faker = Factory.create()
9
+
10
+
11
+ class NewsSourceFactory(factory.django.DjangoModelFactory):
12
+ title = factory.Sequence(lambda n: f"source_{n}")
13
+ identifier = factory.Sequence(lambda n: f"http://myurl_{n}.com")
14
+ image = faker.url()
15
+ description = factory.Faker("sentence", nb_words=32)
16
+ author = faker.name()
17
+ url = factory.Faker("url")
18
+
19
+ class Meta:
20
+ model = NewsSource
21
+
22
+
23
+ class NewsFactory(factory.django.DjangoModelFactory):
24
+ datetime = factory.LazyFunction(timezone.now)
25
+ title = factory.Sequence(lambda n: f"news_{n}")
26
+ description = factory.Faker("sentence", nb_words=32)
27
+ summary = factory.Faker("sentence", nb_words=32)
28
+ language = factory.Iterator(langs)
29
+ link = faker.url()
30
+ source = factory.SubFactory(NewsSourceFactory)
31
+
32
+ class Meta:
33
+ model = News