profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/django-parler/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
django-parler Multilingual models in Django

django-parler/django-parler 502

Easily translate "cheese omelet" into "omelette au fromage".

django-parler/django-parler-rest 41

Translatable model support for django-rest-framework

django-parler/django-categories-i18n 15

Translatable Categories model

PR opened django-parler/django-parler

runtests: Add dummy SECRET_KEY

Closes https://github.com/django-parler/django-parler/issues/296

+1 -1

0 comment

1 changed file

pr created time in a day

fork jayvdb/django-parler

Easily translate "cheese omelet" into "omelette au fromage".

fork in a day

starteddjango-parler/django-parler

started time in 12 days

starteddjango-parler/django-parler

started time in 13 days

fork ahoazure/django-parler

Easily translate "cheese omelet" into "omelette au fromage".

fork in 17 days

starteddjango-parler/django-parler

started time in 20 days

starteddjango-parler/django-parler

started time in 23 days

starteddjango-parler/django-parler

started time in a month

starteddjango-parler/django-parler

started time in a month

starteddjango-parler/django-parler

started time in a month

starteddjango-parler/django-parler

started time in a month

starteddjango-parler/django-parler

started time in a month

starteddjango-parler/django-parler

started time in a month

issue commentdjango-parler/django-parler-rest

"Input is not a valid dict" when posting to a model witl file attribute

Really helpful @crstian . I had the same issue and solved quickly with your solution !

GuillaumeCisco

comment created time in a month

starteddjango-parler/django-parler-rest

started time in a month

push eventdjango-parler/django-parler

Stefan Wehrmeyer

commit sha 55ccf463618af3db425e3d06ce8d63c26148de62

Remove reference to .min Django admin static files (#297) Django 3.2+ no longer ships with .min-ified files https://docs.djangoproject.com/en/3.2/releases/3.2/#id1

view details

push time in a month

PR merged django-parler/django-parler

Remove reference to .min Django admin static files

Django 3.2+ no longer ships with .min-ified files.

Checking Django version to keep serving .min-files to older Django versions seems more trouble than it's worth: the non-minified file is just 1.5 kb, gzipped via e.g. nginx 551 bytes.

+1 -1

0 comment

1 changed file

stefanw

pr closed time in a month

PullRequestReviewEvent

issue commentdjango-parler/django-parler-rest

OPTIONS request with TranslatedFieldsField

Hello,

After some work, I just created this class to show Options request but it doesn't work when translations field is in a nested serializer and I'm sure it contains some errors, so could be improved:

from collections import OrderedDict

from django.utils.encoding import force_str
from rest_framework.metadata import SimpleMetadata
from django.core.exceptions import PermissionDenied
from django.http import Http404
from rest_framework import exceptions, serializers
from rest_framework.request import clone_request
from parler.models import TranslatedFieldsModelBase


class Metadata(SimpleMetadata):

    def determine_actions(self, request, view):
        actions = {}
        for method in {'PUT', 'POST', 'GET'} & set(view.allowed_methods):
            view.request = clone_request(request, method)
            try:
                # Test global permissions
                if hasattr(view, 'check_permissions'):
                    view.check_permissions(view.request)
                # Test object permissions
                if method == 'PUT' and hasattr(view, 'get_object'):
                    view.get_object()
            except (exceptions.APIException, PermissionDenied, Http404):
                pass
            else:
                # If user has appropriate permissions for the view, include
                # appropriate metadata about the fields that should be supplied.
                serializer = view.get_serializer()
                actions[method] = self.get_serializer_info(serializer)

                if "translations" in serializer.fields:

                    translatable_fields = serializer.fields.get("translations").shared_model._parler_meta.get_all_fields()
                actions[method].pop("translations")
                for field in serializer.Meta.model._meta.get_fields():
                    if isinstance(field.related_model, TranslatedFieldsModelBase):
                        for related_field in field.related_model._meta.get_fields():

                            if related_field.column in translatable_fields:
                                actions[method].update({related_field.column: self.get_related_field_info(related_field)} )

            finally:
                view.request = request

        return actions
        #return super(Metadata, self).determine_actions(request, view)

    def get_related_field_info(self, field):
        """
        Given an instance of a serializer field, return a dictionary
        of metadata about it.
        """
        field_info = OrderedDict()
        serializer_field_mapping = (
            serializers.ModelSerializer.serializer_field_mapping.copy()
        )

        field_info['type'] = self.label_lookup.mapping[serializer_field_mapping[type(field)]]
        field_info['required'] = getattr(field, 'required', False)

        attrs = [
            'read_only', 'label', 'help_text',
            'min_length', 'max_length',
            'min_value', 'max_value', 'label'
        ]

        for attr in attrs:
            if attr is 'label':
                value = getattr(field, 'verbose_name', None)
            else:
                value = getattr(field, attr, None)
            if value is not None and value != '':
                field_info[attr] = force_str(value, strings_only=True)

        if getattr(field, 'child', None):
            field_info['child'] = self.get_field_info(field.child)
        elif getattr(field, 'fields', None):
            field_info['children'] = self.get_serializer_info(field)

        if field.choices:
            if (not field_info.get('read_only') and
                    not isinstance(field, (serializers.RelatedField, serializers.ManyRelatedField)) and
                    hasattr(field, 'choices')):
                field_info['choices'] = [
                    {
                        'value': choice_value,
                        'display_name': force_str(choice_name, strings_only=True)
                    }
                    for choice_value, choice_name in field.choices.items()
                ]

        return field_info

Any help is welcome Thank you in advance

MehdiDRI

comment created time in a month

issue closeddjango-parler/django-parler-rest

how to see infos from translations field in serializer with serializer.get_fields()

Hello

I'm wondering if there is any way to show description of each field in TranslatedFieldsField like in any other field with serializer.get_fields() Currently, serializer.get_fields() return : OrderedDict([('id', IntegerField(label='ID', read_only=True)), ('translations', TranslatedFieldsField(shared_model=<class 'dispute.models.Dispute'>)), ('file', FileField(allow_null=True, help_text='Here you can send a file if you want.', max_length=100, required=False)) ....

How to return the fields in translations with help_text, required, read_only, allow_blank, ....

Many thanks for your response

closed time in a month

MehdiDRI

PR opened django-parler/django-parler

Remove reference to .min Django admin static files

Django 3.2+ no longer ships with .min-ified files.

Checking Django version to keep serving .min-files to older Django versions seems more trouble than it's worth: the non-minified file is just 1.5 kb, gzipped via e.g. nginx 551 bytes.

+1 -1

0 comment

1 changed file

pr created time in a month

fork stefanw/django-parler

Easily translate "cheese omelet" into "omelette au fromage".

fork in a month

issue openeddjango-parler/django-parler

Django 3.2 tests failing due to missing SECRET_KEY

setings.SECRET_KEY is now required.

created time in a month

issue openeddjango-parler/django-parler-rest

OPTIONS request with TranslatedFieldsField

Hello,

Is there is any way to show all details of each field in TranslatedFieldsField in serializer in OPTIONS request ?

Currently, when calling OPTIONS request, I have :

{
    "name": "Dispute List",
    "description": "",
    "renders": [
        "application/json",
        "text/html"
    ],
    "parses": [
        "application/json",
        "application/x-www-form-urlencoded",
        "multipart/form-data"
    ],
    "actions": {
        "GET": {
            "id": {
                "type": "integer",
                "required": false,
                "read_only": true,
                "label": "ID"
            },
            "translations": {
                "type": "field",
                "required": true,
                "read_only": false,
                "label": "Translations"
            },
            "created_on": {
                "type": "datetime",
                "required": false,
                "read_only": true,
                "label": "Created on"
            }, .....

But I want also all the description of each field in 'translations' (TranslatedFieldsField)

Many thanks for your answers

created time in a month

issue openeddjango-parler/django-parler-rest

how to see infos from translations field in serializer with serializer.get_fields()

Hello

I'm wondering if there is any way to show description of each field in TranslatedFieldsField like in any other field with serializer.get_fields() Currently, serializer.get_fields() return : OrderedDict([('id', IntegerField(label='ID', read_only=True)), ('translations', TranslatedFieldsField(shared_model=<class 'dispute.models.Dispute'>)), ('file', FileField(allow_null=True, help_text='Here you can send a file if you want.', max_length=100, required=False)) ....

How to return the fields in translations with help_text, required, read_only, allow_blank, ....

Many thanks for your response

created time in a month

fork library-collections/django-parler

Easily translate "cheese omelet" into "omelette au fromage".

fork in a month

pull request commentdjango-parler/django-parler

Bump django from 2.2.13 to 2.2.24 in /docs/_ext/djangodummy

Codecov Report

Merging #295 (a9e7d0c) into master (00df992) will decrease coverage by 1.28%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #295      +/-   ##
==========================================
- Coverage   87.15%   85.87%   -1.29%     
==========================================
  Files          30       35       +5     
  Lines        1767     2718     +951     
==========================================
+ Hits         1540     2334     +794     
- Misses        227      384     +157     
Impacted Files Coverage Δ
example/article/__init__.py 100.00% <0.00%> (ø)
example/article/models.py 86.01% <0.00%> (ø)
example/article/views.py 65.51% <0.00%> (ø)
example/article/urls.py 100.00% <0.00%> (ø)
example/article/admin.py 85.66% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 00df992...a9e7d0c. Read the comment docs.

dependabot[bot]

comment created time in a month

delete branch django-parler/django-parler

delete branch : dependabot/pip/docs/_ext/djangodummy/django-2.2.22

delete time in a month

pull request commentdjango-parler/django-parler

Bump django from 2.2.13 to 2.2.22 in /docs/_ext/djangodummy

Superseded by #295.

dependabot[bot]

comment created time in a month

PR closed django-parler/django-parler

Bump django from 2.2.13 to 2.2.22 in /docs/_ext/djangodummy dependencies

Bumps django from 2.2.13 to 2.2.22. <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/django/django/commit/df9fd4661e203d41c189054d8b23d256815e14fc"><code>df9fd46</code></a> [2.2.x] Bumped version for 2.2.22 release.</li> <li><a href="https://github.com/django/django/commit/d9594c4ea57b6309d93879805302cec9ae9f23ff"><code>d9594c4</code></a> [2.2.x] Fixed <a href="https://github-redirect.dependabot.com/django/django/issues/32713">#32713</a>, Fixed CVE-2021-32052 -- Prevented newlines and tabs fro...</li> <li><a href="https://github.com/django/django/commit/163700388cda2305c8dbcdb3ac1542a442f3e955"><code>1637003</code></a> [2.2.x] Refs CVE-2021-31542 -- Skipped mock AWS storage test on Windows.</li> <li><a href="https://github.com/django/django/commit/bcafd9ba848d736769870b4fc940b2ebbf87a70a"><code>bcafd9b</code></a> [2.2.x] Added CVE-2021-31542 to security archive.</li> <li><a href="https://github.com/django/django/commit/3931dc765177b2793fe806b4a02122b1a718b1c3"><code>3931dc7</code></a> [2.2.x] Post-release version bump.</li> <li><a href="https://github.com/django/django/commit/ff1385ae45d267f455b1744fb39a9ab5de688d05"><code>ff1385a</code></a> [2.2.x] Bumped version for 2.2.21 release.</li> <li><a href="https://github.com/django/django/commit/04ac1624bdc2fa737188401757cf95ced122d26d"><code>04ac162</code></a> [2.2.x] Fixed CVE-2021-31542 -- Tightened path & file name sanitation in file...</li> <li><a href="https://github.com/django/django/commit/7f1b088ab4a4342a87a11496096471703994a006"><code>7f1b088</code></a> [2.2.x] Added CVE-2021-28658 to security archive.</li> <li><a href="https://github.com/django/django/commit/e95fbb6a7653a5f199d5d8c90a282cdf9e58fc22"><code>e95fbb6</code></a> [2.2.x] Post-release version bump.</li> <li><a href="https://github.com/django/django/commit/ad9fa56a17bf9691615e9bb6e41d08d51cfe8a5d"><code>ad9fa56</code></a> [2.2.x] Bumped version for 2.2.20 release.</li> <li>Additional commits viewable in <a href="https://github.com/django/django/compare/2.2.13...2.2.22">compare view</a></li> </ul> </details> <br />

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


<details> <summary>Dependabot commands and options</summary> <br />

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
  • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
  • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
  • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the Security Alerts page.

</details>

+1 -1

2 comments

1 changed file

dependabot[bot]

pr closed time in a month