{"id": 8176, "created": "2008-08-09 01:04:22", "changetime": "2011-09-28 16:12:17", "last_pulled_from_trac": "2022-03-06 03:41:33.750216", "stage": "Accepted", "status": "closed", "component": "Translations", "type": null, "severity": null, "version": "dev", "resolution": "fixed", "summary": "New django.po for Japanese language.", "description": "I translated django.po against svn rev 8255.", "owner": "nobody", "reporter": "Takashi Matsuo ", "keywords": null, "easy": 0, "has_patch": 0, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8177, "created": "2008-08-09 01:31:38", "changetime": "2011-09-28 16:12:17", "last_pulled_from_trac": "2022-03-06 03:41:33.946180", "stage": "Accepted", "status": "closed", "component": "Core (Other)", "type": null, "severity": null, "version": "dev", "resolution": "fixed", "summary": "reverse() should report the reverse lookup that fails.", "description": "Now that {% url foo %} does not fail silently any more, it's really important to report which reverse lookup failed.\r\n\r\nCompare:\r\n{{{\r\nBefore the attached patch:\r\n--------------------------\r\nDjango version 1.0-alpha_2-SVN-8255, using settings 'trunk.settings'\r\nDevelopment server is running at http://127.0.0.1:8000/\r\nQuit the server with CONTROL-C.\r\nTraceback (most recent call last):\r\n...\r\n File \"/usr/lib/python2.5/site-packages/django/core/urlresolvers.py\", line 291, in reverse\r\n raise NoReverseMatch\r\nNoReverseMatch\r\n\r\nAfter the attached patch:\r\n--------------------------\r\nDjango version 1.0-alpha_2-SVN-8255, using settings 'trunk.settings'\r\nDevelopment server is running at http://127.0.0.1:8000/\r\nQuit the server with CONTROL-C.\r\nTraceback (most recent call last):\r\n...\r\n File \"/usr/lib/python2.5/site-packages/django/core/urlresolvers.py\", line 291, in reverse\r\n raise NoReverseMatch(\"Reverse for '%s' not found.\" % lookup_view)\r\n\r\nNoReverseMatch: Reverse for 'foo-bar' not found.\r\n}}}\r\n\r\nRun a `rgrep foo-bar .` and you find the offending place easily.", "owner": "nobody", "reporter": "mrts", "keywords": "reverse", "easy": 0, "has_patch": 1, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8179, "created": "2008-08-09 03:26:20", "changetime": "2008-09-09 11:29:30", "last_pulled_from_trac": "2022-03-06 03:41:34.249089", "stage": "Accepted", "status": "closed", "component": "Documentation", "type": null, "severity": null, "version": "dev", "resolution": "fixed", "summary": "most cross-references in sphinx-generated HTML are wrong", "description": "to reproduce (an example)\r\n * generate the sphinx html documentation using make html in the django_trunk/docs directory\r\n * (eg) open {{{_build/html/install.html}}} in a browser. The link 'How to use Django with mod_python' (in the ''Install Apache and mod_python'' section) points to a modpython '''directory''' in the directory '''above''' the original directory, instead of modpython'''.html''' at the same level as the original file\r\n\r\nThe reason is that the references are not in the form suggested by the sphinx documentation (http://sphinx.pocoo.org/markup/inline.html#cross-referencing-syntax). \r\n\r\nA quick grep indicates there are about 320 instances of the wrong links across 56 of the .txt files. \r\n\r\nI'd be happy to claim this ticket, but it seems like there's be a great option for merge conflicts with that many files. Any suggestions? feel free to contact me at nic \\at\\ tymar \\dot\\ com if there's an easy way of avoiding conflicts", "owner": "nobody", "reporter": "niccl", "keywords": null, "easy": 0, "has_patch": 0, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8181, "created": "2008-08-09 06:33:39", "changetime": "2011-09-28 16:12:17", "last_pulled_from_trac": "2022-03-06 03:41:34.553760", "stage": "Accepted", "status": "closed", "component": "Documentation", "type": null, "severity": null, "version": "dev", "resolution": "duplicate", "summary": "Documentation error leads to 'model already registered exceptions'", "description": "The documentation says to add admin model registration to the end of the models.py file. Because this file may be imported more than once, this causes a 'model _____ already registered exception'. The solution is to use autodiscover (as suggested in the documentation) but to place the model registration in the file admin.py.\r\n\r\nSee http://groups.google.com/group/django-users/browse_thread/thread/8af97d45102ee2f2 .", "owner": "nobody", "reporter": "Marc", "keywords": null, "easy": null, "has_patch": 0, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": null} {"id": 8184, "created": "2008-08-09 10:38:24", "changetime": "2008-10-06 08:47:01", "last_pulled_from_trac": "2022-03-06 03:41:35.039350", "stage": "Accepted", "status": "closed", "component": "Documentation", "type": null, "severity": null, "version": "dev", "resolution": "fixed", "summary": "urlresolver doc", "description": "I think this nice comment from the mailing list should be added to the reverse() function doc\r\n\r\nThe urlresolvers.reverse function throws an exception if *any* of your \r\nURLs anywhere in the project have a bad view and not necessarily the \r\none you are trying to reverse map. So, check that you don't have any \r\nURL mappings with undefined view functions (or views with syntax \r\nerrors). \r\n", "owner": "nobody", "reporter": "hvendelbo", "keywords": null, "easy": 0, "has_patch": 0, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8190, "created": "2008-08-09 16:14:36", "changetime": "2011-09-28 16:12:30", "last_pulled_from_trac": "2022-03-06 03:41:36.120121", "stage": "Accepted", "status": "closed", "component": "contrib.admin", "type": "New feature", "severity": "Normal", "version": "dev", "resolution": "fixed", "summary": "Utilise help_text for TabularInline in Admin", "description": "When using !TabularInline in the automatic admin interface the help_text for fields is not displayed anywhere.\r\n\r\nI suggest that the information could be displayed as a tooltip on the column heading, like so:\r\n\r\n{{{\r\n{{ field.label|capfirst|escape }}\r\n}}}\r\nbecomes \r\n{{{\r\n\r\n {{ field.label|capfirst|escape }}\r\n {% if field.help_text %}?{% endif %}\r\n\r\n}}}\r\n\r\nand then in the CSS:\r\n{{{\r\n.help-text-tooltip { cursor: help; }\r\n}}}", "owner": "dArignac", "reporter": "glenjamin", "keywords": null, "easy": 0, "has_patch": 1, "needs_better_patch": 1, "needs_tests": 0, "needs_docs": 0, "ui_ux": 1} {"id": 8191, "created": "2008-08-09 16:16:52", "changetime": "2011-09-28 16:12:17", "last_pulled_from_trac": "2022-03-06 03:41:36.320809", "stage": "Accepted", "status": "closed", "component": "Database layer (models, ORM)", "type": null, "severity": null, "version": "dev", "resolution": "fixed", "summary": "Queryset improvements for extra() calls", "description": "There are a few related problems in calling the `extra()` on querysets related to it handles parameters for the `extra_select` parameter. Currently they\r\n\r\n * don't merge correctly\r\n * aren't removed correctly\r\n * don't handle updates correctly.\r\n\r\nAll of these involve the same dozen lines of code, so I'm making this the tracking ticket for the three problems.\r\n\r\nI'm working on patch that incorporates mullendr's diagnoses and ideas from #7957 and #7961. It doesn't quite work to address them individually at the moment.", "owner": "mtredinnick", "reporter": "mtredinnick", "keywords": null, "easy": 0, "has_patch": 0, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8193, "created": "2008-08-09 19:11:08", "changetime": "2011-09-28 16:12:21", "last_pulled_from_trac": "2022-03-06 03:41:36.700006", "stage": "Accepted", "status": "closed", "component": "Uncategorized", "type": null, "severity": null, "version": "dev", "resolution": "fixed", "summary": "`__import__(mod, {}, {}, [''])` causes double import of modules ('module' and 'module' + '.')", "description": "As discussed at http://groups.google.com/group/django-developers/browse_thread/thread/d27261561bc36d96\r\nand http://bugs.python.org/issue2090, dynamically loaded modules with `fromlist=['']` are initialized twice (as `'module'` and `'module.'`).", "owner": "jacob", "reporter": "i_i", "keywords": "import", "easy": 0, "has_patch": 1, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8194, "created": "2008-08-09 19:46:11", "changetime": "2011-09-28 16:12:17", "last_pulled_from_trac": "2022-03-06 03:41:36.889018", "stage": "Accepted", "status": "closed", "component": "contrib.admin", "type": null, "severity": null, "version": "dev", "resolution": "fixed", "summary": "Admin form keyboard focus does not respect fields or fieldsets options", "description": "When you re-order the fields in an admin add form using the `fields` or `fieldsets` options in your `ModelAdmin` class, the initial keyboard focus in the admin add/change form does not respect it.\r\n\r\nThe keyboard focus is set by a !JavaScript call to `document.getElementById(\"id_foo\").focus()`, where the ID is specified in the `change_form.html` template as `{{adminform.first_field.auto_id}}`. So an underlying issue is that `AdminForm.first_field()` (in `contrib/admin/options.py`) does not respect the re-ordering. I am experiencing this using the current Subversion HEAD, revision 8272.\r\n\r\nFor example, consider this simple model in `models.py`:\r\n{{{\r\nclass MyModel(models.Model):\r\n foo = models.CharField(max_length=255)\r\n bar = models.CharField(max_length=255)\r\n}}}\r\nand this simple admin configuration in `admin.py`:\r\n{{{\r\nclass MyModelAdmin(admin.ModelAdmin):\r\n fields = ('bar', 'foo')\r\n\r\nadmin.site.register(MyModel,MyModelAdmin)\r\n}}}\r\nThen try to add a new !MyModel object using the admin interface, and notice that they keyboard focus starts out at the bottom rather than the top of the form.", "owner": "nobody", "reporter": "mdhancher", "keywords": "newforms-admin", "easy": 0, "has_patch": 1, "needs_better_patch": 1, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8196, "created": "2008-08-09 20:36:27", "changetime": "2008-09-02 03:07:27", "last_pulled_from_trac": "2022-03-06 03:41:37.241084", "stage": "Accepted", "status": "closed", "component": "Testing framework", "type": null, "severity": null, "version": "dev", "resolution": "fixed", "summary": "modeltests/model_forms tests fail on a system without PIL installed", "description": "This is the output (Linux + Python 2.4.4):\r\n\r\n{{{\r\n======================================================================\r\nFAIL: Doctest: modeltests.model_forms.models.__test__.API_TESTS\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n File \"/home/ramiro/hg-repos/django/trunk/django/test/_doctest.py\", line 2180, in runTest\r\n raise self.failureException(self.format_failure(new.getvalue()))\r\nAssertionError: Failed doctest test for modeltests.model_forms.models.__test__.API_TESTS\r\n File \"/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py\", line unknown line number, in API_TESTS\r\n\r\n----------------------------------------------------------------------\r\nFile \"/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py\", line ?, in modeltests.model_forms.models.__test__.API_TESTS\r\nFailed example:\r\n instance.image\r\nExpected:\r\n \r\nGot:\r\n \r\n----------------------------------------------------------------------\r\nFile \"/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py\", line ?, in modeltests.model_forms.models.__test__.API_TESTS\r\nFailed example:\r\n instance.image\r\nExpected:\r\n \r\nGot:\r\n \r\n----------------------------------------------------------------------\r\nFile \"/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py\", line ?, in modeltests.model_forms.models.__test__.API_TESTS\r\nFailed example:\r\n f.cleaned_data['image']\r\nExpected:\r\n \r\nGot:\r\n \r\n----------------------------------------------------------------------\r\nFile \"/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py\", line ?, in modeltests.model_forms.models.__test__.API_TESTS\r\nFailed example:\r\n instance.image\r\nExpected:\r\n \r\nGot:\r\n \r\n----------------------------------------------------------------------\r\nFile \"/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py\", line ?, in modeltests.model_forms.models.__test__.API_TESTS\r\nFailed example:\r\n instance.image\r\nExpected:\r\n \r\nGot:\r\n \r\n----------------------------------------------------------------------\r\nFile \"/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py\", line ?, in modeltests.model_forms.models.__test__.API_TESTS\r\nFailed example:\r\n instance.image\r\nExpected:\r\n \r\nGot:\r\n \r\n----------------------------------------------------------------------\r\nFile \"/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py\", line ?, in modeltests.model_forms.models.__test__.API_TESTS\r\nFailed example:\r\n instance.image\r\nExpected:\r\n \r\nGot:\r\n \r\n----------------------------------------------------------------------\r\nFile \"/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py\", line ?, in modeltests.model_forms.models.__test__.API_TESTS\r\nFailed example:\r\n instance.image\r\nExpected:\r\n \r\nGot:\r\n \r\n----------------------------------------------------------------------\r\nFile \"/home/ramiro/hg-repos/django/trunk/tests/modeltests/model_forms/models.py\", line ?, in modeltests.model_forms.models.__test__.API_TESTS\r\nFailed example:\r\n instance.image\r\nExpected:\r\n \r\nGot:\r\n \r\n}}}\r\n\r\nAlso tested on a Windows system + Python 2.5.2 (see http://dpaste.com/70381/)\r\n", "owner": "Gulopine", "reporter": "ramiro", "keywords": null, "easy": 0, "has_patch": 1, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8197, "created": "2008-08-09 21:40:03", "changetime": "2008-08-24 17:02:27", "last_pulled_from_trac": "2022-03-06 03:41:37.404193", "stage": "Accepted", "status": "closed", "component": "contrib.localflavor", "type": null, "severity": null, "version": "dev", "resolution": "wontfix", "summary": "Update Polish administrative entites", "description": "Attached file contains a list of Polish administrative entites from a [http://isip.sejm.gov.pl/servlet/Search?todo=open&id=WDU19981571031 official government source].", "owner": "nobody", "reporter": "Piotr Lewandowski ", "keywords": null, "easy": 0, "has_patch": 0, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8198, "created": "2008-08-09 22:35:20", "changetime": "2011-09-28 16:12:17", "last_pulled_from_trac": "2022-03-06 03:41:37.570396", "stage": "Accepted", "status": "closed", "component": "Core (Other)", "type": null, "severity": null, "version": "dev", "resolution": "duplicate", "summary": "Append slash broken when SCRIPT_NAME is present", "description": "Since updating to trunk (r8273), the \"append slash to url\" functionality of CommonMiddleware no longer works.", "owner": "nobody", "reporter": "brooks.travis@gmail.com", "keywords": "middleware", "easy": 0, "has_patch": 1, "needs_better_patch": 1, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8178, "created": "2008-08-09 02:47:11", "changetime": "2011-09-28 16:12:17", "last_pulled_from_trac": "2022-03-06 03:41:34.113947", "stage": "Ready for checkin", "status": "closed", "component": "Uncategorized", "type": null, "severity": null, "version": "dev", "resolution": "fixed", "summary": "Insert linebreaks in debug summary", "description": "When exceptions are raised, in particular in templates (e.g. with URL tag not matching a view), you get a big chunk of traceback info in the debug summary which is hard to read. Inserting linebreaks helps a lot. Patch attached.\r\n\r\nBefore:\r\n\r\n{{{\r\nCaught an exception while rendering: Original Traceback (most recent call last): File \"E:\\Software\\workspace\\django\\django\\template\\debug.py\", line 71, in render_node result = node.render(context) File \"E:\\Software\\workspace\\django-treemenus\\trunk\\treemenus\\templatetags\\tree_menu_tags.py\", line 46, in render return urlNode.render(context) File \"E:\\Software\\workspace\\django\\django\\template\\defaulttags.py\", line 369, in render args=args, kwargs=kwargs) File \"E:\\Software\\workspace\\django\\django\\core\\urlresolvers.py\", line 307, in reverse *args, **kwargs))) File \"E:\\Software\\workspace\\django\\django\\core\\urlresolvers.py\", line 291, in reverse raise NoReverseMatch NoReverseMatch \r\n}}}\r\n\r\n\r\nAfter:\r\n\r\n{{{\r\nCaught an exception while rendering:\r\n\r\nOriginal Traceback (most recent call last):\r\nFile \"E:\\Software\\workspace\\django\\django\\template\\debug.py\", line 71, in render_node\r\nresult = node.render(context)\r\nFile \"E:\\Software\\workspace\\django-treemenus\\trunk\\treemenus\\templatetags\\tree_menu_tags.py\", line 46, in render\r\nreturn urlNode.render(context)\r\nFile \"E:\\Software\\workspace\\django\\django\\template\\defaulttags.py\", line 369, in render\r\nargs=args, kwargs=kwargs)\r\nFile \"E:\\Software\\workspace\\django\\django\\core\\urlresolvers.py\", line 307, in reverse\r\n*args, **kwargs)))\r\nFile \"E:\\Software\\workspace\\django\\django\\core\\urlresolvers.py\", line 291, in reverse\r\nraise NoReverseMatch\r\nNoReverseMatch\r\n}}}", "owner": "nobody", "reporter": "julien", "keywords": null, "easy": 0, "has_patch": 1, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8186, "created": "2008-08-09 13:00:50", "changetime": "2011-09-28 16:12:17", "last_pulled_from_trac": "2022-03-06 03:41:35.326267", "stage": "Ready for checkin", "status": "closed", "component": "Translations", "type": null, "severity": null, "version": "dev", "resolution": "fixed", "summary": "Updated German translation", "description": "Some improvements to the German translations.", "owner": "jezdez", "reporter": "benjixx", "keywords": null, "easy": 0, "has_patch": 1, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8189, "created": "2008-08-09 15:09:13", "changetime": "2011-09-28 16:12:17", "last_pulled_from_trac": "2022-03-06 03:41:35.915106", "stage": "Ready for checkin", "status": "closed", "component": "Documentation", "type": null, "severity": null, "version": "dev", "resolution": "fixed", "summary": "FileField documentation still mentions get__url", "description": "model-api.txt still reads:\r\n\r\n{{{\r\nAll that will be stored in your database is a path to the file (relative to MEDIA_ROOT). You\u2019ll most likely want to use the convenience get__url function provided by Django. For example, if your ImageField is called mug_shot, you can get the absolute URL to your image in a template with {{ object.get_mug_shot_url }}.\r\n}}}\r\n\r\nwhere it should mentions object..url", "owner": "jacob", "reporter": "gogna", "keywords": null, "easy": 0, "has_patch": 1, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8180, "created": "2008-08-09 06:17:44", "changetime": "2008-08-09 14:17:55", "last_pulled_from_trac": "2022-03-06 03:41:34.396113", "stage": "Unreviewed", "status": "closed", "component": "Documentation", "type": null, "severity": null, "version": "dev", "resolution": "fixed", "summary": "Typo in docs/files.txt", "description": "The new file storage docs contain a typo. When explaining the default file storage class it mentions that 'location' is the argument that determines where the files will actually end up, while in the code example it uses 'base_url' argument.", "owner": "nobody", "reporter": "johann", "keywords": null, "easy": 0, "has_patch": 1, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8182, "created": "2008-08-09 07:33:40", "changetime": "2011-09-28 16:12:16", "last_pulled_from_trac": "2022-03-06 03:41:34.691349", "stage": "Unreviewed", "status": "closed", "component": "contrib.auth", "type": null, "severity": null, "version": "dev", "resolution": "fixed", "summary": "infinite loop iterating over context_processors.PermWrapper", "description": "The template code below will cause an infinite memory-eating loop if context_processors.auth is enabled. My main issue with that is that it was incredibly hard to debug for me, when I passed my own 'perms' queryset to a template. So here's a (temporary) patch, to make it at least immediately fail.\r\n\r\n{{{\r\n{% for perm in perms %}\r\n{% endfor %}\r\n}}}\r\n\r\n", "owner": null, "reporter": "Uz", "keywords": null, "easy": 0, "has_patch": 1, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8183, "created": "2008-08-09 08:32:50", "changetime": "2008-08-09 14:15:18", "last_pulled_from_trac": "2022-03-06 03:41:34.838928", "stage": "Unreviewed", "status": "closed", "component": "Uncategorized", "type": null, "severity": null, "version": "dev", "resolution": "fixed", "summary": "Main Documention page have no link to new page \"files/\"", "description": "When I read the 1.0 alpha 2 release notes I noticed that[[BR]]\r\nthe referenced doc page in \"Pluggable file storage\" section[[BR]]\r\ndidn't existed on main Documention page.[[BR]]\r\n\r\nNo refences to: http://www.djangoproject.com/documentation/files/ [[BR]]\r\nin: http://www.djangoproject.com/documentation/", "owner": "nobody", "reporter": "ClaesBas", "keywords": null, "easy": 0, "has_patch": 0, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8185, "created": "2008-08-09 12:49:05", "changetime": "2008-08-09 13:36:01", "last_pulled_from_trac": "2022-03-06 03:41:35.169659", "stage": "Unreviewed", "status": "closed", "component": "Documentation", "type": null, "severity": null, "version": "dev", "resolution": "duplicate", "summary": "A picture in documentation is in wrong format", "description": "In the tutorial, \"Writing your first Django app, part 2\" (http://www.djangoproject.com/documentation/tutorial02/), the picture of the Django admin login screen (http://media.djangoproject.com/img/doc/tutorial-trunk/admin01.png) is in the PSD or PS format while it should be PNG.", "owner": "nobody", "reporter": "katremer", "keywords": null, "easy": 0, "has_patch": 0, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8187, "created": "2008-08-09 13:44:44", "changetime": "2008-11-03 08:01:53", "last_pulled_from_trac": "2022-03-06 03:41:35.518577", "stage": "Unreviewed", "status": "closed", "component": "Uncategorized", "type": null, "severity": null, "version": "dev", "resolution": "fixed", "summary": "Import PIL consistently and with exception handling, list as optional dependency in INSTALL", "description": "Some projects import PIL, some Imaging intending to reach the same code depending on how PIL was installed. Django appears to use the second form in at least one spot.\r\n\r\nSome imports handle ImportError exceptions, some don't.\r\n\r\nPIL is not mentioned in the INSTALL document.\r\n{{{\r\n$ ack -B 4 -A 4 'PIL|Imaging'\r\ndjango/forms/fields.py\r\n472-\r\n473- def clean(self, data, initial=None):\r\n474- \"\"\"\r\n475- Checks that the file-upload field data contains a valid image (GIF, JPG,\r\n476: PNG, possibly others -- whatever the Python Imaging Library supports).\r\n477- \"\"\"\r\n478- f = super(ImageField, self).clean(data, initial)\r\n479- if f is None:\r\n480- return None\r\n481- elif not data and initial:\r\n482- return initial\r\n483: from PIL import Image\r\n484-\r\n485: # We need to get a file object for PIL. We might have a path or we might\r\n486- # have to read the data into memory.\r\n487- if hasattr(data, 'temporary_file_path'):\r\n488- file = data.temporary_file_path()\r\n489- else:\r\n--\r\n507- # but it must be called immediately after the constructor\r\n508- trial_image = Image.open(file)\r\n509- trial_image.verify()\r\n510- except ImportError: \r\n511: # Under PyPy, it is possible to import PIL. However, the underlying\r\n512- # _imaging C module isn't available, so an ImportError will be \r\n513- # raised. Catch and re-raise. \r\n514- raise\r\n515: except Exception: # Python Imaging Library doesn't recognize it as an image\r\n516- raise ValidationError(self.error_messages['invalid_image'])\r\n517- if hasattr(f, 'seek') and callable(f.seek):\r\n518- f.seek(0)\r\n519- return f\r\n\r\ndjango/core/files/images.py\r\n1-\"\"\"\r\n2-Utility functions for handling images.\r\n3-\r\n4:Requires PIL, as you might imagine.\r\n5-\"\"\"\r\n6-\r\n7-from django.core.files import File\r\n8-\r\n--\r\n25- return self._dimensions_cache\r\n26-\r\n27-def get_image_dimensions(file_or_path):\r\n28- \"\"\"Returns the (width, height) of an image, given an open file or a path.\"\"\"\r\n29: from PIL import ImageFile as PILImageFile\r\n30: p = PILImageFile.Parser()\r\n31- if hasattr(file_or_path, 'read'):\r\n32- file = file_or_path\r\n33- else:\r\n34- file = open(file_or_path, 'rb')\r\n\r\ndjango/core/validators.py\r\n167-\r\n168-def isValidImage(field_data, all_data):\r\n169- \"\"\"\r\n170- Checks that the file-upload field data contains a valid image (GIF, JPG,\r\n171: PNG, possibly others -- whatever the Python Imaging Library supports).\r\n172- \"\"\"\r\n173: from PIL import Image\r\n174- from cStringIO import StringIO\r\n175- try:\r\n176- content = field_data.read()\r\n177- except TypeError:\r\n--\r\n184- # verify() is the only method that can spot a corrupt PNG,\r\n185- # but it must be called immediately after the constructor\r\n186- trial_image = Image.open(StringIO(content))\r\n187- trial_image.verify()\r\n188: except Exception: # Python Imaging Library doesn't recognize it as an image\r\n189- raise ValidationError, _(\"Upload a valid image. The file you uploaded was either not an image or a corrupted image.\")\r\n190-\r\n191-def isValidImageURL(field_data, all_data):\r\n192- uc = URLMimeTypeCheck(('image/jpeg', 'image/gif', 'image/png'))\r\n\r\ndjango/core/management/validation.py\r\n47- if isinstance(f, models.FileField) and not f.upload_to:\r\n48- e.add(opts, '\"%s\": FileFields require an \"upload_to\" attribute.' % f.name)\r\n49- if isinstance(f, models.ImageField):\r\n50- try:\r\n51: from PIL import Image\r\n52- except ImportError:\r\n53: e.add(opts, '\"%s\": To use ImageFields, you need to install the Python Imaging Library. Get it at http://www.pythonware.com/products/pil/ .' % f.name)\r\n54- if f.choices:\r\n55- if isinstance(f.choices, basestring) or not is_iterable(f.choices):\r\n56- e.add(opts, '\"%s\": \"choices\" should be iterable (e.g., a tuple or list).' % f.name)\r\n57- else:\r\n\r\ntests/regressiontests/file_storage/models.py\r\n6-\r\n7-temp_storage = FileSystemStorage(tempfile.gettempdir())\r\n8-\r\n9-# Test for correct behavior of width_field/height_field.\r\n10:# Of course, we can't run this without PIL.\r\n11-\r\n12-try:\r\n13- # Checking for the existence of Image is enough for CPython, but\r\n14- # for PyPy, you need to check for the underlying modules\r\n15- import Image, _imaging\r\n16-except ImportError:\r\n17- Image = None\r\n18-\r\n19:# If we have PIL, do these tests\r\n20-if Image:\r\n21- class Person(models.Model):\r\n22- name = models.CharField(max_length=50)\r\n23- mugshot = models.ImageField(storage=temp_storage, upload_to='tests', \r\n\r\ntests/regressiontests/serializers_regress/models.py\r\n1-\"\"\"\r\n2-A test spanning all the capabilities of all the serializers.\r\n3-\r\n4-This class sets up a model for each model field type\r\n5:(except for image types, because of the PIL dependency).\r\n6-\"\"\"\r\n7-\r\n8-from django.db import models\r\n9-from django.contrib.contenttypes import generic\r\n\r\ntests/modeltests/model_forms/models.py\r\n70-\r\n71-class ImageFile(models.Model):\r\n72- description = models.CharField(max_length=20)\r\n73- try:\r\n74: # If PIL is available, try testing PIL.\r\n75- # Checking for the existence of Image is enough for CPython, but\r\n76- # for PyPy, you need to check for the underlying modules\r\n77: # If PIL is not available, this test is equivalent to TextFile above.\r\n78- import Image, _imaging\r\n79- image = models.ImageField(storage=temp_storage, upload_to='tests')\r\n80- except ImportError:\r\n81- image = models.FileField(storage=temp_storage, upload_to='tests')\r\n\r\n}}}", "owner": "nobody", "reporter": "jfkw", "keywords": "PIL imaging easy_install", "easy": 0, "has_patch": 0, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8188, "created": "2008-08-09 14:44:30", "changetime": "2011-09-28 16:12:16", "last_pulled_from_trac": "2022-03-06 03:41:35.685367", "stage": "Unreviewed", "status": "closed", "component": "Uncategorized", "type": null, "severity": null, "version": "dev", "resolution": "fixed", "summary": "file_move_safe not imported in storage.py", "description": "Uploading a File larger than FILE_UPLOAD_MAX_MEMORY_SIZE raises a !NameError in storage.py\r\n\r\n{{{\r\nException Type: \tNameError\r\nException Value: \tglobal name 'file_move_safe' is not defined\r\nException Location: \t/Library/Python/2.5/site-packages/django/core/files/storage.py in _save, line 153\r\n}}}\r\n\r\nAdding \r\n\r\n{{{\r\nfrom django.core.files.move import file_move_safe\r\n}}}\r\n\r\nfixes the problem.", "owner": "nobody", "reporter": "arne", "keywords": "upload, filestorage", "easy": 0, "has_patch": 1, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8192, "created": "2008-08-09 16:42:41", "changetime": "2008-08-09 16:52:20", "last_pulled_from_trac": "2022-03-06 03:41:36.508451", "stage": "Unreviewed", "status": "closed", "component": "Core (Other)", "type": null, "severity": null, "version": "1.0-alpha", "resolution": "invalid", "summary": "django.VERSION missing in alpha-2", "description": "Hello.\r\nThe django.VERSION is missing on alpha-2:\r\n\r\n{{{\r\nexedev@messir ~ $ python\r\nPython 2.5.2 (r252, Aug 3 2008, 14:11:25) \r\n[GCC 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import django\r\n>>> django.VERSION\r\nTraceback (most recent call last):\r\n File \"\", line 1, in \r\nAttributeError: 'module' object has no attribute 'VERSION'\r\n>>> \r\n}}}", "owner": "nobody", "reporter": "anonymous", "keywords": null, "easy": 0, "has_patch": 0, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0} {"id": 8195, "created": "2008-08-09 20:07:51", "changetime": "2008-08-12 17:21:15", "last_pulled_from_trac": "2022-03-06 03:41:37.079110", "stage": "Unreviewed", "status": "closed", "component": "Database layer (models, ORM)", "type": null, "severity": null, "version": "dev", "resolution": "worksforme", "summary": "Importing models from same directory throws unhelpful exception (trying to get app_label)", "description": "Before:\r\n{{{\r\nIn [1]: import models\r\n---------------------------------------------------------------------------\r\n Traceback (most recent call last)\r\n (strip my stuff)\r\n...django/db/models/base.py in __new__(cls, name, bases, attrs)\r\n 54 # For 'django.contrib.sites.models', this would be 'sites'.\r\n 55 model_module = sys.modules[new_class.__module__]\r\n---> 56 kwargs = {\"app_label\": model_module.__name__.split('.')[-2]}\r\n 57 else:\r\n 58 kwargs = {}\r\n}}}\r\n\r\nAfter attached patch, the relative import succeeds.\r\n", "owner": "nobody", "reporter": "kcarnold", "keywords": null, "easy": 0, "has_patch": 1, "needs_better_patch": 0, "needs_tests": 0, "needs_docs": 0, "ui_ux": 0}