Custom Query (27370 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (19 - 21 of 27370)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Ticket Resolution Summary Owner Reporter
#29488 wontfix FilteredSelectMultiple Controls Don't Work if The Name of the Widget Has a Space nobody Mark Phillips
Description

If the label for the FilteredSelectMultiple has a space in it, the controls for moving data between the boxes are not activated. The widget still works if one double clicks on the elements in the left box, they move to the right box. But the arrows don't work. Tested on Chrome 67.0.3396.62 (Official Build) (64-bit) and Firefox 60.0.1 (64-bit) using runserver to run my django code.

Take a look at the attached image first.png. There are two FilteredSelectMultiple widgets, one called Pets and one called Pet Names. Note that in the widget Pet Names, the controls are not highlighted, but the controls in the Pets widget are highlighted.

Take a look at the attached image second.png. The only change to the code was to change the Pet Names label to Pet_Names (ie replaced the space between Pet and Names with an underscore Pet Names -> Pet_Names). Now the controls are working.

Mark

#29487 fixed Admin "read only" doesn't check change permission for object specifically Paulo Matthew Frazier
Description

When determining which fields are read-only, ModelAdmin._changeform_view calls ModelAdmin.has_change_permission(request) without the object parameter - so, even if the user has read-only permission, only fields returned by get_readonly_fields() are included. However, subsequent calls to has_change_permission to build the form do use the object parameter - so, all fields are left out of the form, with the assumption that they are included in get_readonly_fields(). This leads to a traceback when rendering the template, since none of the fields are present in the form. (The traceback is included below.)

Changing has_change_permission(request) to has_change_permission(request, obj) on line 1580 of django/contrib/admin/options.py resolves the issue.

Request Method: GET
Request URL: http://localhost:8000/admin/.../.../.../change/

Django Version: 2.1a1
Python Version: 3.6.5

Template error:
In template .../django/contrib/admin/templates/admin/includes/fieldset.html, error at line 7
   Key 'full_name' not found in 'UserForm'. Choices are: .
   1 : <fieldset class="module aligned {{ fieldset.classes }}">
   2 :     {% if fieldset.name %}<h2>{{ fieldset.name }}</h2>{% endif %}
   3 :     {% if fieldset.description %}
   4 :         <div class="description">{{ fieldset.description|safe }}</div>
   5 :     {% endif %}
   6 :     {% for line in fieldset %}
   7 :         <div class="form-row{% if line.fields|length_is:'1' and line.errors %} errors{% endif %}{% if not line.has_visible_field %} hidden{% endif %} {% for field in line %} {% if field.field.name %} field-{{ field.field.name }}{% endif %}{% endfor %}">
   8 :             {% if line.fields|length_is:'1' %}{{ line.errors }}{% endif %}
   9 :             {% for field in line %}
   10 :                 <div{% if not line.fields|length_is:'1' %} class="fieldBox{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% if not field.is_readonly and field.errors %} errors{% endif %}{% if field.field.is_hidden %} hidden{% endif %}"{% elif field.is_checkbox %} class="checkbox-row"{% endif %}>
   11 :                     {% if not line.fields|length_is:'1' and not field.is_readonly %}{{ field.errors }}{% endif %}
   12 :                     {% if field.is_checkbox %}
   13 :                         {{ field.field }}{{ field.label_tag }}
   14 :                     {% else %}
   15 :                         {{ field.label_tag }}
   16 :                         {% if field.is_readonly %}
   17 :                             <div class="readonly">{{ field.contents }}</div>


Traceback:

File ".../django/forms/forms.py" in __getitem__
  163.             field = self.fields[name]

During handling of the above exception ('full_name'), another exception occurred:

...

File ".../django/template/base.py" in render_annotated
  904.             return self.render(context)

File ".../django/template/defaulttags.py" in render
  165.                 values = list(values)

File ".../django/contrib/admin/helpers.py" in __iter__
  118.                 yield AdminField(self.form, field, is_first=(i == 0))

File ".../django/contrib/admin/helpers.py" in __init__
  130.         self.field = form[field]  # A django.forms.BoundField instance

File ".../django/forms/forms.py" in __getitem__
  169.                     ', '.join(sorted(f for f in self.fields)),

Exception Type: KeyError
Exception Value: "Key 'full_name' not found in 'UserForm'. Choices are: ."
#29486 needsinfo Odd behaviour with ForeignKey to non-integer field since Django 2.0.5 with PostgreSQL nobody Henrik Ossipoff Hansen
Description

I was upgrading one of our projects from 1.11.x to the newest Django 2.0.x when encountering a rather odd thing - all of our tests were literally failing with seemingly a database error:

django.db.utils.DataError: value "1111222233334444" is out of range for type integer

The field, however, is not an integer field, but rather a char field - so that particular string shouldn't be of any problem - and the fact that it appears to report back being an integer field is rather bizarre.

While I know that this error returned is simply a psycopg2.DataError in disguise, it turns out that this error seem to have been introduced in 2.0.5 specifically - all of our tests passes in 2.0.4.

The slight problem here is that I've been unable to reproduce a minimal working example that can reproduce the error, even though it's really consistent for us.

Our models look something like this (simplified):

class Giftcard(Model):
    STATUS_CREATED = 'CREATED'
    STATUS_ACTIVATED = 'ACTIVATED'
    STATUS_SUSPENDED = 'SUSPENDED'
    STATUS_EXPIRED = 'EXPIRED'
    STATUS_CLOSED = 'CLOSED'

    STATUS_CHOICE = (
        (STATUS_CREATED, 'Created'),
        (STATUS_ACTIVATED, 'Activated'),
        (STATUS_SUSPENDED, 'Suspended'),
        (STATUS_EXPIRED, 'Expired'),
        (STATUS_CLOSED, 'Closed'),
    )

    code = models.CharField(max_length=16, primary_key=True)
    status = models.CharField(max_length=20, choices=STATUS_CHOICE, default=STATUS_CREATED, db_index=True)

    def status_change(self, reason, to):
        StatusChangeLog.objects.create(giftcard=self, reason=reason, from_status=self.status, to_status=to)

class StatusChangeLog(Model):
    giftcard = models.ForeignKey('giftcards.Giftcard', related_name='status_logs', on_delete=models.PROTECT)
    reason = models.TextField(blank=True, default='')
    from_status = models.CharField(max_length=20, choices=Giftcard.STATUS_CHOICE)
    to_status = models.CharField(max_length=20, choices=Giftcard.STATUS_CHOICE)

When the Giftcard model is instantiated with a code of "1111222233334444" (as a string), saved, and then the status_change method is called, the above exception occurs.

I've been through some of code that went into 2.0.5, but I'm not well enough into the inner workings of Django know exactly what caused this - I just know that this behaviour wasn't in 1.11.x, and also wasn't in 2.0.4.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Note: See TracQuery for help on using queries.
Back to Top