Re: AttributeError: module 'django.db.models' has no attribute 'PointField'

2022-11-27 Thread Karen Tracey
On Sun, Nov 27, 2022 at 2:41 PM Ilyas Modni  wrote:

> AttributeError: module 'django.db.models' has no attribute 'PointField'
>
> PointField is in django.contrib.gis.db.models:
https://docs.djangoproject.com/en/4.1/ref/contrib/gis/model-api/#pointfield

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9raddif%3DiWrMUHUqEoK%2BTBxDoTYeXQ-mW0D_OZPyfoZqnpg%40mail.gmail.com.


Re: about issue

2020-03-21 Thread Karen Tracey
On Sat, Mar 21, 2020 at 11:32 AM Keshwani Ishita
 wrote:
>
> how to find issues for this organization's repo?

https://code.djangoproject.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9raeNMqVm07xwX0QbFL8Ei6tePH8gtCqfx%2B-BEhYmjNV%3DmQ%40mail.gmail.com.


Re: Raju | ITC Infotech - Looking for Backend Developers (Python/Django ORM - New York City )

2019-09-18 Thread Karen Tracey
Please everyone keep in mind that this mailing list has tens of thousands
of subscribers. Anyone interested in this job posting should contact the
poster directly, not post on this list.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9racuFQ7it4v4st%2BTzaF9yDsKXY%2BcmfNT0LHOz90mtuOumQ%40mail.gmail.com.


Re: President of India: Save Nallamala Forest from Uranium Mining @rashtrapatibhvn @TelanganaCMO

2019-09-15 Thread Karen Tracey
This user has posted non-spam in the past so was not moderated. Previous
emails had different headers so I suspect this was not actually posted by
this user. Best just to ignore spam when it makes it through, just like
trolls ignoring them like you don't even see their email is the best way to
annoy them back.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9raf1vbCh-9h0f7P_c%3D4C0-1an7M2RBW_nbKyOypj9y%3D0wA%40mail.gmail.com.


Re: Dev Server Response

2019-02-14 Thread Karen Tracey
On Thu, Feb 14, 2019 at 8:12 PM  wrote:

> Maybe a dumb question, but I can't find it anywhere in the documentation.
> I'm running an API with the development server and get a response from it
> in the console like:
>
> [14/Feb/2019 15:45:11] "GET /api/v1/msgs HTTP/1.1" 200 405
>
> 200 OK is the status code, what is the 405? I'll wager it's the RTT in ms
> but would like confirmation.
>
>
Pretty sure it's the length of the response (bytes). Can't find where that
is documented at the moment though...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9raekq7B-%3DXU7N%2Bb%3DMfCLOr6e%3D3kOveXbYa3iiaJd6KEMTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django kwargs are not passed with the view to html template

2019-02-04 Thread Karen Tracey
>
>
> In the conference list html, this is the code snippent: `{{ conference.title }}`. It redirects to the conference
> detail page without any problem. In the conference by country html, I have
> the following code:
>
> 
> {% for conferenc in conferences %}
>  href="{% url 'conferences:conference-detail' pk=conference.pk
> slug=conference.slug %}"> {{ conferenc.title }}  {%comment%} Here is
> the problem. {% endcomment %}
> {% endfor %}
>  
>

This for loop has variable named conferenc but in the urtl tag the name
conference is used. The same name needs to be used in both places. (If you
change to conference note the use of conferenc to show the title will also
need to change.

(Thanks for all the detail in the question!)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9raciD2hFjbhuQjqBTTnydpQsNe_Ph3CmdehDzbXpvn2B5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Do queries made instantiating a form not show up in db.connection.queries?

2018-11-01 Thread Karen Tracey
On Thu, Nov 1, 2018 at 8:14 PM Jonathan Berger 
wrote:

>
> Per the db and model FAQ
> :
> expected behavior is that 'connection.queries' should contain a list of all
> SQL queries made by an app.
>
> I'm finding actual behavior for a Form subclass that has a
> ModelMultipleChoiceField with a default queryset, does not add that query
> to 'connection.queries'. This violates expected behavior.
>
>
https://docs.djangoproject.com/en/2.1/ref/forms/fields/#django.forms.ModelChoiceField.queryset
notes the queryset is "evaluated when the form is rendered." ...are you
rendering the form or just instantiating it (per the subject)?

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9racCtAAgPLwv7-SBw-40Sddge_r9hpBS5eDBqE_1GGJbqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: unable to use unique argument in CharField

2018-08-13 Thread Karen Tracey
On Mon, Aug 13, 2018 at 1:21 PM, Ketul Patel 
wrote:

> *code*
>
> from django import forms
>
> class Group(models.Model):
> name = forms.CharField(max_length=255,unique=True)
> slug = forms.SlugField(allow_unicode=True,unique=True)
>
>
>
You need to use models.CharField, models.SlugField, etc. for defining
database models, not forms.whateverField.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9rafH4Ph7enO2%3DvfVvWoxDDpx8Vrcu1z5NMx4UafUnnf-mQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Please help me

2017-05-29 Thread Karen Tracey
On Mon, May 29, 2017 at 8:52 AM, Opeyemi Gabriel <
gabriel.futionl...@gmail.com> wrote:

> Django girls, am a guy
>
>
No worries, I expect you will still be able to follow it.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9rad350uqLpJcceF5Gi_aiU0n_nfzT5e3WsYfFfxU-Y8Szw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What is the best combination of components when installing Django on Windows 10?

2016-12-27 Thread Karen Tracey
On Tue, Dec 27, 2016 at 11:59 AM, bart  wrote:

> Don't u se Windows!
>
>
Please stop answering like this, this is the 2nd time you've provided an
answer of essentially "just don't do it" to a valid question. Windows may
not be where you would ever choose to deploy something, but there are
perfectly valid reasons why some folk may use Windows, and there are
certainly users who deploy Django on Windows. If you're not willing to
actually answer the user's question then just don't answer. If you feel
strongly enough about this question that you feel you must warn the user
against Windows, that's still not necessarily helpful since they may not
have a choice of OS for deployment, but should come at least with some
valid rationale for "no don't do it".

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9rafoCOMbYQOQz6QeyegqY6Bx6CoJ-C%3DDdbuC43cg%2BqTTPw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: LIMIT 1 on model.objects.get()

2016-02-25 Thread Karen Tracey
On Thu, Feb 25, 2016 at 10:10 AM, Matthew Crowson <
matthew.d.crow...@gmail.com> wrote:

When Django creates the SQL to get an object from model.objects.get() it
> doesn't look like SQL is adding a "LIMIT 1" to the end. As the get method
> is always intended to return a single item, would adding that to Django's
> SQL speed things up?
>

This would hide errors in cases where there are more than one. Currently
you will get an exception raised if you try a get() and more than a single
result is returned, if a LIMIT 1 were added to the sql then this error
situation would be hidden from developers.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9radt_cXGF5Q5XFYegX8TinKKexb_o0FJ6SSTow%3DxHJpnog%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.8 feature in 1.7.9?

2015-07-09 Thread Karen Tracey
On Thu, Jul 9, 2015 at 9:17 AM, Tim Graham  wrote:

> The 1.7.9 wheel file that was first uploaded to PyPI was corrupted. I
> uploaded a corrected file about 2 hours after the initial release. Sorry
> for inconvenience and confusion!
>
>
Any guidance on how to recover from a "cached" corrupted wheel?

e.g.:

Collecting Django<1.8,>=1.7.0
Using cached Django-1.7.9-py2.py3-none-any.whl
Hash of the package
https://pypi.python.org/packages/py2.py3/D/Django/Django-1.7.9-py2.py3-none-any.whl#md5=2df76c904...
(from https://pypi.python.org/simple/django/)
(52358ac5f48fd514d6c4eb9e08830985) doesn't match the expected hash 2df76c904
53477a9d0bb6a1608f0dfa5!
Bad md5 hash for package
https://pypi.python.org/packages/py2.py3/D/Django/Django-1.7.9-py2.py3-none-any.whl#md5=2df76c90453477a9d0bb6a1608f0dfa5
(from https://pypi.python.org/simple/django/)

Would it be better in general to replace "bad" versions with new releases
with new numbers rather than creating a 2nd differing released version of
supposedly the same thing?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9rae%2BDRbiCeymwfp%3DFK0eiupLi-%3D8r-oPm9obA%2BKinosshw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: comment and uncomments in django html template

2015-06-19 Thread Karen Tracey
On Fri, Jun 19, 2015 at 12:42 PM, Sindhujit Ganguly 
wrote:

>
>   Does anyone know how to do multiple line comments in django html
> templates?
>
>
Yes, block comment template tag:

https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#comment

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9racwHfQ6RRL7MCe1vJs6F9V3fefZ9QiyoU1TQ_YX8o4riQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Intuition about (potentially) sending multiple password reset emails

2014-12-03 Thread Karen Tracey
The password reset form asks for an email address, not username. (This is
assuming default Django User model.) The email address may be associated
with more than a single User on the system -- there is no requirement (by
default) that the user email address be unique. So a password reset email
is generated for each matching user, and the information presented in each
email includes the specific username for which the reset link applies.

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9raeXK_WhkWXq0fCcxEcUFoOHD0XFV0kz4nc7n8%2B%2BRT4j4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Group Admin

2013-12-20 Thread Karen Tracey
On Thu, Dec 19, 2013 at 11:53 PM,  wrote:

New here. Just wanted to know if there are any group admins present who
> review a post? Because I posted a question sometime back and it still
> hasn't showed up on the news feed.
>

Yes, first posts are moderated to prevent spam. It may take several hours
for the post to appear. It has been posted now.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9raeLj14xX1Eeyoznehv4H-UHEpM%3DpFXxDRygE6LwYdOGXg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Using unique_together with foreign key fields which may be None

2013-09-30 Thread Karen Tracey
On Mon, Sep 30, 2013 at 4:55 PM, Berndt Jung  wrote:

> Because the lookup_value of a null field is None, the validation check is
> aborted entirely.  This seems wrong to me, and I'm wondering if I'm doing
> something wrong here.  Redefining the models is not something I can do at
> this point.


None in Python corresponds to NULL in SQL. SQL defines that NULL != NULL.
So when checking for unique values the database will not consider two NULLs
to be the same value; the NULLs will be considered to be different and will
not violate the unique constraint. The Django code is doing the same check
for uniquess that the database will be enforcing. There is no way I know of
to make a database enforce uniqueness among NULL values...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9raekOZyHHmjEuNRCH-JC9xL7qFqCTuYJbu55pCuONHw-oA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: djangojobs.com

2013-09-20 Thread Karen Tracey
Please note any use of djangojobs.com domain would need to conform to the
Django trademark license agreement:

https://www.djangoproject.com/trademarks/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: I get import errors when I run django-admin.py startproject in Windows

2013-03-31 Thread Karen Tracey
What errors, exactly? Without some specifics of what's going wrong it's
hard to offer help. Copy/paste of exactly what you are entering and getting
in response would help.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django 1.5 tutorial error: 'module' has no attribute 'StackedInLine'

2013-03-27 Thread Karen Tracey
On Wed, Mar 27, 2013 at 11:32 AM, +Emmanuel  wrote:

> Hello there,
>
> I am working through the django tutorial at djangoproject.com. So far
> everything works out fine until Section 2.4.6 (customizing the admin form).
> Django throws an error:  *'module' has no attribute 'StackedInLine'. *
>

Right, the L in StackedInLine should NOT be capitalized, it should be just
an initial capital letter on Inline: StackedInline

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Using values_list and extra on same queryset

2013-03-27 Thread Karen Tracey
On Wed, Mar 27, 2013 at 9:19 AM, Larry Martell wrote:

> Here's a very simple example showing it's not working for me
>
> (Pdb) CST.objects.all().extra(select={'ep':
> 1}).values_list('image_measurer_id')
> [(86456L,), (86454L,), (86452L,), (86450L,), (86448L,), (86446L,),
> (86444L,), (86442L,), (86440L,), (86438L,), (86436L,), (86434L,),
> (86432L,), (86430L,), (86428L,), (86426L,), (86424L,), (86422L,),
> (86420L,), (86418L,), '...(remaining elements truncated)...']
>


You have not included the extra select column ep in your values_list call...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What is the difference in the 1.5.x branches for instance, vs 1.5

2013-03-25 Thread Karen Tracey
On Sun, Mar 24, 2013 at 11:39 PM, Huy T  wrote:

> Is it better practice to pull from 1.5.x vs the master? I am unclear as to
> the difference unless it eventually is rolled into the master.
>
>
1.5.x branch has bug fixes made after the release of 1.5. It will never be
rolled into master (which has new features slated for 1.6), but it will
eventually get released as 1.5.1. There has been at least one memory leak
issue identified with the 1.5 release, which has been fixed on the 1.5.x
branch, so we are hoping to do a 1.5.1 release sooner rather than later.


> Also, when using pip to install, I am launching the command:
>
> pip install -v git+https://github.com/django/django.git@1.5.x
>
> But have also seen #egg=django , I am unclear as to what the egg is for.


I believe the egg specification is only needed when you install using the
-e  (editable) option.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: memory leak in django 1.5

2013-03-21 Thread Karen Tracey
On Thu, Mar 21, 2013 at 9:00 PM, Craig de Stigter wrote:

> Hi everyone
>
> (cross-posted because this seems relevant to both django-users and
> developers, and both might have experienced this problem)
>
> We've noticed a gradual increase in memory usage for our apache processes
> since upgrading to django 1.5.
>
> Here is a graph  showing memory usage
> before and after we upgraded to django 1.5 on our web server. (the upgrade
> occurs at 12:30 on the graph).
>
> I'm hoping someone else has noticed a similar thing and is able to provide
> some insight.
>

https://code.djangoproject.com/ticket/19895#comment:6

notes a memory leak due to a fix that went into 1.5.

The fix was reverted on the 1.5.x branch about two days ago, so one thing
to try would be to run current 1.5.x branch level rather than released 1.5.

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: manage.py and django-admin.py help

2013-02-27 Thread Karen Tracey
On Wed, Feb 27, 2013 at 5:27 PM, Clientkill  wrote:

> Can someone tell me why, even after trying everything, I can't open either
> manage.py or django-admin.py? I have apt-get installed django and its
> registration package, and calling manage.py or django-admin.py returns:
> manage.py: command not found


Mention of apt-get makes me think you're using a linux distribution where
the packaging has renamed django-admin.py to just django-admin, so try just
django-admin. You won't have a manage.py until you get django_admin
startproject to run successfully.

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to install Django 1.4.5 in python 3.2.3?

2013-02-21 Thread Karen Tracey
You don't. Python 3 support comes with Django 1.5, it's not available with
1.4.x.

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django 1.4.3 to 1.4.4 upgrade fails - Bad magic number Import Error

2013-02-21 Thread Karen Tracey
On Thu, Feb 21, 2013 at 9:09 AM, lucien  wrote:

> Hi,
>
> I tried the 1.4.5 because I got the same error with ubuntu and postgres
> Do you have any idea?
>

Did you remove the 1.4.4 install before installing 1.4.5?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: pyc files included in the package for Django 1.4.4

2013-02-19 Thread Karen Tracey
On Tue, Feb 19, 2013 at 10:40 PM, Daniel Izquierdo <
daniel.izquie...@gmail.com> wrote:

> Hi,
>
> The packages for Django 1.4.4 and 1.3.6 includes a few pyc files:
>
> ./Django-1.4.4/django/contrib/sessions/management/__init__.pyc
> ./Django-1.4.4/django/conf/locale/__init__.pyc
> ./Django-1.4.4/django/conf/locale/en/__init__.pyc
> ./Django-1.4.4/django/conf/locale/en/formats.pyc
>
> This has broken my deploy process because they're for Python 2.7 instead
> of 2.6 which is what I'm using. Also, previous packages don't include
> those. I'm assuming this is a mistake, but could someone please clarify?
>

Correct, it's a mistake those files were included. The problem affects both
the 1.4.4 and 1.3.6 tarballs. A ticket has been opened for it:
https://code.djangoproject.com/ticket/19858.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django install error using Python26

2013-01-26 Thread Karen Tracey
On Sat, Jan 26, 2013 at 11:08 PM, Andrew Palmer wrote:

> Wow I feel like an idiot... I'm so used to tabbing everything out that I
> was tabbing the 'INSTALL' located in the django directory...
>

Ah, that's an unfortunate bit of unhelpfulness with tab-completion there.
Hopefully things will get easier now. When in doubt try to do exactly as
shown in the tutorial/book and if that doesn't work don't be afraid to ask
questions on IRC or here. I expect everyone here can remember tripping in
early days over something that in retrospect seems silly.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django install error using Python26

2013-01-26 Thread Karen Tracey
Lowercase install, not uppercase INSTALL.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: urlresolver.reverse_dict contents differ from 1.3 to 1.4

2013-01-07 Thread Karen Tracey
On Mon, Jan 7, 2013 at 6:07 PM, Gurudev Devanla
wrote:

>
> Django 1.3 's version of urlresolver.reverse_dict has a tuple with 2
> elements. I notice that the 1.4's definition has 3 elements. Are similar
> changes to the resolver module documented elsewhere?
>
>
No. urlresolver is in the realm of internals, not publicly documented API.
There is no comprehensive documentation (other than the code itself) of
Django internals.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Strange behavior using ModelForms

2012-12-18 Thread Karen Tracey
On Tue, Dec 18, 2012 at 4:11 PM, Francisco Vianna <
francisco.v.via...@gmail.com> wrote:

> After some debugging, I realized they become the same after calling
> "is_valid" to the bound form. Now, I'm not sure if I am missing something
> conceptually about ModelForms binding.
> Its very ackward to me that I can have a 'instance' field in a ModelForm,
> but can't distiguish the data after performing the validation. In my case
> specifically, I need to check first if the email provided by the user is
> valid, and only then check if its diferent from the instance's e-mail in
> order to set my flag. But I can't do it, or I will lose the new e-mail
> provided by the user in the form.
>
> Can anyone enlighten this matter? Is this behavior expected?


Yes, is_valid() called on a model form updates the model form's instance
in-place with the valid cleaned data. This is documented:

https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-is-valid-method-and-errors

Your form field's clean method would have access to the "old" value, since
that runs before the new value has been fully validated and saved in the
instance.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: IntegerField and SmallIntegerFields maps to the same db type on Oracle.

2012-12-13 Thread Karen Tracey
On Thu, Dec 13, 2012 at 1:19 PM, Michał Nowotka  wrote:

> OK, then why django makes a difference between BigIntegerField (maps to
> NUMBER(19)) and IntegerField (maps to NUMBER (11)).


BigInteger was added after the others, probably by someone who did not
notice/understand why the other two were defined as they were. When testing
out that patch for inclusion I focused on "does the new field accept the
range of numbers it should" and likely didn't check to make sure the new
type defined for each backend was consistent with how other types in that
backend had been specified...

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Problem at activating the admin site (Django tutorial part 2)

2012-12-13 Thread Karen Tracey
Have you followed the tutorial exactly? I was unable to recreate this
problem when someone opened a trac ticket describing it:

https://code.djangoproject.com/ticket/18308

Another Django dev noted it was a duplicate of another ticket:

https://code.djangoproject.com/ticket/18226

where the problem seemed to be due to adding south as an app in the
tutorial rather than following the tutorial exactly.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-registration customization

2012-12-13 Thread Karen Tracey
On Wed, Dec 12, 2012 at 3:36 PM, sri  wrote:

> Now, when i click on the register button on the page, the form validation
> does not work.
> Let's say if i enter the username that already exists on the database, it
> is not reporting any errors. It is just displaying the form without any
> error messages.
> Can anyone help with what i am missing?
>

Sounds like the form validation is working, since you are not getting
redirected to next page but rather the registration page is being
re-displayed. The form created in the view is where the validation errors
have been stored, and that form thus needs to be used by the template for
rendering the errors. However, the template you show is not using the
registerform that is being passed in the context from the view, it just has
all the fields hard-coded. You'll need to use the registerform to render
the form validation errors, since that is where they've been stored. See:

https://docs.djangoproject.com/en/1.4/topics/forms/#displaying-a-form-using-a-template

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Possible Bug with GenericRelation and values_list

2012-12-10 Thread Karen Tracey
On Mon, Dec 10, 2012 at 8:52 PM, Skylar Saveland
wrote:

> I may have found a bug. I made a test case here:
>
>
> https://github.com/skyl/django/commit/556df1c46146c2fc9c4022d838fa23f652f0ea8d
>
> The final assertion fails. Is this a bug or do I misunderstand how this
> should work?
>
>
Answered on django-developers:
http://groups.google.com/group/django-developers/msg/b5a4c5bdc2577f3f

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Messages Framework

2012-12-09 Thread Karen Tracey
On Sun, Dec 9, 2012 at 8:44 AM, Andreas Pritschet <
webmas...@hasenkopf2000.net> wrote:

> Hi there,
> for a little project of mine I wanted to use the Message middleware,
> but the documentation appears to lack some crucial information.
>
> The message framework is working very well on the admin site. On the
> admin site also the messages generated in non-admin views are shown.
> So good so far.
>
> But following the documentation and the base.html template of the
> admin site the messages are not rendered to non-admin views.
>
>
Are your own views rendered using a RequestContext for rendering? If not,
they will not have the messages context variable referenced in the admin
base.html template automatically set. (All of the admin views render using
RequestContext.) The messages doc here:

https://docs.djangoproject.com/en/1.4/ref/contrib/messages/#displaying-messages

which shows a sample template block for rendering messages notes that
you'll need to either render with a RequestContext or somehow ensure that
the messages variable is available in the template context.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: get_or_create gave IntegrityError: (1062, "Duplicate entry) error sometimes

2012-10-15 Thread Karen Tracey
On Mon, Oct 15, 2012 at 9:43 AM, Tom Evans  wrote:

> On Mon, Oct 15, 2012 at 1:50 PM, Zheng Li  wrote:
> > get_or_create shouldn't give duplicate entry error
> > anyone help.
> >
>
> This is incorrect, and a common misconception: get_or_create() is not
> atomic. If this happens, you will get duplicate key errors:
>

No, get_or_create IS intended to be atomic.


>
> Thread A calls get_or_create(a='a', b='b')
> Thread B calls get_or_create(a='a', b='b')
> Thread A get_or_create looks for entry in DB, not found
> Thread B get_or_create looks for entry in DB, not found
> Thread B creates entry in DB
> Thread A get_or_create tries to create entry in DB
>

Internally, get_or_create code in thread A will now attempt to GET the
object created by thread B. It will not automatically reflect the error to
the caller. See:

https://github.com/django/django/blob/stable/1.4.x/django/db/models/query.py#L430


>
> Where I say 'thread', you could also read 'process'. If you are
> capable of serving multiple requests simultaneously, this can happen,
> even if you aren't using threads.
>
> If this is a problem for you, use a transaction aware DB instead of
> MySQL. It won't solve the issue, but at least you will be able to
> unroll the transaction.
>

The issue with MySQL here is when you ARE using its transactional DB
engine, InnoDB, AND using its (default) "repeatable read" transaction
isolation level. In that case, the DB will refuse to return the object
created by thread B to thread A if thread A has already "read" the
non-existence of such a row. See:

https://code.djangoproject.com/ticket/13906

This particular issue can be fixed by changing the transaction isolation
level to "read committed". Although I have heard various people say this
can cause "other problems" with MySQL apps, I've never seen a concrete
example of one, so switching to "read committed" would be my preferred way
to use get_or_created if I had to use MySQL/InnoDB.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Global timeout for views

2012-10-14 Thread Karen Tracey
On Sat, Oct 13, 2012 at 10:43 AM, Sudhir Kumar  wrote:

> Is there a way to setup a global timeout for all views?
>
> Some of the requests are taking too long. I would like to log those and
> send an error response back. If possible, I would NOT  like to delegate
> timeout to upstream load balancer. What is the best way to achieve this in
> Django.
>
>
There is nothing built in to Django for this. You may want to take a look
at these external projects:

https://bitbucket.org/evzijst/dogslow
https://bitbucket.org/evzijst/interruptingcow

I heard about them at the talk "Healthy Webapps Through Continuous
Introspection" by Erik van Zijst at DjangoCon EU this summer. See:

http://lanyrd.com/2012/djangocon-europe/srptg/

for slides/video. I have not had a chance to try these tools out yet
myself, but they are on my list for next time I find myself needing to
figure out why some views are slow.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: User can't edit model even after permissions are issued

2012-10-14 Thread Karen Tracey
On Fri, Oct 12, 2012 at 4:52 PM, Shawn H  wrote:

> I'm new to Django, and I'm using the admin site to manage my users.  I
> have one app installed, and it has one model.  I created a new user, issued
> that user add, change, and delete privileges (as app | model | privilege),
> but when I log on as that user, I get the "you don't have permission to
> edit anything" error.  The user is active and is staff, but no joy.  What
> might I be missing?


Are the app's models registered in admin?

-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: custom upload handlers

2012-09-23 Thread Karen Tracey
Have you read the entire Note under
https://docs.djangoproject.com/en/1.4/topics/http/file-uploads/#modifying-upload-handlers-on-the-flywhich
discusses how the CSRF protection accesses request.POST and therefore
prevents changing upload handlers in a view which is CSRF protected? It
includes an example of how to change the upload handlers in a view that is
not CSRF protected and then forward the request onto a view function which
is CSRF protected.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django newbie with issues

2012-09-15 Thread Karen Tracey
On Wed, Sep 12, 2012 at 5:46 AM, Morrti  wrote:

> Thanks for your comments on version numbers, but moving to 1.4 isn't a
> quick option for me/us so I'm stuck on 1.1 for a while.
>
> Trying to run the app and instead of getting the "welcome" page I get the
> following, see below.
>
> Not withstanding my version issue, anyone got any ideas on this.
>
> [snip]
>
> Traceback (most recent call last):
>
>   File 
> "/Users/timmorris/Sites/django/django-trunk/django/core/servers/basehttp.py", 
> line 279, in run
> self.result = application(self.environ, self.start_response)
>
>   File 
> "/Users/timmorris/Sites/django/django-trunk/django/core/servers/basehttp.py", 
> line 651, in __call__
> return self.application(environ, start_response)
>
>   File 
> "/Users/timmorris/Sites/django/django-trunk/django/core/handlers/wsgi.py", 
> line 230, in __call__
> self.load_middleware()
>
>   File 
> "/Users/timmorris/Sites/django/django-trunk/django/core/handlers/base.py", 
> line 42, in load_middleware
> raise exceptions.ImproperlyConfigured, 'Error importing middleware %s: 
> "%s"' % (mw_module, e)
>
> ImproperlyConfigured: Error importing middleware django.middleware.common: 
> "cannot import name force_text"
>
>
>
force_text did not exist in 1.1, but it exists in current master. Getting
an error referring to it rather implies that you're running a mutant
version with some leftover py/pyc files form when you were running current
master (which appears to be what you were running for the first traceback
posted -- the " __init__() keywords must be strings" error there is what
you get today on master if you run with Python earlier than 2.6.5).

I'd start over with a completely new install, in a completely new directory
tree. (I also would not include "django-trunk" in the name of that tree, if
it was actually intended to hold 1.1.something.)

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: NoReverseMatch Error

2012-08-25 Thread Karen Tracey
On Sat, Aug 25, 2012 at 1:28 AM, Syam Palakurthy
wrote:

> Hi, Can you please elaborate on how to use this block in the template
> code?  I've tried adding this into my details template code in various
> places and cannot get it to successfully work.  Also, any
> suggestions/examples you could point me to would be much appreciated.
>
>
Sorry, it's {% load url from future %}, not import. Brain misfired and put
Python word in place of Django template language.

See the forward compatibility note here:
https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#url

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: SyntaxError Creating New Project

2012-08-22 Thread Karen Tracey
On Wed, Aug 22, 2012 at 5:00 PM, Bestrafung  wrote:

> I'm new to Django and though I've dabbled with Linux off and on for a
> decade I'm still learning so please go easy on me. I'm following this
> guideto
>  setup a Django 1.4.1 test project. So far I've setup Python 2.5 with
> MySQL-python-1.2.3 and setuptools, setup mod_wsgi, and edited
> .bash_profile. I've downloaded Django 1.4.1 (not trunk) and so far
> everything looks good. As soon as I run "django-admin.py startproject
> testproject" I receive an error and am having trouble resolving it. I
> apologize if this has come up before bet a quick search wasn't helpful.
> Thanks in advance for any assistance, the error is below:
>
> [-bash-3.2 root@server1: /home/username/sites/domain.com] #
> /home/username/sites/domain.com/django/bin/django-admin.py startproject
> testproject
> Traceback (most recent call last):
>   File "/home/username/sites/domain.com/django/bin/django-admin.py", line
> 2, in ?
> from django.core import management
>   File "/home/username/sites/domain.com/django/__init__.py", line 15
> parts = 2 if version[2] == 0 else 3
>^
> SyntaxError: invalid syntax
> [-bash-3.2 root@server1: /home/username/sites/domain.com] #
>
> That error indicates the python executable processing django-admin.py is
Python 2.4 level, not 2.5. With Python 2.5 I can import django at level
1.4.1:

kmt@lbox 20:04:15: ~/software/web
--> python
Python 2.5.2 (r252:60911, Jan 20 2010, 23:16:55)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> quit()

If I try with Python 2.4 level, I get the error you are seeing:

kmt@lbox 20:04:45: ~/software/web
--> python2.4
Python 2.4.5 (#2, Jan 21 2010, 19:44:35)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
  File "", line 1, in ?
  File "/home/kmt/django/Django-1.4.1/django/__init__.py", line 15
parts = 2 if version[2] == 0 else 3
   ^
SyntaxError: invalid syntax
>>>

You may have python 2.5 installed, but you seem to have 2.4 also, and 2.4
is what's getting used for the command you are running.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django.db.utils.DatabaseError when resyncing django app models

2012-08-21 Thread Karen Tracey
The key part of the traceback is this:

  File
"/usr/local/lib/python2.7/site-packages/django/core/management/sql.py",
line 189, in emit_post_sync_signal
interactive=interactive, db=db)
  File
"/usr/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py",
line 172, in send
response = receiver(signal=self, sender=sender, **named)
  File
"/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
line 54, in create_permissions
auth_app.Permission.objects.bulk_create(objs)

which indicates the problem is related to the creation of permissions for
your models (I can't explain why you are seeing this on a 2nd syncdb unless
you are actually adding models, though I don't see any tables created in
your output so that is a bit confusing). You are hitting this ticket:

https://code.djangoproject.com/ticket/17763

Solution at this point in time is either to shorten names in your models or
manually increase the length of the too-small field(s) in the
auth_permission table.

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: skip fixtures loading on 'manage.py test myapp'

2012-08-21 Thread Karen Tracey
On Mon, Aug 20, 2012 at 12:40 PM, Anton Baklanov wrote:

> and, if anyone is interested, here is the answer -
> http://south.readthedocs.org/en/latest/settings.html#south-tests-migrate
>
>
That link doesn't really explain why south would be loading fixtures that
Django itself wouldn't ordinarily load. Unless...do you have migrations
that are loading fixtures?

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: NoReverseMatch Error

2012-08-15 Thread Karen Tracey
On Tue, Aug 14, 2012 at 10:46 AM, Serge G. Spaolonzi wrote:

> Try removing the quotes from 'polls.views.vote':
>
> 
>
>
>
Note that will work for 1.4 but it's doing things the old way, and that
will break in 1.5. Much better to add {% import url from future %} and have
code that will continue to work with the next release of Django. Removing
the quotes is not the best approach at this time.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: NoReverseMatch Error

2012-08-13 Thread Karen Tracey
On Mon, Aug 13, 2012 at 10:46 PM, Syam Palakurthy
wrote:

> Hi - I could not find any explanation that fixed the problem, until I ran
> across this person's abridged Django tutorial:
> http://tony.abou-assaleh.net/web-development/stripped-down-django-tutorial
>
> It's basically a line in the details template, which should be:
>
> 
>
>
> Instead of:
>
> 
>
>
> I'm not sure why this fixed the issue, but it did for me.  I'd love an
> explanation if anyone has one.
>
>
This is not a typo in the tutorial. The {% url %} variant is a faily recent
update to the current  development level of the online docs. It was added
in order to show in the tutorial best practices: url reversal by name
rather than hard-coding url paths in the template. However, it uses the {%
url %} tag syntax that is correct for the upcoming Django release, 1.5. In
order for that syntax (specifically, the quotes around polls.views.vote) to
work in the 1.4 released version, the template would also have to include
{% import url from future %}. This "from future" import is not necessary in
the current development level of code, so was not included when this change
to demonstrate how to use {% url %} was added to the tutorial development
level. However it seems that many many many people are running through the
development-level doc with the 1.4- released level code, so perhaps we
should add a note here (or more prominently elsewhere) to please be sure
you run through the online version of the tutorial that matches the level
of code you are running.

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django.shortcuts redirect doesn't pass argument

2012-08-05 Thread Karen Tracey
On Sun, Aug 5, 2012 at 9:21 PM, forthfan  wrote:

>
> I'm trying to pass a filepath from one view to another by using 'redirect'
> from django.shortcuts, but the argument is not getting passed.  What am I
> doing wrong?
>
> def upload1(request):
>   if request.method == 'POST':
> form = UploadFileForm(request.POST, request.FILES)
> if form.is_valid():
>   filepath = request.FILES['file']
>   return redirect('/app/upload2/', filepath=filepath)
>

You are passing the hardcoded url to redirect, which will be used as-is
(per doc:
https://docs.djangoproject.com/en/1.4/topics/http/shortcuts/#redirect). If
you want the filepath kwarg to be used to construct the url specified in
the redirect, you need to pass the name of the view (or url pattern) for
the view.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to override an attribute?

2012-08-04 Thread Karen Tracey
On Sat, Aug 4, 2012 at 10:55 AM, .  wrote:

> I'm trying to do the same [1].
> I've already tried all solutions from stackoverflow but none of them
> worked.
>
> [1]
> http://stackoverflow.com/questions/2344751/in-django-model-inheritance-does-it-allow-you-to-override-a-parent-models-a
>

It seems you are trying to do something that is specifically documented as
not being allowed:

https://docs.djangoproject.com/en/1.4/topics/db/models/#field-name-hiding-is-not-permitted

Easiest solution to your underlying problem would likely be to find a
solution that does not require doing something Django does not support.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Demise of Mr. Kenneth Gonsalves

2012-08-03 Thread Karen Tracey
On Fri, Aug 3, 2012 at 11:12 AM, Anoop Thomas Mathew wrote:

> With my heartfelt condolence, I'd like to inform you all the unfortunate
> demise of Mr.Kenneth Gonsalves (KG - law...@thenilgiris.com), who was a
> strong advocate of Python, Django and Free Software in India.
> He had served as the President of IPSS(Indian Python Software Society),
> which initiated the PyCon India, done a lot of workshops on Python and was
> an active member in the Django user group.
>
>
I'm so sorry to hear that, he was indeed a longtime contributor to this
group and will be missed. Thank you for letting us know.

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: QuerySet API - istartswith - use UPPER instead of ILIKE with PostgreSQL backend

2012-08-03 Thread Karen Tracey
On Wed, Aug 1, 2012 at 1:03 PM, Naoko  wrote:

> QuerySet API - istartswith - use UPPER instead of ILIKE with PostgreSQL
> backend
> which conflict with Documentation (
> https://docs.djangoproject.com/en/dev/ref/models/querysets/)
> as documentation's example shows SQL equivalent as " ILIKE "
>
> Is this due to my backend being PostgreSQL? or is there setting that I can
> change?
> I would like to know this so that we can strategize indexing of DB.
> Any advice would be appreciated.
>
> The doc wasn't changed when the optimization for using UPPER instead of
ILIKE was put in (see https://code.djangoproject.com/ticket/3575). Feel
free to open a ticket against the doc, from a quick check it seems that
none of the DB backends use the documented "SQL equivalent". (I wonder if
these documented "equivalents" are more trouble than they are helpful...)

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Features in Django1.4

2012-07-28 Thread Karen Tracey
On Sat, Jul 28, 2012 at 9:42 AM, ACK-Django wrote:

> hello guys,
> i m new to django1.4 and just starting out with the tutorails
> but i m bit curious about => does django has its own framework for
> 1. Messaging
>

https://docs.djangoproject.com/search/?q=messages&release=6


> 2. comments
>

https://docs.djangoproject.com/search/?q=comments&release=6


> 3. uploads
>

https://docs.djangoproject.com/search/?q=file+uploads&release=6

Django has pretty comprehensive documentation, that's a good place to start
in your search.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: form.save() fails - due to missing field?

2012-07-28 Thread Karen Tracey
On Sat, Jul 28, 2012 at 9:31 AM, Sithembewena Lloyd Dube
wrote:

> Hi all,
>
> I have a view where if request.method == 'POST', I need to call save.
> Basically, it's a registration form and the entity is a user (not the base
> Django user, but a custom model). An existing user refers another person,
> when they click the link they come to a registration page.
>
> I have a problem where I try to call save:
>
> form = SubmitReferralForm(data=request.POST)
> if form.is_valid():
> try:
>
> registered_user.referral_set.get(email_address=form.instance.email_address,
> status=1)
> msg = 'This email address has already been referred.
> Try another?'
> except Referral.DoesNotExist:
> form.instance.status = 1
> referral = form.save()
>
> The form looks as follows:
>
> class SubmitReferralForm(forms.ModelForm):
>
> class Meta:
> model = Referral
> exclude = (
> 'section', 'referrer', 'status', 'time_added',
> )
>
> Now, the section referred to here is hideen in the form but I need to
> provide it before calling save. Problem is, the referred user's section is
> in one app, the referrer's section is in another - but they should both be
> the same. The exception is:
>
>
I don't quite follow what you are saying here. You have two different
Section models in two different apps? If so, that sounds like not the best
approach.

The exception you are getting is due to excluding section from this form
and not providing a value for it before attempting to save the form/model.
The code you show is already solving this problem for the Referral status
field, you must somehow do the same thing for the section. The key is you
must set section before attempting to save the new model. As noted above I
can't quite follow what you've said about section so can't advise on how to
set it in this case, but it must be set to something before you can save a
new Referral model instance.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: form.save() fails silently - how to debug?

2012-07-27 Thread Karen Tracey
On Fri, Jul 27, 2012 at 3:25 AM, Derek  wrote:

> The clean() method basically stores the non-model field data in the
> model's dictionary field.  If this method was faulty, then it would also
> cause problems in the test code.  As I said, when I print the data to
> console it looks OK.  I am still trying to find how and where the save()
> method indicates errors...?


Model save() would indicate an error by raising an exception, see:

https://github.com/django/django/blob/master/django/db/models/base.py#L444

I would attack the problem you are seeing by tracing through what's
actually happening using pdb.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ignore field during form validation

2012-07-27 Thread Karen Tracey
On Thu, Jul 26, 2012 at 11:14 AM, Zoltan Szalai wrote:

> Hi all,
>
> Let's assume i have to the following simple form:
>
>
> class Form(forms.Form):
>
> check = forms.BooleanField(
> required=False,
> )
> # take into account only when 'check' is True
> len = forms.IntegerField(
> min_value=3,
> max_value=5,
> required=True,
> )
>
>
> What I want is to validate the 'len' field only when 'check' is True.
> I could define the clean method of the form and validate the required,
> min_value and max_value stuff only when 'check' is True but the case when
> someone types a non integer value into the input is still there. How could
> I skip that? That check is done by the IntegerField.
>

You could use two different Django forms, and only call is_valid() on the
one with the len value if the first one with the check value indicates that
check is True. Both of these Django forms can be rendered in a single HTML
. I think that approach is a little cleaner than inspecting the POST
data yourself.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: newbie URL problem

2012-07-26 Thread Karen Tracey
On Thu, Jul 26, 2012 at 8:32 AM, Karen Tracey  wrote:

> On Thu, Jul 26, 2012 at 12:20 AM, Felipe Sitta wrote:
>
>>
>> I messed up with the code and figured that the problem is with the urls
>> patterns. Here are the codes:
>>
>> the url patterns from urls.py
>> url(r'^Track List/(?P(.*)\w+)/$'
>> ,'tracks.views.trackList'),
>> url(r'^Track
>> List/(?P(.*)\w+)/(?P)/$'
>> ,'tracks.views.track'),
>>
>
> Get rid of the (.*) in those url regular expressions.
>

And when you do that you'll also need to adjust your track names to have no
spaces or explicitly allow space in the country/track names, in general it
would be better to slugify your names for use in urls, which will get rid
of spaces and other characters that will wind up getting percent-encoded.
Also the 2nd url pattern seems to be missing the regex pattern part for the
track_name part?

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: newbie URL problem

2012-07-26 Thread Karen Tracey
On Thu, Jul 26, 2012 at 12:20 AM, Felipe Sitta  wrote:

> I'm new to programming and I'm designing an demo website to get used to
> django, web and database stuff. It's about racetracks.
>
> The structure is the following:
> There's a menu with a link "Track List", it leads to a page with an
> country list each one as a link.
> Each link leads to an list with the racetracks from the respective
> country, and then clicking on a track name leads to a page with
> informations.
>
> So the links will be looking, for example, like this:
>
> localhost/Track List/United States/Indianapolis Motor Speedway
>
>
> Everything's fine until "United States" when I click the track name it
> ignores the view function that creates the track information layout,
> instead of this, it recalls the country list view (which pops an error
> since data is different on the layout)
>
> I messed up with the code and figured that the problem is with the urls
> patterns. Here are the codes:
>
> the url patterns from urls.py
> url(r'^Track List/(?P(.*)\w+)/$'
> ,'tracks.views.trackList'),
> url(r'^Track
> List/(?P(.*)\w+)/(?P)/$'
> ,'tracks.views.track'),
>

Get rid of the (.*) in those url regular expressions. That's matching
anything at all, including '/Indianapolis Motor Speedwa', then the y
matches \w and presumably the url ends with a slash at the end of the
string. urlpatterns are processed in order with first match begin taken, so
anything that that starts with 'Track List' and ends with an alphnumeric
(\w+) and a slash is matching the first url pattern and being routed to
the trackList view.

(Once you get to the point where the 2nd pattern is matched you'll have a
problem since that url captures two parameters for the view but the view
itself is only defined to expect one.)

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: All of the sudden getting TemplateDoesNotExist error

2012-07-24 Thread Karen Tracey
On Tue, Jul 24, 2012 at 11:41 AM, rmschne  wrote:

> I have made no changes to settings.py. Honest.  I'm running Django 1.4.0
> alpha.


Why alpha rather than the released version? Not that I think it has
anything to do with the problem, it just seems odd to stick with an alpha
level after the official release is available.



> The variable TEMPLATE_DIRS is pointing to a folder which exists and the
> template 'directory.html' i wish to load in in that
> folder, /Users/rmschne/Documents/source/django/projects/socmgmt/templates/.
>  My ID has appropriate permissions (running on Mac OS/X).
>
> All of the sudden today (and it worked  a few days ago), I get
> "TemplateDoesNotExist" error.  This happens for any of the templates I try
> to load.
>
> Frankly, I'm at a kinda loss as to where to start debugging this since
> everything looks ok and I don't recall making any changes that would be
> relevants.
>
>
With DEBUG on the template loader post mortem on the debug page should give
some clues.  What does it say?

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: forms.FileField

2012-07-24 Thread Karen Tracey
On Tue, Jul 24, 2012 at 8:05 AM, francescobocca...@libero.it <
francescobocca...@libero.it> wrote:

> Hi all,
> i have a question about Form. I create a template that use a
> forms.FileField
> (text) and  forms.FileField to upload a file.
> I fill a forms.FileField field and forms.FileField. I upload the file
> without
> errors but when the page is reaload only forms.FileField is filled with
> last
> text while forms.FileField is empty. Is there a way to remember the path
> of my
> last file uploaded?
>

No. This is a browser security feature. Browsers do not allow file upload
fields to be initialized by the server, users must explicitly choose files
to be uploaded.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: sqlite to mysql loaddata not working (using natural keys)

2012-07-21 Thread Karen Tracey
On Fri, Jul 20, 2012 at 2:57 PM, dack  wrote:

> I'm trying to move django data from an sqlite database to a mysql
> database. I know I need to use natural keys, but it's still failing. Any
> ideas?
>
> Here's my procedure. The default database is sqlite, the mysql database is
> called "mysql" in settings.py.
>
> $*./manage.py dumpdata -a -n > data.json*
> $*./manage.py flush --database=mysql*
> You have requested a flush of the database.
> This will IRREVERSIBLY DESTROY all data currently in the 'django' database,
> and return each table to the state it was in after syncdb.
> Are you sure you want to do this?
>
> Type 'yes' to continue, or 'no' to cancel: yes
>
> You just installed Django's auth system, which means you don't have any
> superusers defined.
> Would you like to create one now? (yes/no): no
> Installed 0 object(s) from 0 fixture(s)
> *Note - if I examine the mysql database at this point, the tables all
> exist and contain 0 rows (as I expected)*
> $*./manage.py loaddata --database=mysql ./data.json*
> Problem installing fixture './data.json': Traceback (most recent call
> last):
>   File
> "/usr/local/lib/python2.6/site-packages/django/core/management/commands/loaddata.py",
> line 196, in handle
> obj.save(using=using)
>   File
> "/usr/local/lib/python2.6/site-packages/django/core/serializers/base.py",
> line 165, in save
> models.Model.save_base(self.object, using=using, raw=True)
>   File "/usr/local/lib/python2.6/site-packages/django/db/models/base.py",
> line 565, in save_base
> created=(not record_exists), raw=raw, using=using)
>   File
> "/usr/local/lib/python2.6/site-packages/django/dispatch/dispatcher.py",
> line 172, in send
> response = receiver(signal=self, sender=sender, **named)
>   File "/genpool0/db/foo/intranet/../intranet/userprofile/models.py", line
> 22, in create_user_profile
> UserProfile.objects.create(user=instance)
>

You've got app code running here that is forcing creation of a UserProfile
when the user is loaded. Likely these UserProfile objects are also being
loaded from the fixture, so the attempt to create them is generating the
"user_id" is not unique error.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Extending a app with other app

2012-07-21 Thread Karen Tracey
On Fri, Jul 20, 2012 at 1:58 PM, Nicolas Ardison wrote:

> Does anybody knows how to create a "app" inside a "app"?


This request is unclear, perhaps if you put a few more words around this
describing what you actually want to do someone could help. It doesn't make
any sense in Django to say you want an app inside an app.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to present a calculated field in a admin edit form.

2012-07-21 Thread Karen Tracey
On Mon, Jul 16, 2012 at 3:45 AM, Erlend Dalen wrote:

> I'm using Django 1.0 (beta_1) and have the following issue:
> I have a method in a model that returns a calculated value and I would
> like this value to be displayed in the admin edit form related to that view.
> I have no problem showing the field in the list_display, but if I add it
> to fields in the fields property in the ModelAdmin, I get an error message
> saying that there is no such key.
>
> Is there an easy way of solving this?
>

You can do this with readonly_fields in admin:
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.readonly_fields

You'll need to upgrade from that ancient level of Django though,
readonly_fields were introduced in 1.2.

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: runserver and the tty echo flag

2012-06-24 Thread Karen Tracey
On Tue, Jun 5, 2012 at 9:18 AM, Bill Freeman  wrote:

> I have been noticing in recent Django versions (I don't remember it in
> 1.2, probably) that having run the development server, the tty's echo
> flag is set afterwards, no matter its value before.  (I frequently run
> from an emacs shell window, which has echo off because emacs will have
> "echoed" the text into the window long before it is sent to the pseudo
> tty.)
>
> I would expect most programs that fiddle with the tty configuration to
> restore it on exit.
>
> So, is this intentional, or a regression that I should try to help find
> and fix?
>
>
It was an intentional change, a fix for:
https://code.djangoproject.com/ticket/15565

Code as initially written has already required  a couple of changes to work
properly in unanticipated environments. If you've got another such fix feel
free to open a ticket with suggested improvement.

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: help regarding timezone

2012-06-20 Thread Karen Tracey
On Wed, Jun 20, 2012 at 7:35 AM, Darshan  wrote:

> hi all,
>
> I am actually new user for django, when i tried running example from site
>
> " from django.utils import timezone " it gives error no module timezone and i 
> changed TIME_ZONE='Asia/Calcutta' ... i dono why error..
>
>
> The timezone module you are trying to import is new in Django 1.4. What
level of Django are you running?

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django installation error

2012-05-24 Thread Karen Tracey
On Thu, May 24, 2012 at 4:19 PM, jggal...@prodigy.net.mx <
jggal...@prodigy.net.mx> wrote:

> D:\python_27\Lib\site-packages\Django-1.4>python
> Python 2.4.5 (#1, Jul 22 2011, 02:01:04)
>

Python 2.4 is too old for Django 1.4. You need to have Python 2.5, 2.6, or
2.7 installed, see:
https://docs.djangoproject.com/en/1.4/intro/install/#install-python

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to add Profile field to User change list ?

2012-05-13 Thread Karen Tracey
On Tue, May 8, 2012 at 4:12 AM, yillkid  wrote:

> INSTALLED_APPS = (
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.admin',
>
> 'project.auth',
> )
>

You've got two apps named "auth", this won't work. Rename you project
"auth" app to something other than "auth".

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django- accessing items in a python dictionary

2012-04-29 Thread Karen Tracey
On Sun, Apr 29, 2012 at 6:01 AM, Alan Mo  wrote:
> My dictionary is as follows:
>
> data={"BE1234":"abc", "BA3212":"efg", etc}
>
> I call it through django templates. According to the online manual, they say
> "if your context contained a dictionary data, the following would display
> the keys and values of the dictionary":
>
> {% for key, value in data.items %}
> {{ key }}: {{ value }}
> {% endfor %}
>
> I get the error: TemplateSyntaxError: 'for' statements with five words
> should end in 'reversed': for key, value in data.items

What version of Django are you using? This particular error message
was removed from Django five years ago (before Django 1.0):

https://code.djangoproject.com/changeset/5443

(not-so-coincidentally when the support for iterating over dictionary
items like you are trying was added).

If you are changing and old project you'll need to stick to docs from
the version of Django you have, or upgrade the project. If you are
just starting out you should definitely delete whatever Django you
have installed and start with 1.4 instead.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: URL resolution in a Django template

2012-04-28 Thread Karen Tracey
On Sat, Apr 28, 2012 at 3:04 PM, LJ  wrote:
> In other words, if I have two methods with the same name, but each in
> a different directory, how would Django know which method to call?

By "method" here I think you are meaning "url pattern" (specifically,
get_required_meeting_participants in your example snippet). The answer
is Django would not know which one to call if you have named two
different url patterns with the same name. This case is documented to
be "undefined behavior", see the note under:
https://docs.djangoproject.com/en/1.4/topics/http/urls/#id2

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Cannot add/save flatpages via admin???

2012-04-28 Thread Karen Tracey
This was a bug in the flatpage form validation, where it would throw
an exception rather than give you an error message if you did not
specify any values for the required sites field. Fixed now on git
master. You can also avoid it by being sure to select at least one
site for the page.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



[no subject]

2012-04-23 Thread Karen Tracey


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: UnboundLocalError: local variable 'KeyError' referenced before assignment

2012-04-09 Thread Karen Tracey
On Mon, Apr 9, 2012 at 11:09 AM, Casey Greene  wrote:
> I have this very baffling error that I'm dealing with at the moment.
> I'm maintaining someone else's code and I'm getting this error for
> some queries with a try, except block in a view.  It seems that the
> queries that lead to the error are ones where there is, in fact, a
> KeyError.  I've actually manged to narrow it down to a pretty simple
> test case though.  Within the view, I can do this (first few lines):
>
> def gene_view(request, slug=None, gene=None, org=None, template=None):
>   print(KeyError)
>
> and I get this exception with django 1.4 (if it matters):
> UnboundLocalError at /predictions/gene/
> local variable 'KeyError' referenced before assignment

Python thinks KeyError is a local variable, thus it sounds like code
in the view subsequent to where KeyError is caught makes an assignment
to KeyError. So search later in the view for where KeyError is
mis-assigned.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: VERY strange unicode encode error on internet connection

2012-03-18 Thread Karen Tracey
On Sun, Mar 18, 2012 at 8:37 AM, ionic drive  wrote:
> hello django friends,
>
> I am facing a VERY strange unicode encode error on internet connection.
> No Error when network(LAN/internet) is disabled.
>
> Situation:
> 
> In a template I do have a link to a site(google) in this a URL a '/u' is
> included.
>
> I am testing this in my virtual-machine so I can turn on and off internet
> connection.
> the server is in my virtual-machine and the browser is in this
> virtual-machine too.
> So I am able to test the site with "internet connection" and without
> "internet connection".
>
> Now the VERY strange behavior:
>
> When my internet connection is activated I do get the following Template
> Error:
>
>     Caught UnicodeDecodeError while rendering: 'ascii' codec can't
> decode byte 0xe2 in position 31: ordinal not in range(128)
>
> When my internet connection is disabled everything works fine.
>
>
> I did not know that my django - interpreter is internet connection related!?
>
> Please give me some insights on that problem.
>

Your code is going down some different paths in the two situations,
why that is the case is hard to speculate on without more information.
It's also pretty much impossible to give guidance on how to fix the
UnicoceDecodeError without the full traceback from it.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to display development server page

2012-03-18 Thread Karen Tracey
On Sat, Mar 17, 2012 at 1:23 AM, Alex Glaros  wrote:
> Newbie trying to run Django for the first time.
>
> I'm using a hosted Linux server; I run python manage.py runserver, and
> get:
>
> Validating models...
>
> 0 errors found
> Django version 1.3.1, using settings 'alexSite.settings'
> Development server is running at http://127.0.0.1:8000/
> Quit the server with CONTROL-C.
>
> But my browser doesn't see anything at http://127.0.0.1:8000/
>
> Any hints?  Where is the page, on my PC or the hosted server?

The page will be served by your linux host. However, you can't reach
your linux host from your PC using 127.0.0.1 as the IP address.
127.0.0.1 is a special "loopback" IP address. Traffic for it is never
routed off the local machine. The development server by default
listens only on 127.0.0.1, meaning you cannot reach it from other
machines. If you are trying to reach your linux host from a browser on
your PC using the 127.0.0.1 address, port 8000, what's happening is
your PC browser is trying to reach a server on port 8000 on your PC.
It's never going to find your linux host using the 127.0.0.1 address.

You can make the development server listen on all network interfaces
by starting it via "manage.py runserver 0.0.0.0:8000". (Doc:
https://docs.djangoproject.com/en/1.3/ref/django-admin/#runserver-port-or-address-port).
The all-zero address signals all network interfaces on the machine, so
you don't have to go hunting down the IP address of the linux host.
However to reach it from your PC you will need to know its hostname or
IP address so that you can specify it instead of 127.0.0.1 in the url.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: syncdb failure in new project with 1.4c2

2012-03-18 Thread Karen Tracey
On Sat, Mar 17, 2012 at 3:16 PM, Thomas Lockhart
 wrote:
> locale.getdefaultlocale() should return something other than (None,None) if
> environment variables are set but istm that this should fail gracefully (or
> not fail at all; the ticket suggests a solution using a different call which
> does return a non-None on my system).

Yes, it should fail gracefully and it currently doesn't. The ticket is
still open, that's why you still see this failure in 1.4rc1.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: sending django email via gmail

2012-03-14 Thread Karen Tracey
2012/3/14 infinitylX :
> 465 is a port for gmail and code i provide is completely working...
> but question is why django is not working with same settings...

Because, as JJO stated, the code you show is NOT what Django does when
establishing a secure email connection. The code you showed
establishes an SSL connection to the email server. The
smtplib.SMTP_SSL method you show is a feature new in Python 2.6.
Django still supports Python 2.5, so cannot use this method. The older
way of establishing a secure connection to an email server is to begin
with a non-encrypted connection and upgrade it to secure via the
STARTTLS command. This is what Django does when you specify
EMAIL_USE_TLS=True. Gmail doc notes that for the TLS/STARTTLS case,
you need to use port 587:
http://support.google.com/mail/bin/answer.py?hl=en&answer=13287

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: poll application

2012-03-14 Thread Karen Tracey
On Wed, Mar 14, 2012 at 5:42 AM, Yasmine El_Badry
 wrote:
> Hi
> I'm making a poll application using this tutorial
> https://docs.djangoproject.com/en/1.3/intro/tutorial02/
> but when i add this line "list_display = ('question', 'pub_date')"  to
> the admin.py , it gives me an error
> it worked once and when i continued the tutorial , it gave me error so
> i have to remove it
> Any help ??

What error? It's hard for people to help you when you omit key
information such as the error you were seeing.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How can I print form errors from inside the test

2012-03-14 Thread Karen Tracey
The most common reason I have seen for is_valid() to return False but
errors to be empty is for the form to be unbound. Unbound forms are
never valid, but they also don't have any errors. Which goes to
Daniel's question: how exactly have you "preloaded" the form with
data?

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Live search

2012-03-07 Thread Karen Tracey
On Mon, Mar 5, 2012 at 11:25 AM, larry.mart...@gmail.com
 wrote:
> I'm fairly new to django, still working on my first project.
>
> I have a page with some selection fields and a button. The user clicks
> the button, I run a query, and display the result set on the page.
> Works fine.
>
> Now I was to add a live search field to allow the user to further
> winnow down the result set. As they type in this field, the displayed
> result set will be filtered and re-displayed. But I can't figure out
> how to return control to my code as they type in that field. I assume
> I'll have to write some javascript code to get the events and collect
> the entered text, but how do I then pass that to my python code that
> would have the result set available to it? Or am I thinking about this
> wrong - do I have to do it all in javascript?
>

Further narrowing down the set you've already fetched would most
easily be done just with javascript. If you don't need any additional
data from the server then going back to the server for further
processing just complicates things.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to show the template reserved keyword on html.

2012-02-19 Thread Karen Tracey
On Mon, Feb 20, 2012 at 2:00 AM, Morris  wrote:

> Hi all,
>
>   I would like to write some django note via template. I tried to
> show ""{{ sample }}"" on my website, but it's empty. I think django
> think it's a variable name.
>
>   So, how to show {{ sample }} ? On the other hand, how to show
> template reserved word?
>
>
I think you want this:

https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#templatetag

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Group Moderation

2012-01-27 Thread Karen Tracey
On Wed, Jan 25, 2012 at 12:36 PM, Alec Koumjian  wrote:

> I posted early yesterday and still haven't been approved to post or
> comment. I could not find an administrative contact. Please advise.
>
>
Apologies -- something seems to have broken with the google groups
moderation emails -- I have not been getting them lately. There were nearly
100  items queued for moderation, so I'd guess none of the other moderators
were getting them either. For right now I have cleared the queue (passing
most things through, apologies if some are duplicates and marking as spam
things that were obvious spam). Hopefully I will have some time later today
to see if I can figure out why moderation emails have stopped getting sent
out to the moderators

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Testing Error Pages

2012-01-07 Thread Karen Tracey
On Wed, Jan 4, 2012 at 11:40 AM, Colin  wrote:

> What's the best way to go about testing them please?
>

https://docs.djangoproject.com/en/1.3/ref/contrib/staticfiles/#django-admin-option---insecure

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: UnicodeDecodeError

2012-01-05 Thread Karen Tracey
On Thu, Jan 5, 2012 at 8:16 AM, César Frias  wrote:

> I guess you have some files without the # -*- coding: utf-8 -*- on the top
> of the file
>
> You will need this if you want to use some letters like é or ç...
>
>
No, you get a different exception if you are missing the encoding
declaration in a Python file that contains non-ASCII characters. In that
case you get a SyntaxError that complains specifically about the missing
encoding declaration.

Getting an error from the utf8 codec attempting to transform a bytestring
to unicode implies you've got some bytestring data that is assumed to be
encoded in utf8 but is in fact using some other encoding. Since this is
happening when rendering a template, my guess would be the template file's
encoding is something other than utf8. Django has a setting (
https://docs.djangoproject.com/en/1.3/ref/settings/#file-charset) that
controls what encoding is assumed for files read from disk, it defaults to
utf8. Either fix the encoding of the template file to be utf8 or change
that setting to match whatever encoding is being used for all your template
files on disk.

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django 1.4 timeline

2011-12-25 Thread Karen Tracey
On Sun, Dec 25, 2011 at 11:34 AM, Sells, Fred
wrote:

> **
>
> Any guesses on schedule?
>

https://docs.djangoproject.com/en/dev/releases/1.4-alpha-1/#the-django-1-4-roadmap

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: question about django-admin.py

2011-12-25 Thread Karen Tracey
On Sun, Dec 25, 2011 at 10:03 AM, Chen Xu  wrote:

> It seems like some changes have been made to the most recent django
> version?


Yes. See:
https://docs.djangoproject.com/en/dev/releases/1.4/#updated-default-project-layout-and-manage-py

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: new tables missing from admin page

2011-12-20 Thread Karen Tracey
No, it doesn't happen automatically. (Unless prior to this change you were
using plug-in apps that all provided an admin.py file to register their
models.) For any models in apps you write, you must explicitly register
them with admin in order for them to be visible in admin.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: TemplateSyntaxError at /admin/ Caught AttributeError while rendering: 'NoneType' object has no attribute 'id'

2011-12-20 Thread Karen Tracey
People would be able to help you more effectively if you included the stack
trace that goes with the exception.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ModelForms and ProcessFormViews w models containing BooleanFields

2011-12-20 Thread Karen Tracey
Specify blank=True on the model field. When a ModelForm is created, the
default value for a model form field's "required" attribute is based on the
corresponding model field's "blank" attribute.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Translating templates

2011-12-14 Thread Karen Tracey
On Wed, Dec 14, 2011 at 3:13 PM, Demetrio Girardi <
demetrio.gira...@gmail.com> wrote:

> My project has a bunch of text embedded deep within the html markup in
> templates that I need to translate. The text, imo, belongs to templates
> and it
> has no place in the application logic.
>
> From what I understand, localization in templates is limited to variables,
>

That's not correct, where did you get that idea?


> which is not useful to me. For example, I'll have a template like this:
>
> > 
> > We are the greatest company in the world. yadda yadda.
> > 
> > {% actual useful stuff%}
> > A lot of other useless text otherwise the page isn't professional
> > enough 
>

You use the trans template tag to mark plain strings in template code for
translation, blocktrans if the strings have variables embedded in them. See
ttps://
docs.djangoproject.com/en/1.3/topics/i18n/internationalization/#specifying-translation-strings-in-template-codefor
details. E.g.:

 
{% trans "We are the greatest company in the world. yadda yadda." %}

{% actual useful stuff%}
 {% trans "A lot of other useless text otherwise the page isn't
professional
 enough" %} 

Once all strings are marked, you use the makemessages command (
https://docs.djangoproject.com/en/1.3/topics/i18n/localization/#message-files)
to generate message files, and that's what you hand to translators to
translate.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django testing and unique=True

2011-12-13 Thread Karen Tracey
On Tue, Dec 13, 2011 at 8:33 AM, Acruax  wrote:

> Hi,
> I have a problem with model testing. My test fails with error:
>  IntegrityError: duplicate key value violates unique constraint
> "catalog_name_key"
>  DETAIL: Key (name)=(test_catalog1) already exists.
>
> I have unique=True on name field.
>
> class CatalogTestCase(unittest.TestCase):
>def setUp(self):
>self.catalog1 = Catalog.objects.create(name="test_catalog1",
> title_ru="Test Catalog1")
>

For tests that use the database, you need to extend from
django.test.TestCase, not unittest.TestCase. Django's custom TestCase will
ensure that the database is reset to its initial state between tests (see
https://docs.djangoproject.com/en/1.3/topics/testing/#testcase). The need
for using Django's custom TestCase is unfortunately not currently properly
noted in the docs, and there is a ticket open on that (
https://code.djangoproject.com/ticket/17312).

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: List of Django release dates?

2011-12-11 Thread Karen Tracey
On Sun, Dec 11, 2011 at 8:03 AM, Tim Chase
wrote:

> but extracting it from django-dev mail archives would have taken a LOT of
> the aforementioned spelunking.


Reading the weblog starting from back in 2005 is kinda fascinating though.
Did you know the Django session cookie name used to be "hotclub"?

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Bulk import of data

2011-12-03 Thread Karen Tracey
On Sat, Dec 3, 2011 at 9:37 PM, Nathan McCorkle  wrote:

> when you say 'as long as you don't use the ORM for inserts',


You do not want to be building and saving objects individually with the
ORM. You want to be using some form of bulk insert. Django 1.4 will add
bulk create capability (see
https://docs.djangoproject.com/en/dev/ref/models/querysets/#bulk-create).
Prior to 1.4 you can use the development trunk level code, or you can find
other libraries that provide bulk insert (see for example
http://ole-laursen.blogspot.com/2010/11/bulk-inserting-django-objects.html).
http://www.caktusgroup.com/blog/2011/09/20/bulk-inserts-django/ mentions
the kinds of speedups you can expect with using a bulk insert technique vs.
creating objects individually with the ORM.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: double trailing slash in url

2011-12-02 Thread Karen Tracey
On Thu, Dec 1, 2011 at 6:34 PM, Brian Craft wrote:

> I don't think so. It's not issuing a redirect. It's just serving the
> view, even though the url spec doesn't match.
>
>
I suspect your web server is collapsing the multiple slashes into a single
one, so that the Django code doesn't even see them.

Try using the dev server to access the url with multiple slashes -- the dev
server won't collapse the slashes,  so I suspect you'll see the 404 you are
expecting for that case.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: division breaks makemessages djangojs

2011-12-02 Thread Karen Tracey
On Thu, Dec 1, 2011 at 6:09 AM, Michael  wrote:

> [snipped description of makemessages for javascript failing to find some
> strings]
>

>
I am using Django 1.3.1,
>
> Well, I am happy again since I found out what the problem is. I write
> this here, because I havent found out how to report the bug -- anyway,
> probably someone should try to reproduce this.
>

https://code.djangoproject.com/changeset/16333 completely replaced the
Javascript parsing code used by makemessages, fixing several known problems
with that code. That change was done after 1.3 was released, and was not
back-ported to the 1.3.X branch, so it will be available in an official
release with 1.4.

I expect if you try your problematic Javascript code with current Django
svn trunk code, it will find all the strings correctly. If it does not then
the way to report the problem would be to open a ticket here:

https://code.djangoproject.com/newticket

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: help_text line continuation

2011-11-14 Thread Karen Tracey
On Mon, Nov 14, 2011 at 1:27 AM, Mike Dewhirst wrote:

> I have been using the Python line continuation symbol +\ in my models
> help_text when my text goes beyond column 80 in my editor.
>
> I just accidentally omitted it for a continued line and discovered it
> doesn't seem to be needed!!!
>
> Is that a feature of Django's admin app or a trap for the unwary?
>
>
It's a feature of the language Python:
http://docs.python.org/reference/lexical_analysis.html#string-literal-concatenation

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: [Django] #17167: ModelForm model=class not honoring reference fields with secondary database

2011-11-05 Thread Karen Tracey
On Sat, Nov 5, 2011 at 1:33 PM, Furbee  wrote:

> No, that is incorrect. The Foreign key does not cross database boundaries.
> The employee table is in the secondary database, and the department table
> is also in the secondary database. The foreign key from from the employee
> table to the department table, both in the same secondary database.
>
>
OK, I found the ticket description very hard to follow so apparently
misunderstood. You don't mention having code any database routers for your
setup, that may be what you are missing. I don't believe you can do what
you are trying to do with just saying using('alternate_db') on retrieval of
an instance. I think you will need to code some database routing (
https://docs.djangoproject.com/en/1.3/topics/db/multi-db/#database-routers)
for this.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django aggregation does excessive GROUP BY clauses

2011-11-01 Thread Karen Tracey
On Tue, Nov 1, 2011 at 6:19 PM, christian.oudard  wrote:

> I am doing a very simple aggregation using the Django ORM, and it is
> producing a GROUP BY clause that includes the data field, which is
> very large, and is slowing down the query by over 100-fold.
>
> Here is a simplified version of the model:
>
> class Document(models.Model):
>data = models.TextField()
>
> class Attachment(models.Model):
>document = models.ForeignKey(Document)
>
> And the query I am running:
>
> Document.objects.annotate(num_attachments=Count('attachment'))
>
>
The SQL generated by the ORM for this query changed between Django version
1.2 and 1.3. The 1.2 SQL did a group by only on the id field. With 1.3
we're getting id twice and then all other fields in the model. Bisection
shows the change was made with r14715:

https://code.djangoproject.com/changeset/14715

It certainly looks to me like the old SQL was correct and preferable for
this particular case. In a brief search I did not find a ticket reporting
this issue -- could you open one?

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: User data being exposed with mod_wsgi/apache

2011-11-01 Thread Karen Tracey
On Tue, Nov 1, 2011 at 4:40 PM, Jennifer Bell wrote:

>def
> __init__(self,data=None,files=None,initial={},first_update=False,user=None,
> report=None):
>   if user and user.is_authenticated() and
> UserProfile.objects.filter(user=user).exists():
>   initial[ 'author' ] = user.first_name + " " + user.last_name
>   initial[ 'phone' ] = user.get_profile().phone
>   initial[ 'email' ] = user.email
>
> super(ReportUpdateForm,self).__init__(data,files=files,initial=initial)
>
> >
>
> ... I'm guessing because the 'initial' declaration in the form
> constructor prototype is not on the stack, like I would have thought.
> Changing the view to construct the ReportUpdateForm like so:
>
>  "update_form": ReportUpdateForm(user=request.user,
> initial={}),
>

This is a classic learning Python gotcha, see for example:
http://www.ferg.org/projects/python_gotchas.html#contents_item_6

which describes the why in a fair amount of detail.

You should really replace initial={} in the __init__ definition with
initial=None and replace None with an empty dictionary inside the method
body...otherwise you are relying on all ReportUpdateForm callers to do the
right thing (that is, always specify initial, even though it's not
"required") to prevent that default initial dictionary from getting
modified.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Can't add superuser

2011-10-31 Thread Karen Tracey
On Mon, Oct 31, 2011 at 8:43 AM, rihad  wrote:

> Hi, I'm unable to add superuser. Running latest development trunk of
> Django, & Python 2.7
>
>
This has been reported: https://code.djangoproject.com/ticket/16017

One way to fix it would be to get a locale properly set on your machine.
Another would be to read that ticket and try patching your Django with one
of the patches attached there.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: lazy queryset

2011-10-25 Thread Karen Tracey
On Tue, Oct 25, 2011 at 7:39 PM, druce  wrote:

> Tried every other way I could think of. Any idea what I have to do to
> force it to requery the database?
>

Sounds like you are a victim of the default REPEATABLE READ MySQL/InnoDB
transaction isolation level.

See this ticket for more details:
https://code.djangoproject.com/ticket/13906, including how to specify an
init command for the DB that can be used to switch it to use READ COMMITTED,
for example.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: block behavior does not work as documented with respect to autoescape

2011-10-25 Thread Karen Tracey
On Tue, Oct 25, 2011 at 11:10 AM, psbanka  wrote:

> Am I reading the documentation wrong, or is there a Django error here?
>

There's a bit of an oddity in Django here, that actually has nothing to do
with autoescape. There are three "built-in" tags (block, extends, and
include) that are only made available as built-ins as a side-effect of
importing the loader module within django.template. So you get the error you
noticed if you try to create a Template that uses one of these tags without
ever importing django.template.loader. But if you import loader, all works
as per the doc you pointed to:

Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> ts = """
... {% autoescape off %}
...   {% block title %}{{ hello }}{% endblock %}
...   {% block content %}
...   {% endblock %}
...   {% endautoescape %}
... """
>>> from django.template import Template, Context
>>> t = Template(ts)
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Users\kmtracey\django\trunk\django\template\base.py", line 124,
in __init__
self.nodelist = compile_string(template_string, origin)
  File "C:\Users\kmtracey\django\trunk\django\template\base.py", line 152,
in compile_string
return parser.parse()
  File "C:\Users\kmtracey\django\trunk\django\template\base.py", line 269,
in parse
compiled_result = compile_func(self, token)
  File "C:\Users\kmtracey\django\trunk\django\template\defaulttags.py", line
475, in autoescape
nodelist = parser.parse(('endautoescape',))
  File "C:\Users\kmtracey\django\trunk\django\template\base.py", line 267,
in parse
self.invalid_block_tag(token, command, parse_until)
  File "C:\Users\kmtracey\django\trunk\django\template\base.py", line 322,
in invalid_block_tag
(command, get_text_list(["'%s'" % p for p in parse_until])))
TemplateSyntaxError: Invalid block tag: 'block', expected 'endautoescape'
>>> from django.template import loader
>>> t = Template(ts)
>>> t.render(Context({'hello': 'This & that'}))
u'\n\n  This & that\n  \n  \n  \n'
>>>

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Clearly I do not understand something in templating

2011-10-15 Thread Karen Tracey
On Sat, Oct 15, 2011 at 8:51 AM, Piotr Hosowicz  wrote:

> Hello,
>
> This is in views.py :
>
> def campaign(request, campaign_id):
>ctx = {'phones': PersonPhones.objects.all(), "camppeople":
> CampPeople.objects.all() }
>return render_to_response("campaign.html", ctx,
> context_instance=RequestContext(request))
>
> This is the template :
>
> 
>
> {% for piplok in camppeople %}
> {% if piplok.camppeople.docall %}
>

Based on your previous mail, CampPeople instances have a docall field.
piplok is a CampPeople instance, since you have passed in a queryset of
CampPeople in the 'camppeople' variable and are iterating through it in the
for loop. So I expect this should be:

{% if piplo.docall %}

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



  1   2   3   4   5   6   7   8   9   10   >