Skip to content

Commit

Permalink
Rename module
Browse files Browse the repository at this point in the history
  • Loading branch information
nezhar committed Nov 15, 2021
1 parent 827d515 commit a583d78
Show file tree
Hide file tree
Showing 21 changed files with 27 additions and 62 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

[Unreleased]: https://github.com/anexia-it/django-attachments/compare/1.0.0...HEAD
[1.0.0]: https://github.com/anexia-it/django-attachments/releases/tag/1.0.0
[Unreleased]: https://github.com/anexia-it/drf-attachments/compare/1.0.0...HEAD
[1.0.0]: https://github.com/anexia-it/drf-attachments/releases/tag/1.0.0
32 changes: 1 addition & 31 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,4 @@ and patterns in the existing code-base.

### Contribution guidelines
- Your code should follow PEP 8 -- Style Guide for Python Code
- Your changes should be covered by unit-tests

## Setup local tests (venv)

After forking the repository you may create a `venv` to manage all dependencies required for running the tests:
```
python -m virtualenv venv
```

You can than enter the newly created `venv` and install all dependencies required for the tests:
```
user@computer: source venv/bin/activate
(venv) user@computer: pip install -r requirements.txt
(venv) user@computer: pip install -e .
```

A quick check via `pip freeze` should list all relevant dependency packages plus the `django-attachments`:
```
(venv) user@computer: pip freeze
Django==2.2.24
# Editable Git install with no remote (django-attachments==0.0.0)
-e /media/alex/INTENSO/ANX/pycharmWorkspace/django-attachments
python-magic==0.4.24
pytz==2021.3
sqlparse==0.4.2
```

Now you should be able to successfully run the tests provided in `/tests/`:
```
(venv) user@computer: python tests/manage.py test test tests/test/
```
- Your changes should be covered by unit-tests
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Django Attachments
# DRF Attachments

A django module to manage any model's file up-/downloads by relating an Attachment model to it.
Django rest framework module to manage any model's file up-/downloads by relating an Attachment model to it.

## Installation

Install using pip:

```
pip install git+https://github.com/anexia-it/django-attachments@main
pip install git+https://github.com/anexia-it/drf-attachments@main
```

Add model_prefix to your INSTALLED_APPS list. Make sure it is the first app in the list

```
INSTALLED_APPS = [
...
'django_attachments',
'drf_attachments',
...
]
```
Expand Down Expand Up @@ -114,7 +114,7 @@ To manage file uploads for any existing model you must create a one-to-many "att
5. Add attachment DRF route
```
from django_attachments.rest.views import AttachmentViewSet
from drf_attachments.rest.views import AttachmentViewSet

router = get_api_router()
router.register(r"attachment", AttachmentViewSet)
Expand Down
2 changes: 1 addition & 1 deletion django_attachments/admin.py → drf_attachments/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline

from django_attachments.models.models import Attachment
from drf_attachments.models.models import Attachment

__all__ = [
"AttachmentInlineAdmin",
Expand Down
4 changes: 2 additions & 2 deletions django_attachments/apps.py → drf_attachments/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ def create_global_permissions_for_app(sender, **kwargs):


class AttachmentsConfig(AppConfig):
name = "django_attachments"
name = "drf_attachments"
verbose_name = _("attachments")

def ready(self):
post_migrate.connect(create_global_permissions_for_app, sender=self)

# import signal handlers
import django_attachments.handlers
import drf_attachments.handlers
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.db.models.signals import post_delete
from django.dispatch import receiver

from django_attachments.models.models import Attachment
from drf_attachments.models.models import Attachment


@receiver(post_delete, sender=Attachment)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import django_attachments.models.models
import drf_attachments.models.models
import uuid


Expand All @@ -23,7 +23,7 @@ class Migration(migrations.Migration):
('name', models.CharField(blank=True, max_length=255, verbose_name='name')),
('context', models.CharField(blank=True, help_text="Additional info about the attachment's context/meaning.", max_length=255, verbose_name='context')),
('meta', django.contrib.postgres.fields.jsonb.JSONField(help_text='Additional info about the attachment (e.g. file meta data: mime_type, extension, size).', verbose_name='meta')),
('file', models.FileField(storage=django_attachments.models.models.AttachmentFileStorage(), upload_to=django_attachments.models.models.attachment_upload_path, verbose_name='file')),
('file', models.FileField(storage=drf_attachments.models.models.AttachmentFileStorage(), upload_to=drf_attachments.models.models.attachment_upload_path, verbose_name='file')),
('object_id', models.UUIDField()),
('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation date')),
('last_modification_date', models.DateTimeField(auto_now=True, verbose_name='Last modification date')),
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django_attachments.models.querysets import AttachmentQuerySet
from drf_attachments.models.querysets import AttachmentQuerySet
from django.db import models

__all__ = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import uuid
from uuid import uuid1

from django_attachments.models.managers import AttachmentManager
from django_attachments.uitls import get_mime_type, get_extension, remove
from drf_attachments.models.managers import AttachmentManager
from drf_attachments.uitls import get_mime_type, get_extension, remove
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
Expand Down Expand Up @@ -37,7 +37,7 @@ def attachment_upload_path(attachment, filename):
NOTE: DO NOT CHANGE THIS METHOD NAME (keep migrations sane).
If you ever have to rename/remove this method, you need to mock it (to simply return None) in every migration
that references to django_attachments.models.models.attachment_upload_path
that references to drf_attachments.models.models.attachment_upload_path
:param attachment:
:param filename:
:return:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"AttachmentSubSerializer",
]

from django_attachments.models.models import Attachment
from drf_attachments.models.models import Attachment


def get_content_object_field():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from rest_framework import viewsets

from django_attachments.models.models import Attachment
from django_attachments.rest.renderers import FileDownloadRenderer
from django_attachments.rest.serializers import AttachmentSerializer
from drf_attachments.models.models import Attachment
from drf_attachments.rest.renderers import FileDownloadRenderer
from drf_attachments.rest.serializers import AttachmentSerializer
from django_filters.rest_framework import DjangoFilterBackend
from django.http import FileResponse
from rest_framework.decorators import action, parser_classes
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))

setup(
name='django-attachments',
name='drf-attachments',
version=os.getenv('PACKAGE_VERSION', '0.0.0').replace('refs/tags/', ''),
packages=find_packages(),
include_package_data=True,
license='MIT License',
description='A django module to manage any model\'s file up-/downloads by relating an Attachment model to it.',
long_description=README,
long_description_content_type='text/markdown',
url='https://github.com/anexia-it/django-attachments',
url='https://github.com/anexia-it/drf-attachments',
author='Alexandra Bruckner',
author_email='[email protected]',
install_requires=[
Expand Down
8 changes: 3 additions & 5 deletions tests/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Django settings for "tests" project which assures the functionality of the "django-attachments" package
(https://github.com/anexia-it/django-attachments).
Django settings for "tests" project which assures the functionality of the "drf-attachments" package
(https://github.com/anexia-it/drf-attachments).
"""

import os
Expand Down Expand Up @@ -30,9 +30,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

# include django-attachments
'django_attachments',
'drf_attachments',
]

MIDDLEWARE = [
Expand Down

0 comments on commit a583d78

Please sign in to comment.