Re: Query: Field of model "not defined", but existing

2008-10-21 Thread Karen Tracey
On Tue, Oct 21, 2008 at 6:55 AM, Micha Pietsch <[EMAIL PROTECTED]> wrote:

>
> Hi,
> I've got a model "Note" with a DateTimeField "updated". I ran dbsync and
> entered some data but making the query
> "n = Note.objects.filter(owner=request.user.id
> ).exclude(updated__tle=datetime.datetime.now())"
> tells me that "updated" is "not defined". Without the exclude statement it
> works, I also imported "datetime".
> Anybody got an idea of what could be the problem?
>

It is a little hard to be sure because your problem description is not very
precise.

It is unclear if you created a model Note with a field named updated, or
added a field named updated to an existing model Note.  If the latter,
syncdb would not do anything -- syncdb only creates tables, it does not make
changes like adding/changing/removing columns.

The actual error you received (including traceback) would make it clear if
this was the problem, since it would show if it was the database or Django
code that objected to "updated" on the grounds it was "not defined".  This
condensing of the actual error you see into summary form makes it hard to
tell where it is really coming from, though.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: what is the status of inline unique_together non-fatal error messages?

2008-10-21 Thread Karen Tracey
On Tue, Oct 21, 2008 at 11:39 AM, bobhaugen <[EMAIL PROTECTED]> wrote:

>
> I mean the normal displayable and user-correctable form validation
> errors, not the fatal database IntegrityError.
>
> I found
> http://groups.google.com/group/django-users/browse_thread/thread/f0e245366b02411b/df6d03f32eb37f93
> and
> http://www.djangosnippets.org/snippets/338/
> both more than a year old.
>
> In the first thread, Malcom Tredinnick says it's waiting for model-
> aware validation.
>
> The problem with overriding clean() in a form to do this is that for
> inlines, the parent foreign key value is missing, so you can't check
> for an existing record with the unique_together values.
>
> This thread in django-developers explains the problem in more detail,
> but also says "'wait for model-aware validation".  It's also a year
> old.
>
> http://groups.google.com/group/django-developers/browse_thread/thread/276fae9d4132225b/90324852d4e95426
>
> Any more progress, workarounds or tips?
>

Have you tried whatever scenario you are particularly interested in on 1.0
or current code?

Though general model validation did not make it into 1.0, checking of unique
and unique_together was added in changeset [8805].  It may not cover the
inline/missing parent foreign key value case, though -- I haven't tried
that.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Setting up Django on CentOS5 with flup and fastcgi

2008-10-21 Thread Karen Tracey
On Tue, Oct 21, 2008 at 11:50 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>wrote:

>
> Hello,
>
> I am a webhosting provider that is trying to set up django on my
> server so that my clients can utilise it for their own programs.
>
> Although we do not allow ssh access our only ability to allow them
> access is to use fastcgi
>
> Although i am having trouble with doing so. Is there any tutorials
> that anyone knows of that will aid me to successfully setting up
> django to allow for shared hosting accounts to use it.
>
> I run on CentOS 5 and have python 2.4 with django 1.0 stable.
>

I assume you have read this page:

http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/

?

Specifics of the trouble you are running into would help people provide
guidance, without specifics it's hard to say what might be going wrong.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: what is the status of inline unique_together non-fatal error messages?

2008-10-21 Thread Karen Tracey
On Tue, Oct 21, 2008 at 12:36 PM, bobhaugen <[EMAIL PROTECTED]> wrote:

>
> On Oct 21, 10:59 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > Have you tried whatever scenario you are particularly interested in on
> 1.0
> > or current code?
> >
> > Though general model validation did not make it into 1.0, checking of
> unique
> > and unique_together was added in changeset [8805].  It may not cover the
> > inline/missing parent foreign key value case, though -- I haven't tried
> > that.
>
> Karen, thanks for the reply.  But no luck.
>
> Just downloaded revision 9240.
>
> Tried unique_together constraint in admin both plain and with a form
> that overrode clean().
> Parent foreign key value is still None.  Can't check unique_together.
>

Well then the next step I would try is testing out the current patch for
general model validation, which is ticket #6845:

http://code.djangoproject.com/ticket/6845

Status on this was most recently reported here, I think:

http://groups.google.com/group/django-developers/browse_thread/thread/6143408977f7ad/d09c52e1fb561469
?

If the case you are interested in isn't covered by the current patch and is
not called out as something that isn't handled yet in the status (which I
have not read closely, so I don't know one way or the other) you might want
to bring it up as an issue either in the ticket or as a response to that
status note.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: what is the status of inline unique_together non-fatal error messages?

2008-10-21 Thread Karen Tracey
On Tue, Oct 21, 2008 at 2:35 PM, bobhaugen <[EMAIL PROTECTED]> wrote:

>
> On Oct 21, 12:34 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > Well then the next step I would try is testing out the current patch for
> > general model validation, which is ticket #6845:
> >
> > http://code.djangoproject.com/ticket/6845
> >
> > Status on this was most recently reported here, I think:
> >
> > http://groups.google.com/group/django-developers/browse_thread/thread...
>
> That status message says:
> > known Issues
> > =
> >
> > * InlineFormSet.save_as_new is broken
>
> I do see a change in the last patch
> http://code.djangoproject.com/attachment/ticket/6845/6845-against-9226.diff
> for BaseGenericInlineFormSet, to preserve the parent foreign key for
> validation.
> But I don't think that's what Admin uses.
>

I don't know -- this isn't a case I've looked at, and I haven't tried that
patch myself yet.  One other ticket I just noticed that you might want to
keep an eye on is:

http://code.djangoproject.com/ticket/8882

That may be the exact case you are concerned with and it may get fixed
sooner than overall model validation gets into the code, but I'm just
guessing, since I'm not actually working on either of them myself.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: callable upload_to problem

2008-10-21 Thread Karen Tracey
On Tue, Oct 21, 2008 at 7:42 PM, Brot <[EMAIL PROTECTED]> wrote:

>
> Is there nobody who can help me with my problem? Is this a bug and
> should I open a ticket or is it my fault?
>
>
It's either a bug or behavior that needs more explicit documentation.  The
problem is that upload_to is called when the field is saved (that is when
the form data is copied to the new/changed model instance), and the model is
saved field-by-field in (apparently, excepting for id which comes first) the
order they are declared in the model.  So, since your ImageField is declared
before desc, desc has not yet been set in the model instance when upload_to
is called.  If you switch the order of the fields in the model your
upload_to will be able to access the desc that has been entered in the form.

I tend to think it's a bug and file-type fields should be saved after
non-file fields, since the doc here:

http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.FileField.upload_to

only mentions the primary id field as one you cannot rely on in upload_to.
But even if I'm wrong about that it deserves a ticket since either the code
should be fixed or the doc should mention this behavior.

Karen


> On 20 Okt., 22:05, Brot <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > I am using the latest svn-revision 9236 and tried to use a callable in
> > the upload_to parameter of the ImageField.
> >
> > The explanation in the django-docs for the instance-parameter of a
> > callable says the following:
> >
> > > An instance of the model where the FileField is defined. More
> specifically, this is the particular
> > > instance where the current file is being attached.
> >
> > If I understand this right, I have access to all the input data of
> > this instance. If I have the following models.py
> >
> -
> > 01: from django.db import models
> > 02:
> > 03: def get_storage_path(instance, filename):
> > 04:""" defines the storage path for the photologue app """
> > 05:import os.path
> > 06:print "instance: %s" % (instance)
> > 07:print "desc: %s" % (instance.desc)
> > 08:return os.path.join('uploads', filename)
> > 09:
> > 10: class ImageModel(models.Model):
> > 11:image = models.ImageField('image', upload_to=get_storage_path)
> > 12:   desc = models.CharField(max_length=100)
> > 13:
> > 14:def __unicode__(self):
> > 15:return u'%s - %s' % (self.image, self.desc)
> >
> -
> > the print statement in line 7 should print all the data I inserted
> > into this variable in the admin. Is that right? In my case this is
> > always a empty string:
> >
> >
> -
> > [20/Oct/2008 21:52:47] "GET /admin/hp/imagemodel/add/ HTTP/1.1" 200
> > 2822
> > [20/Oct/2008 21:52:47] "GET /admin/jsi18n/ HTTP/1.1" 200 1915
> > instance:  -
> > desc:
> > [20/Oct/2008 21:52:54] "POST /admin/hp/imagemodel/add/ HTTP/1.1" 302 0
> > [20/Oct/2008 21:52:54] "GET /admin/hp/imagemodel/ HTTP/1.1" 200 1866
> >
> -
> >
> > Are there any suggestions?
> >
> > ~Bernd
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: NoReverseMatch, again...

2008-10-22 Thread Karen Tracey
On Wed, Oct 22, 2008 at 10:57 AM, Alberto Piai <[EMAIL PROTECTED]>wrote:

>
> Hi all,
>
> I'm referring to this thread from a couple of months ago:
>
> http://groups.google.com/group/django-users/browse_frm/thread/1f4bb991f9f0f7b5?hl=en&tvc=1
>
> I'm still having problems with the NoReverseMatch exception coming up
> with seemingly-random behavior.. or at least inexplicable to me.
>
> Everything works just fine with django's dev server. With other server
> arrangements, the exception shows up.


Other than the actual server code, are there any differences in config
between when you see this error and when you do not?  For example, DEBUG
setting, caching, etc.?

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: NoReverseMatch, again...

2008-10-22 Thread Karen Tracey
Also, can you recreate the problem on the most recent trunk or 1.0.X branch
code?  Your line numbers from the traceback don't match up with current so
I'm guessing you are using 1.0?  There have been at least a couple of fixes
in the reverse url area (though I don't know that any sound like a good
match to the erratic nature of this one) so it would be good to verify that
whatever this is is not a problem that has already been fixed.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Apache Django 15 Second Refresh

2008-10-22 Thread Karen Tracey
On Wed, Oct 22, 2008 at 11:31 AM, GPSGuy <[EMAIL PROTECTED]> wrote:

>
> Option One: Reloading Wrapper
> I now that there is caching going on, but I am still not sure why.  I
> did find a work around, though I would still like for someone to
> explain what is going on underneath.
>
>
Apache does not automatically re-load all of your Python code into memory
for each request.  Doing so would be an incredible performance hit for a
production environment where the code generally does not change very often.
So, once the code is loaded into a process it is re-used for as long as that
process is used to service requests (dependent on Apache configuration
parameters).  I am not sure why you are seeing a 15 seconds, exactly, since
generally it's a number of requests per child process that controls this,
but I am not an Apache configuration expert so there may be some other
config option that your server is using to control this.

The reason that you see the date/time change for each request but not a
variable you have changed in the view is that the code for generating the
date/time does not change, and it runs for each request, producing the
current date/time.  Your code runs for each request, but not necessarily the
most recent code on the disk.  Thus you have to wait for your code to be
re-loaded in order to see the variable value change reflected in the
generated response.

There are ways to configure Apache so that you can trigger it to reload your
code without a restart. For example, if you use mod_wsgi you can configure
things so that all you need to do is touch your script file to cause all
your code to be reloaded, see "Reloading Source Code" on this page:

http://code.google.com/p/modwsgi/wiki/FrequentlyAskedQuestions

Or, you can force the reload yourself by doing the view wrapping with
explicit reload as you have shown.  But really, it's much easier to just use
the development server.  I don't really understand why you'd rather use this
dedicated Apache that isn't really dedicated to you since restarting it
affects others.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Truncated incorrect DOUBLE value

2008-10-22 Thread Karen Tracey
On Wed, Oct 22, 2008 at 11:53 AM, urukay <[EMAIL PROTECTED]> wrote:

> Hi,
>
> v got this error, tried almost everything to get it right, but no effect.
> Can anynone pls help me with that?
> It happens when i submit the form:
>
> class AddPartnerForm(WTForm):
>
>def __init__( self, user,  *args, **kwargs ):
>super( AddPartnerForm, self ).__init__( *args, **kwargs )
>#create choices with empty value as default
>CHOICES = [('', '-'),]+ [(str(company.id), str(
> company.name)) for
> company in Company.objects.filter(Q(owner=user) | Q(editors=user))]
>self.fields['companies']._set_choices(CHOICES)
>
>ico = forms.IntegerField(label=_(u'ICO'), max_value=9)
>name = forms.CharField(label=_(u'Company name'), max_length=50)
>companies = forms.ChoiceField()
>

Here you've defined AddPartnerForm to take a first parameter of 'user' which
is used as a value to match in your Company filter.


> Company model is:
>
> class Company(AContact, ATag, ARating, AImage, ALog):
># owner of this recore - 'company admin'
>owner = models.ForeignKey(User, verbose_name=_("owner"), blank=False,
> null=False)
>
>name = models.CharField(_('name'), max_length=127)
>company_form = models.CharField(_('company form'),max_length=6,
> choices=FORMS)
>partners = models.ManyToManyField('Company', null=True, blank=True)
>

> and trace:
> Traceback:
> File "C:\Python25\lib\site-packages\django\core\handlers\base.py" in
> get_response
>  86. response = callback(request, *callback_args,
> **callback_kwargs)
> File "C:\Python25\lib\site-packages\django\contrib\auth\decorators.py" in
> __call__
>  67. return self.view_func(request, *args, **kwargs)
> File "D:\Workspace\yau\py\company\views.py" in add_partner
>  262.  form = AddPartnerForm(request.POST)


Here you create an AddPartnerForm passing in request.POST as the first
parameter, so that's what gets assigned to your 'user' variable in
AddPartnerForm __init__.  That's the QueryDict you see referenced in the
ultimate exception.  Your Company filter is trying to match against
owner=request.POST, etc. which doesn't work.  You seem to have neglected to
pass in the real 'user' value you want to use.


>
> File "D:\Workspace\yau\py\company\forms.py" in __init__
>  187.  CHOICES = [('', '-'),]+ [(str(company.id),
> str(company.name)) for company in Company.objects.filter(Q(owner=user) |
> Q(editors=user))]
> File "C:\Python25\lib\site-packages\django\db\models\query.py" in
> _result_iter
>  179. self._fill_cache()
> File "C:\Python25\lib\site-packages\django\db\models\query.py" in
> _fill_cache
>  612. self._result_cache.append(self._iter.next())
> File "C:\Python25\lib\site-packages\django\db\models\query.py" in iterator
>  269. for row in self.query.results_iter():
> File "C:\Python25\lib\site-packages\django\db\models\sql\query.py" in
> results_iter
>  206. for rows in self.execute_sql(MULTI):
> File "C:\Python25\lib\site-packages\django\db\models\sql\query.py" in
> execute_sql
>  1700. cursor.execute(sql, params)
> File "C:\Python25\lib\site-packages\django\db\backends\util.py" in execute
>  19. return self.cursor.execute(sql, params)
> File "C:\Python25\lib\site-packages\django\db\backends\mysql\base.py" in
> execute
>  83. return self.cursor.execute(query, args)
> File "C:\Python25\lib\site-packages\MySQLdb\cursors.py" in execute
>  168. if not self._defer_warnings: self._warning_check()
> File "C:\Python25\lib\site-packages\MySQLdb\cursors.py" in _warning_check
>  82. warn(w[-1], self.Warning, 3)
> File "C:\Python25\lib\warnings.py" in warn
>  62.   globals)
> File "C:\Python25\lib\warnings.py" in warn_explicit
>  102. raise message
>
> Exception Type: Warning at /company/9/add/partner/
> Exception Value: Truncated incorrect DOUBLE value: ' [u'9'], u'companies': [u'7'], u'name': [u'Uzivatelova'], u'submit': [u'Next
> =>']}>'
>
> I appreciate any help. Thanks!
>
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to avoid out of sync sequence for primary key using Postgresql?

2008-10-22 Thread Karen Tracey
On Wed, Oct 22, 2008 at 2:16 PM, cfobel <[EMAIL PROTECTED]> wrote:
> Does anyone definitively know whether MySQL automatically increments
> its sequences (or whatever their equivalent name is) even if records
> are manually inserted with a higher ID?

Seems to:

mysql> describe color;
+---+-+--+-+-++
| Field | Type| Null | Key | Default | Extra  |
+---+-+--+-+-++
| id| int(11) | NO   | PRI | NULL| auto_increment |
| value | varchar(10) | NO   | | ||
| warm  | tinyint(1)  | NO   | | ||
+---+-+--+-+-++
3 rows in set (0.02 sec)

mysql> insert into color (value, warm) values ('Red', 1);
Query OK, 1 row affected (0.00 sec)

mysql> insert into color (value, warm) values ('Blue', 0);
Query OK, 1 row affected (0.00 sec)

mysql> select * from color;
++---+--+
| id | value | warm |
++---+--+
|  1 | Red   |1 |
|  2 | Blue  |0 |
++---+--+
2 rows in set (0.00 sec)

mysql> insert into color (id, value, warm) values (8, 'Orange', 1);
Query OK, 1 row affected (0.00 sec)

mysql> insert into color (value, warm) values ('Green', 0);
Query OK, 1 row affected (0.00 sec)

mysql> select * from color;
+++--+
| id | value  | warm |
+++--+
|  1 | Red|1 |
|  2 | Blue   |0 |
|  8 | Orange |1 |
|  9 | Green  |0 |
+++--+
4 rows in set (0.00 sec)

This is with MySQL server 5.0.  Before depending on the behavior I'd
probably want to carefully read the docs about auto increment:

http://dev.mysql.com/doc/refman/5.1/en/example-auto-increment.html

Also, in your situation I don't know I'd be considering switching  DBs to
avoid the error you hit.  If I understand correctly, though you did not
intentionally manually assign IDs that should have been auto-generated,
somehow the sequence got out of sync with what was in the DB.  I'd really
want to understand how that happened and fix the root cause.  Whatever it is
that manually assigned IDs might cause worse problems down the road
(overwriting existing objects with new, doing unexpected things when a
manually assigned ID overlaps an already-in-use one, using an ID so high
that MySQL runs out of possible values, etc.).  I think I'd rather know
sooner rather than later that something screwy is going on with the auto-id
fields, myself, and it sounds like PostgreSQL will likely report the problem
sooner.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Following tutorial but can't get something

2008-10-22 Thread Karen Tracey
On Wed, Oct 22, 2008 at 5:15 PM, gryzzly <[EMAIL PROTECTED]> wrote:

>
> Hi,
> I was following tutorial from official docs step by step.
>
> So on part 4, at writing and processing simple form I am stuck with
> something. (here —
> http://docs.djangoproject.com/en/dev/intro/tutorial04/#write-a-simple-form
> ).
>
> I am writing my results view and pointing at it from polls/urls.py.
> And I am getting 500 error. Whatever I write in results view. Now, if
> I point matching regex from urls.py to some other view, like "details"
> that I've created before that, then it works.
>
> Here is the code:
>
> polls/urls.py:
>
> from django.conf.urls.defaults import *
>
> urlpatterns = patterns('mysite.polls.views',
>(r'^$', 'index'),
>(r'^(?P\d+)/$', 'detail'),
>(r'^(?P\d+)/results/$', 'results'),
>(r'^(?P\d+)/vote/$', 'vote'),
> )
>
> relevant view from polls/views.py (and it doesn't really matter what
> do I write there, anyway I get 500 error):
>
> def results(request, poll_id):
>p = get_object_or_404(Poll, pk=poll_id)
>return render_to_response('polls/results.html', {'poll': p})
>
> Here is an output of error message:
>
> Traceback (most recent call last):
>
> [shipped]
>  File "/usr/lib/python2.5/site-packages/django/template/loader.py",
> line 73, in find_template_source
>raise TemplateDoesNotExist, name
>
> TemplateDoesNotExist: 500.html
>
> Please suggest what I could do.
>

Well that traceback is not very helpful because it is just reporting that in
attempting to generate an error page the code ran across a 2nd error -- you
haven't created a 500.html template.  You need one of these, just like the
404.html template that the 3rd section of the tutorial mentions.

However, neither of those templates is particularly helpful when debugging,
since they just present generic "not found" or "error" pages.  For debugging
what's really going on you want to set DEBUG to True in your settings.py
file.  Then when you go to the page that is causing the error, you will get
a traceback showing where the original error is occuring, which will make it
much easier to figure out what is going wrong.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Dumpdata exception leaving me a bit puzzled.

2008-10-22 Thread Karen Tracey
On Wed, Oct 22, 2008 at 6:14 PM, perchance <[EMAIL PROTECTED]> wrote:

>
> [trimmed]
> python manage.py dumpdata app_label --traceback --indent 4 > fixtures/
> app_label.js
>
> And the traceback I get looks like this, with a sanitized model name
> substituted for the real thing.
>
> """
> Traceback (most recent call last):
> [snipped]
>  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
> python2.4/site-packages/django/db/models/query.py", line 308, in get
>raise self.model.DoesNotExist("%s matching query does not exist."
> django.db.models.base.DoesNotExist: Model matching query does not
> exist.
> ""
>
> The models.py is pretty simple. There are three models up top, each of
> which is linked to a root model by a ForeignKey field. That root model
> looks something like...
>
> """
> class Model(models.Model):
>title = models.CharField(max_length=300)
>fk_1 = models.ForeignKey(fk_1)
>fk_2 = models.ForeignKey(fk_2)
>fk_3 = models.ForeignKey(fk_3)
>
>def __unicode__(self):
>return u'%s, %s' % (self.fk_1, self.fk_2)
>
>class Meta:
>ordering = ['fk_1',]
> """
>
> The funny thing is that if I comment out that root model and run
> dumpdata again, everything goes swimmingly. So I'm guessing the
> problem is in there somewhere. As I've typed out this entirely too
> long email, I've started to think and maybe come up with the weird
> thing I did to screw it up. Would it matter if I initally imported
> that data outside of Django into the model and maybe stupidly left
> some of the FK fields null? Well, I think I'm going to go try that
> right now. If it's something else obvious, please let me know.
>

Assuming the fields are defined to Django to allow null, and are actually
null and not, say, 0, then I don't think nulls would cause this problem.
But it does sound like you've got foreign key values in this table that
don't actually have corresponding rows in the referenced tables.  I'm
assuming you've been using MyISAM on MySQL -- it does not enforce
referential integrity, so you can get into this situation pretty easily with
adds/upates/deletes done outside of Django's admin.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Following tutorial but can't get something

2008-10-22 Thread Karen Tracey
On Wed, Oct 22, 2008 at 6:30 PM, gryzzly <[EMAIL PROTECTED]> wrote:

>
> Hi Karen, I am sorry, the previous post is irrelevant. What you have
> seen is a result of changing of results view that I was doing before,
> to test what is going on.  (btw, I've noticed that firefox caches an
> error output, can I do something about it?) Thanks
>

Yeah, I've seen that.  I haven't investigated what causes it so I don't have
any ideas for how to fix it.


>
> So relevant error output looks like this:
>
> [snipped]
>
> Template Loader Error:
> Django tried loading these templates, in this order:
> Using loader django.template.loaders.filesystem.load_template_source:
> /home/misha/www/djcode/templates/polls/results.html (File does not
> exist)
> Using loader
> django.template.loaders.app_directories.load_template_source:
> /usr/lib/python2.5/site-packages/django/contrib/admin/templates/polls/
> results.html (File does not exist)
>
>
>
> Traceback:
> [snipped]
> File "/usr/lib/python2.5/site-packages/django/template/loader.py" in
> find_template_source
>  73. raise TemplateDoesNotExist, name
>
> Exception Type: TemplateDoesNotExist at /polls/1/results/
> Exception Value: polls/results.html
>
>
This seems pretty self-explanatory?  (It even prints out details on all the
places it is looking, exactly, for the template file.)  You don't seem to
have created the polls/results.html file.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Dumpdata exception leaving me a bit puzzled.

2008-10-22 Thread Karen Tracey
On Wed, Oct 22, 2008 at 6:37 PM, perchance <[EMAIL PROTECTED]> wrote:

>
> Thanks for the reply. I did not syncdb with any blank=True or
> null=True options on the foreignkeys, so the MySQL table does not
> allow null values. I just ran some group and counts from the mysql
> shell and it does indeed show that a number of records have a zero in
> their fk_id field. So I'm now leaning toward that being the problem,
> since it seems to match what the traceback is pointing to as a
> problem.
>
> So what's the right cleanup? Alter the column so it allows nulls,
> update the zeros to nulls and then flip some null=True options into my
> models.py?
>

That's probably what I'd try.

Karen


>
> On Oct 22, 3:29 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > On Wed, Oct 22, 2008 at 6:14 PM, perchance <[EMAIL PROTECTED]>
> wrote:
> >
> > > [trimmed]
> > > python manage.py dumpdata app_label --traceback --indent 4 > fixtures/
> > > app_label.js
> >
> > > And the traceback I get looks like this, with a sanitized model name
> > > substituted for the real thing.
> >
> > > """
> > > Traceback (most recent call last):
> > > [snipped]
> > >  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
> > > python2.4/site-packages/django/db/models/query.py", line 308, in get
> > >raise self.model.DoesNotExist("%s matching query does not exist."
> > > django.db.models.base.DoesNotExist: Model matching query does not
> > > exist.
> > > ""
> >
> > > The models.py is pretty simple. There are three models up top, each of
> > > which is linked to a root model by a ForeignKey field. That root model
> > > looks something like...
> >
> > > """
> > > class Model(models.Model):
> > >title = models.CharField(max_length=300)
> > >fk_1 = models.ForeignKey(fk_1)
> > >fk_2 = models.ForeignKey(fk_2)
> > >fk_3 = models.ForeignKey(fk_3)
> >
> > >def __unicode__(self):
> > >return u'%s, %s' % (self.fk_1, self.fk_2)
> >
> > >class Meta:
> > >ordering = ['fk_1',]
> > > """
> >
> > > The funny thing is that if I comment out that root model and run
> > > dumpdata again, everything goes swimmingly. So I'm guessing the
> > > problem is in there somewhere. As I've typed out this entirely too
> > > long email, I've started to think and maybe come up with the weird
> > > thing I did to screw it up. Would it matter if I initally imported
> > > that data outside of Django into the model and maybe stupidly left
> > > some of the FK fields null? Well, I think I'm going to go try that
> > > right now. If it's something else obvious, please let me know.
> >
> > Assuming the fields are defined to Django to allow null, and are actually
> > null and not, say, 0, then I don't think nulls would cause this problem.
> > But it does sound like you've got foreign key values in this table that
> > don't actually have corresponding rows in the referenced tables.  I'm
> > assuming you've been using MyISAM on MySQL -- it does not enforce
> > referential integrity, so you can get into this situation pretty easily
> with
> > adds/upates/deletes done outside of Django's admin.
> >
> > 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Generic Model Names in Admin List

2008-10-22 Thread Karen Tracey
On Wed, Oct 22, 2008 at 7:54 PM, jb. <[EMAIL PROTECTED]> wrote:

>
> I'm creating a site in Django and have run into an interesting problem
> that I can't seem to find the solution to.  Basically, I have models
> for my app called "Product" and "Category" and in the admin in the
> list of categories instead of the category name, it has "Category
> object"... same thing in the Product list... it has "Product object".
>
> What am I missing?  I know it's something simple.
>

You need to define a __unicode__ method for your models.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Dumpdata exception leaving me a bit puzzled.

2008-10-22 Thread Karen Tracey
On Wed, Oct 22, 2008 at 8:40 PM, perchance <[EMAIL PROTECTED]> wrote:

> I think added "null=True" to all each field in my models.py and ran
> dumpdata again. It seemed to hum along fine, but now I'm running into
> a new problem. I think dumpdata is aceing my Macbook Pro's memory. The
> database I'm trying to dump is about a half million records, so it
> just ground around for a while and then spit out.
>
> """
> Python(327) malloc: *** vm_allocate(size=8421376) failed (error
> code=3)
> Python(327) malloc: *** error: can't allocate region
> Python(327) malloc: *** set a breakpoint in szone_error to debug
> Out of memory (Needed 8164 bytes)
> Error: Unable to serialize database: (0, '')
> """
>
> Oh dear. Any idea how I can kill that?
>
>
Do you have DEBUG set to True in your settings.py?  That will eat memory
that is never released.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Accidentally creating a model with "def unicode(self):" will crash django with no stack trace

2008-10-22 Thread Karen Tracey
On Wed, Oct 22, 2008 at 9:45 PM, Brian <[EMAIL PROTECTED]> wrote:

>
> This might seem obvious, and I just spend a couple hours straining
> over it, so I thought I'd share.
>
> If you have a model, e.g.:
>
> def MyModel(models.Model):
># ...
># with a unicode function likeso:
>def unicode(self):
>   return 'something'
>
> This will crash Django, without a stack trace.
>
> Of course, the function is supposed to be "def __unicode__(self):",
> but it'd have been awful nice to be able to figure that out without
> rehashing the entire codebase (it seems like such an innocuous
> addition to the model at the time haha).
>
> Hopefully this will save someone some pain. :)
>
>
It will crash when you do what?  I don't see a crash, I just see models
reverting to being reported as "xzy object" in the Admin.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin & ForeignKey confusion

2008-10-22 Thread Karen Tracey
On Thu, Oct 23, 2008 at 12:23 AM, Tonne <[EMAIL PROTECTED]> wrote:

>
> n00b alert, btw:
> ---
>
> I'm very new to django so please forgive the stupid questions, but I'm
> struggling to get some very basic model relations to work. I'd be very
> grateful if someone could show me where I am going wrong.
>
> I have 2 incredibly simple models, where a Project would have one of
> many Medium types.
>
> So when in the admin form, I would like a project to have an option
> list of Mediums to choose from..
>
> (from work.models.py)
> 
> from django.db import models
>
> class Medium(models.Model):
>medium = models.CharField(max_length=20)
>
> class Project(models.Model):
>title = models.CharField(max_length=80)
>medium = models.ForeignKey(Medium)
> 
>
> ...this validates and SQL looks as it should.
>
> However, when I try to implement the Admin
>
> (from work.admin.py)
> 
> from portfolio.work.models import Project
> from portfolio.work.models import Medium
> from django.contrib import admin
>
>
> class MediumInline(admin.StackedInline):
>"""docstring for ClassName"""
>model = Medium
>extra = 3
>
> class ProjectAdmin(admin.ModelAdmin):
>inlines = [MediumInline]
>
> admin.site.register(Project, ProjectAdmin)
> 
>
> select I get an exception:
>  has no ForeignKey to  'work.models.Project'>
>
> Have I gotten my data modelling fundamentally incorrect, or am I doing
> something wrong in admin.py
>
>
You do not need inlines to be able to get a select box of Mediums to choose
from when adding/editing a Project in the Admin.  Try a simple:

admin.site.register(Project)

and see if that gives you what you are looking for.  If not you need to
describe better what you are looking for.

(Where you might use inlines for the models you have is Projects inlined on
the Medium admin page.  So when you went to edit a Medium, you would have a
list of all the Projects that use that Medium on the page, and you could add
to or edit them there.)

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to add custom validation to inline admin forms, overriding clean(self) or clean_FIELD(self) doesn't work.

2008-10-23 Thread Karen Tracey
On Thu, Oct 23, 2008 at 5:09 AM, Jacob Rigby <[EMAIL PROTECTED]> wrote:

>
> I have a custom ModelForm with a TabularInline child form.  I can edit
> and save without problems, and simple field validation is working (if
> a required field is missing from the inline form it shows a warning).
> But when I try to add custom validation methods to the inline form (in
> the same way I would for a typical ModelForm, via clean(self) method)
> the validator never gets called...
>
> Can anyone point me in the right direction here, maybe there is
> another class or method I should be overriding?
>

I'm not entirely sure, but I think this may be covered by this ticket:

http://code.djangoproject.com/ticket/8071

The specific use case identified there in the description (excluding a
field) was made to work via another fix, but it sounds like the larger
problem of admin not respecting form definitions for inline models still
exists.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Following tutorial but can't get something

2008-10-23 Thread Karen Tracey
On Thu, Oct 23, 2008 at 4:00 AM, gryzzly <[EMAIL PROTECTED]> wrote:

>
> It is self-expalnatory, but the problem is that I do have a template
> file. And it is there.
>

You're saying you have a file named:

/home/misha/www/djcode/templates/polls/results.html

?

Are you sure you have that exact file?  If you cut-and-paste that value
after 'cat ' in a command prompt, you see the file contents?  Or do you get:

cat: /home/misha/www/djcode/templates/polls/results.html: No such file or
directory

If cat can find the file but Django can't, there's something screwy going on
in your system.  It is far more likely that there is some subtle difference
between the name of the file you have on your system and the name you are
using in your code.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem when visit admin site for add a new item with manytomanyfield

2008-10-23 Thread Karen Tracey
On Thu, Oct 23, 2008 at 5:48 AM, IL <[EMAIL PROTECTED]> wrote:

>
> from django.db import models
>
> class Song(models.Model):
>name = models.CharField(max_length = 50, unique = True)
>lyricBy = models.CharField(max_length = 10, null = True, blank =
> True)
>coSinger = models.CharField(max_length = 10, null = True, blank =
> True)
>
>def __str__(self):
>return self.name
>
> class Album(models.Model):
>name = models.CharField(max_length = 50, unique = True)
>releaseDate = models.DateField(u'release date')
>songs = models.ManyToManyField(Song)
>
>def __str__(self):
>return self.name
>
> 
> This is my models (django 1.0)
>

If you are using Django 1.0, then your models need to have __unicode__
methods, not __str__ methods.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Confused by select_related()

2008-10-23 Thread Karen Tracey
On Thu, Oct 23, 2008 at 10:44 AM, AndyB <[EMAIL PROTECTED]> wrote:

>
> >>> p.residentialunitmix_set.all().query.as_sql()
>
> (u'SELECT `tbl_ResidentialUnitMix`.`id`,
> `tbl_ResidentialUnitMix`.`Planning-id`,
> `tbl_ResidentialUnitMix`.`quantity`,
> `tbl_ResidentialUnitMix`.`Bedrooms`, `tbl_ResidentialUnitMix`.`Type`,
> `tbl_ResidentialUnitMix`.`Tenure` FROM `tbl_ResidentialUnitMix` WHERE
> `tbl_ResidentialUnitMix`.`Planning-id` = %s '  , (82))
>
> >>> p.residentialunitmix_set.select_related().query.as_sql()
>
> (u'SELECT `tbl_ResidentialUnitMix`.`id`,
> `tbl_ResidentialUnitMix`.`Planning-id`,
> `tbl_ResidentialUnitMix`.`quantity`,
> `tbl_ResidentialUnitMix`.`Bedrooms`, `tbl_ResidentialUnitMix`.`Type`,
> `tbl_ResidentialUnitMix`.`Tenure` FROM `tbl_ResidentialUnitMix` WHERE
> `tbl_ResidentialUnitMix`.`Planning-id` = %s '  , (82))
>
> Tenure is a foreign key to another tables. How come both queries are
> identical?
>
> I am trying to sort by a field in the Tenure table and:
>
> residentialunitmix_set.select_related().order_by('tbl_lkp_ResidentialUnitMix_Tenure.sort')
>
> just gives an error. Looking at the queries explained why.
>
> (Apologies for the table names. It's a Django interface to something
> developed in Access)
>

You've rather jumped to the end problem without telling us the beginning
(model definitions).  Now it's maybe possible to puzzle out what's going on
based on the queries alone, but why make it so hard on us?  Ideally you'd
whittle it down to a minimal example that illustrates the problem you are
seeing (which by the way, you should spell out in as great a detail as is
presented to you -- "just gives an error" is about as useless a description
of a problem as "doesn't work"), but if you can't manage that at least post
the models you're actually working with.  On dpaste.com, not inline in the
post, if they are big/involved enough that the email//groups interface will
make them hard to read.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: model help.

2008-10-23 Thread Karen Tracey
On Thu, Oct 23, 2008 at 10:45 AM, Niall Mccormack <
[EMAIL PROTECTED]> wrote:

>
> ok, I'm going to simplify my question.
>
> is there any way that I can create a ForeignKey or a ManytToMany that
> can accept multiple types of data Models?
>

Since you seem to be in a hurry, without giving your scenario a whole lot of
thought, I'll recommend that you search the docs for "generic relations" and
read up about them.

Karen


> On 23 Oct 2008, at 11:34, Niall Mccormack wrote:
>
> >
> > Hi there,
> >
> > I'm learning Django at the moment and need some advice.
> >
> > I need to create sections in my website that can accept two different
> > models.
> >
> > i.e. a work section can have the following data
> >   title - CharField
> >   description - TextField
> >   url link -  URLField
> >
> >   media - a mixture of ImageFields and FileFields ( for videos )
> >
> >
> > how would I setup the model for the media? where I can add in either
> > type of Field and re-order them easily?
> >
> > Any advice would be appreciated
> >
> > Cheers
> > NIall
> >
> > >
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Confused by select_related()

2008-10-23 Thread Karen Tracey
On Thu, Oct 23, 2008 at 11:21 AM, AndyB <[EMAIL PROTECTED]> wrote:

>
> Apologies for not using DPaste. I thought the snippets were small
> enough. And I thought my question was cleared than it turned out to
> be!
>

I wasn't saying what you posted would have been better at dpaste.com, what
you posted was fine.  I was saying your model definitions might work better
at dpaste.com than inline.


> To clarify (where someobject_set is a related-object queryset):
>
> someobject_set.all().query.as_sql()
> someobject_set.select_related().query.as_sql()
>
> Both show identical SQL is being generated - which indicates that
> select_related() isn't following any relationships.
>

What select_related does, exactly, is dependent on the model definitions.
It doesn't follow relations which can be null, for example.  Which is why I
asked for your model definitions.  You're also applying the select_related
to a related set, which may be coming into play (this is not code I'm
terribly familiar with), but when I try analogs to your queries on my own
models, I do get different sql reflecting select_related is having an
effect.  Which is why I asked for your model definitions.  Without seeing
your models I haven't the vaguest idea how what you are doing with your
models is different from what I am doing.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Exception thrown from django.test.client.Client

2008-10-23 Thread Karen Tracey
On Thu, Oct 23, 2008 at 11:41 AM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> By using pdb post mortem, I found out that the request.META dictionary
> doesn't actually have 'REMOTE_ADDR' in it. Settings.INTERNAL_IPS is
> '127.0.0.1'. So then get() returns None, and the error comes from
> python trying to evaluate None in '127.0.0.1'. Should the test client
> be setting this value? Is there something in my code or configuration
> that needs to change to set that?
>

I'm a little puzzled because I cannot recreate the error you see.  From your
traceback it appears like it might be resulting from having DEBUG set to
True when running the test, but even using a settings file where DEBUG is
True, I do not see that error:

>>> from django.conf import settings
>>> settings.DEBUG
True
>>> from django.test.client import Client
>>> c = Client()
>>> c.get('/')

>>>

So I am not sure why you see it.  However, the lack of a REMOTE_ADDR setting
in the test client environment has been reported in a ticket:

http://code.djangoproject.com/ticket/8551

so you could probably either use the workaround mentioned there or try
running with the little patch in the ticket and see if it fixes your case.

Karen


>
> On Oct 23, 9:17 am, "[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]> wrote:
> > I found this problem while trying out the django test client:
> >
> > $ ./manage.py shell>>> from django.test.client import Client
> > >>> c = Client()
> > >>> c.get('/')
> >
> > Traceback (most recent call last):
> >   File "", line 1, in 
> >   File "/var/lib/python-support/python2.5/django/test/client.py", line
> > 265, in get
> > return self.request(**r)
> >   File "/var/lib/python-support/python2.5/django/core/handlers/
> > base.py", line 86, in get_response
> > response = callback(request, *callback_args, **callback_kwargs)
> >   File "/path/to/website/views.py", line 12, in index
> > context_instance=RequestContext(request))
> >   File "/var/lib/python-support/python2.5/django/template/context.py",
> > line 105, in __init__
> > self.update(processor(request))
> >   File "/var/lib/python-support/python2.5/django/core/
> > context_processors.py", line 34, in debug
> > if settings.DEBUG and request.META.get('REMOTE_ADDR') in
> > settings.INTERNAL_IPS:
> > TypeError: 'in ' requires string as left operand
> >
> > This is probably a mistake in my configuration, but it may be a bug.
> > It throws the same error regardless of which path I try to get, or if
> > I use c.post instead. Can anyone figure this out?
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ignore url

2008-10-24 Thread Karen Tracey
On Fri, Oct 24, 2008 at 6:56 AM, Niall Mccormack <
[EMAIL PROTECTED]> wrote:

>
> Is it possible to tell Django to ignore certain url's so that it
> resorts to showing what is on the server at that url.
>
> i.e. if I have a file at the url
> http://www.mywebsite.com/myfiles/image.jpg
>
> Can I instruct Django to ignore the /myfiles/ url so I can link
> directly to that file?
>
>
The place to do this is in the web server configuration.  You configure it
so that such files are served directly rather than sending the request
through Django.  Unless you are talking about the Djagno development server;
there you can use the static server to serve these files.  Search for
"static files" in the docs for details on how to do that.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problems with unicode characters in templates

2008-10-24 Thread Karen Tracey
On Fri, Oct 24, 2008 at 10:04 AM, MrMuffin <[EMAIL PROTECTED]> wrote:

>
> When I use norwegian characters in templates django spews out errors
> about encoding. What encoding ( UTF-8, iso-8859-1 ) should I use and
> where do I put it to avoid these errors?
>

UTF-8 is what is assumed by default, but if you want to use something else
there's a setting:

http://docs.djangoproject.com/en/dev/ref/settings/#file-charset

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: max_length for TextField is not respected

2008-10-24 Thread Karen Tracey
On Fri, Oct 24, 2008 at 10:24 AM, omat <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I have a form class derived from a model using ModelForm.
>
> The model has a TextField(max_length=300) field, but length limit is
> not taken into account and the form passes validation when texts > 300
> char are submitted. Same when submitting through admin.
>
> Is max_length not used for TextField? Is it something supported at db
> level?
>
> I am using sqlite and django 1.0.
>
>
max_length is not used for TextFields.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: max_length for TextField is not respected

2008-10-24 Thread Karen Tracey
On Fri, Oct 24, 2008 at 11:26 AM, omat <[EMAIL PROTECTED]> wrote:

>
> Thanks for the reply Karen.
>
> Accepted but not used? Neither in the model nor in the forms? This is
> not how I would expect it to be.


Yes, that's the way it is.  max_length is specified as a possible keyword
argument in django.db.models.fields.Field.__init__ and there is no code in
any of the Field subclasses which don't use it (that I see) to object to its
unexpected/unused presence.  So you can specify max_length on a DateField,
e.g., and it's not an error.  It's just not used for anything.  This is
maybe a bit surprising but I don't know that it's worth "fixing".


>
> Then, how can I limit a, say comment field to 500 chars in a djangoic
> way?
>

Use a CharField with max_length 500 and override the widget used in your
forms, since a single-line input for something that large is pretty
obnoxious.

Or write your own limited text field that enforces a max_length, either at
the model field level or just at the forms level.

(Or rethink the idea of artificially limiting such things.)

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Apache2 + mod_python --> not working

2008-10-24 Thread Karen Tracey
On Fri, Oct 24, 2008 at 11:51 AM, tsmets <[EMAIL PROTECTED]> wrote:

>
> I installed mod_python & apache2.
> mod_python is OK
> http://ubuntuforums.org/showthread.php?t=91101
>
> I then a adapted the http.conf to
> [EMAIL PROTECTED]:/etc/apache2$ cat httpd.conf
> 
>SetHandler python-program
>PythonHandler django.core.handler.modpython


This is wrong.  It's supposed to be:

   PythonHandler django.core.handlers.modpython

(You're missing the s in 'handlers'.)

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Hi guys. I'm having problem with new-forms admin site.

2008-10-25 Thread Karen Tracey
On Sat, Oct 25, 2008 at 12:31 AM, astray <[EMAIL PROTECTED]> wrote:

>
> [snip config details]

% models.py %
>
> from django.db import models
>
> class Publisher(models.Model):
>name = models.CharField(max_length=30)
>address = models.CharField(max_length=50)
>city = models.CharField(max_length=60)
>state_province = models.CharField(max_length=30)
>country = models.CharField(max_length=50)
>website = models.URLField()
>def __str__(self):
>return self.name
>

Note when using Django 1.0, you should be specifying __unicode__ methods,
not __str__ methods.

[more snipped]


> ==> above are my settings. App name is books. I'm curious about where
> to put admin.py file.
> (Maybe in my app folder (\books)? That's what I'm doing right now.)
>

Yes.


>
> I was at first following my Django book's instruction to create
> administration interface and soon realized that the method on the book
> was not applicable to Django 1.0.
>

The online docs are an excellent reference and are up-to-date:

http://docs.djangoproject.com/en/dev/


> I'm not interested in several options I can override. Just wanting to
> test default interface but It just doesn't work!
>
> with these settings, I encounter this error
>
> --
> [snipped]
>  File "F:\Python26\Lib\site-packages\django\db\backends\util.py",
> line 19, in execute
>return self.cursor.execute(sql, params)
>
> ProgrammingError: error:  There's no relation named "django_session"
> <--- message translated by my own because I'm not English user. Just
> focus on the meanig of this message cause this might be not identical.


You need to run manage.py syncdb after adding apps to your INSTALLED_APPS --
this is how the tables for those apps get created.  It sounds like you did
not run syncdb after adding the sessions app to INSTALLED_APPS.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Models not validating

2008-10-25 Thread Karen Tracey
On Sat, Oct 25, 2008 at 11:36 AM, Florencio Cano
<[EMAIL PROTECTED]>wrote:

>
> You are saying that a Pupil is a Team and a Team is a Pupil with that
> OneToOneField. In the Team you are saying one Pupil belongs to many
> Teams and a Team have many Pupils that seems ok but the OneToOneField
> seems wrong.
>

Yes, that seemed wrong to me as well.  If a Pupil can be on one Team and a
Team is made up of many Pupils than Pupil should have a ForeignKey to Team,
that's it.  No OneToOne or ManyToMany.

Similarly the ManyToMany relation to Result in Pupil confuses me.  I'd think
a given Result would be associated with a Pupil (a Pupil submits a Result?),
so Result would have a ForeignKey to the Pupil who submitted it.  There is
then no need for any reference to Result in Pupil, the reverse relation is
automatically created.

It's hard for me to say what's wrong, exactly, with the models as you have
them set up because I am missing the basic overall description of the
entities you wan to track and their relationships to each other.  From the
model definitions alone (even with the brief comments) I'm not understanding
what things like Result, Table, and Point are supposed to be.  I'm thinking
you should have ForeignKeys where you have ManyToManys in several instances,
but I can't say that with any confidence because I'm missing the overall
structure.

So I'd advise taking a step back and describing in words, not code, what the
overall problem you are trying to solve is.  Identify what things you think
you need to track and what the relationships are between them, and then
people can advise on drawing up models.

Also, you might want to read through the docs some more on relations. I have
a feeling you're complicating this unnecessarily and using a lot of
ManyToManys where you really should be using ForeignKeys -- you've got no
ForeignKeys, and I find that odd.  It's a very common sort of relationship
and I'd think you'd have some.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Equivalent to Rails Rumble

2008-10-25 Thread Karen Tracey
On Sat, Oct 25, 2008 at 11:45 AM, Keyton Weissinger <[EMAIL PROTECTED]>wrote:

>
> Hello everyone!
>
> Long time listener. First time caller
>
> Is there an equivalent to the Rails Rumble for the Django community?
> Shouldn't there be one? What do you think?
>
>
You don't say what this Rails Rumble thing is.  Given this list is about
Django, not Rails, that means a lot of the people on the list won't have any
idea what it is.  Meaning they'll either have to go research it themselves
in order to answer your question, or they will just let the question go by.
Which is to say I think you'll get better responses if you make it a little
easier to answer the question by at least giving some idea of what Rails
Rumble is.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How can I make WS in Django

2008-10-27 Thread Karen Tracey
On Mon, Oct 27, 2008 at 4:13 PM, Abdel Bolanos Martinez <
[EMAIL PROTECTED]> wrote:

>  Anyone has make WS (WebServices) inDjango???
>

This is the 2nd time you've asked essentially the same question in the space
of a few hours.  Your original question did get a few answers:

http://groups.google.com/group/django-users/browse_thread/thread/479933259b9784df?hl=en#

Did you not get receive/see the responses?  If they do not answer your
question, why not expand on your question with a few more details
(particularly since the vagueness of the question was noted in the responses
as creating a problem in providing meaningful answers)? Why do you think you
will get better answers on a new thread on the topic?  You won't.  You
might, however, get better answers if you spend a few more bytes on your
actual question and a few fewer on sig graphics.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Model that calls a function in another model

2008-10-27 Thread Karen Tracey
On Mon, Oct 27, 2008 at 7:19 PM, Michael Meier <[EMAIL PROTECTED]>wrote:

>
> Hello
>
> I'm relatively new to Django and I was able to set up a small
> application without any problems, BUT:
>
> How can I access data inside a model that comes from another model. As
> an example, I have a model Person, which has a One-To-Many-
> relationship to Skills. So each person can have multiple skills.
>
> Now my idea is that the Skills model has one function that returns the
> number of skills a person has.
>
> I tried this for several hours now :-(, including searching the
> documentation, but I can't find that information. Maybe I just need a
> push into the right direction.
>
>
You might want to read this section of the docs:

http://docs.djangoproject.com/en/dev/topics/db/queries/#related-objects

It's a little hard to be sure since you did not give specifics on your
model, but assuming you have a model named Person and one named Skill, and
Skill has a ForeignKey field to a Person, then the number of Skills for a
Person instance p would be obtained by:

p.skill_set.count()

So, you don't come at it from the Skill model but rather from an instance of
a Person model.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: case insensitive search

2008-10-28 Thread Karen Tracey
On Tue, Oct 28, 2008 at 10:54 AM, DULMANDAKH Sukhbaatar <
[EMAIL PROTECTED]> wrote:

>
> > Use   search_fields = ['name'] in the corresponding
> > class inside admin.py
>
> I did. Actually my text is Cyrillic. Just now I tested searching
> sample latin or english text, and search workin fine. Is it problem
> with non-english text? if so how i can fix it, and make work?
>
>
Django's case-insensitive  search is going to map to a LIKE query for
sqlite.  According to this page:

http://www.sqlite.org/lang_expr.html

sqlite doesn't handle case-insensitive searches for anything except 7-bit
ASCII:

"(A bug: SQLite only understands upper/lower case for 7-bit Latin
characters. Hence the LIKE operator is case sensitive for 8-bit iso8859
characters or UTF-8 characters. For example, the expression *'a' LIKE
'A'*is TRUE but
*'æ' LIKE 'Æ'* is FALSE.)."

So it sounds like you will need to move to a different DB if you want
case-insensitive searching to work for Cyrillic chars.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to get site's root path in Django

2008-10-28 Thread Karen Tracey
On Tue, Oct 28, 2008 at 11:10 AM, yuanyun.ken <[EMAIL PROTECTED]> wrote:

>
> Graham, thanks for your kindly help.
>
> I know we don't need root url when configure url mapping. but it seems
> that LOGIN_URL is somewhat special.
>
> When I set LOGIN_URL = '/login/'
> accessing http://localhost/root_url/login/ is ok,
> but when I access some pages which need login first, I will got 404
> error, and in apache's error log, it logs:
> File does not exist: D:/Program Files/Apache Software Foundation/
> Apache2.2.9/htdocs/login
>
> and the only way to work is adding root url to LOGIN_URL.
> LOGIN_URL = '/root_url/login/'
>
> I can not figure out whether there are problems in my configuration,
> or anything else.
>

Sounds like:

http://code.djangoproject.com/ticket/8906

So (assuming you are not "levity") someone else has reported the same
thing.  It sounds like there may be a problem in Django code here, but no
one has yet investigated far enough to confirm that or suggest a fix.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 500 displayed instead of 404

2008-10-28 Thread Karen Tracey
On Tue, Oct 28, 2008 at 2:58 PM, janedenone <[EMAIL PROTECTED]>wrote:

>
> Hi,
>
> it must be some kind of unhandled exception, but I fail to see where
> it might occur. I now boiled down the app to a single URL pattern and
> a single view:
>
[snipped]

If you configure ADMINS and EMAIL_HOST, etc. so that Django can successfully
send email, then the traceback from the uncaught exception will be mailed to
whatever email address you include in ADMINS.  Much easier than guessing
what might be happening.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 500 displayed instead of 404

2008-10-28 Thread Karen Tracey
On Tue, Oct 28, 2008 at 4:08 PM, janedenone <[EMAIL PROTECTED]>wrote:

>
> Hi Karen,
>
> I did that, but the message was never sent to me.
>

That's the first problem I'd be working on fixing, then.  Long term you are
likely to want that mechanism working, you've got a problem to solve right
now for which it would be useful -- I'd be figuring out what's wrong with
the settings that is causing the error email to go astray.


> Anyway, when I create a new project with a single app, containing
> nothing but a single view which raises a Http404, along with a
> urlpattern which refers to that view – the 500 template is still
> displayed when I request the URL.
>
> This must be easily reproducible on any machine using the following
> code:
>
> # urls.py:
> urlpatterns = patterns('myproject.myapp.views',
>   (r'^test/$', 'test'),
> )
>
> # views.py:
> def test(request):
>raise Http404
>

Well yes if that is all you have in views.py then you'll get a 500 error
because Http404 has not been imported.  But for the DEBUG=True case you'd
also be seeing a debug page that starts with:

NameError at /test/

and goes on to complain that "global name 'Http404' is not defined" instead
of:

Page not found (404)

and that doesn't match what you said earlier so I'm unsure if you skipped
over some details in reporting the code for your minimal example or what it
is you see when you have DEBUG set to True.

I assure you, if I insert "raise Http404" into the beginning of one of my
views, I get my customized 404 template, not a 500 error.  Whatever is going
on is something specific to your code (or 400.html template), not something
fundamentally broken in Django when Http404 is raised with DEBUG set to
False.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: cannot import name call_command

2008-10-29 Thread Karen Tracey
On Wed, Oct 29, 2008 at 11:05 AM, noureddine <[EMAIL PROTECTED]> wrote:

>
> i have this problem
> is there anybody hwo know the solution.
> please tell me.
>

You've specified the wrong import, or the wrong pythonpath, or have a
corrupt installation, or ...? Without some specifics of what you are doing
to generate this error it is a bit hard to say.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 'RegistrationForm' object has no attribute 'clean_data'

2008-10-29 Thread Karen Tracey
On Wed, Oct 29, 2008 at 10:38 PM, Tsinga <[EMAIL PROTECTED]> wrote:

>
> Hey guys,
>
> I am a newbie to Django, and I am having trouble. Need help! This is
> the Traceback:
>
> Environment:
>
> Request Method: POST
> Request URL: http://127.0.0.1:8000/register/
> Django Version: 1.0-final-SVN-unknown
> Python Version: 2.5.2
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django_example.example_app']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware')
>
>
> Traceback:
> File "C:\Python25\Lib\site-packages\django\core\handlers\base.py" in
> get_response
>  86. response = callback(request, *callback_args,
> **callback_kwargs)
> File "C:\DevCenter\Python_Project\django_example\..\django_example
> \example_app\views.py" in register_page
>  37.   username=form.clean_data['username'],
>
> Exception Type: AttributeError at /register/
> Exception Value: 'RegistrationForm' object has no attribute
> 'clean_data'
>
>
Well you left out any description of what you are doing, which makes it
harder to answer.  What is this django_example.example_app code you are
running? Possibly you are running code written for an earlier release of
Django on Django 1.0, or using a book that is similarly out of date.  Forms
used to have a clean_data attribute, now it is cleaned_data:

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Newforms:clean_datachangedtocleaned_data

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 'RegistrationForm' object has no attribute 'clean_data'

2008-10-29 Thread Karen Tracey
On Wed, Oct 29, 2008 at 11:05 PM, Tsinga <[EMAIL PROTECTED]> wrote:

>
> I am working with a new book (Learning Website Development with
> Django) from Ayman Hourieh.
> I am going through the application presented in that book.
>

The change you are having trouble with (clean_data renamed to cleaned_data)
was made May 14, 2007.  So even if the book is new it doesn't seem to be
covering a very recent release of Django.  (To be fair Django 1.0 is less
than two months old so I doubt there are any books in print that accurately
cover it yet.)

You'll just need to be aware, as you follow along in the book, that if you
run into things not working it's likely caused by backwards-incompatible
changes made since the book was written.  The backwards-incompatible page I
pointed to earlier will be a good place to search for solutions.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: __unicode__() method not working in models.py

2008-10-30 Thread Karen Tracey
2008/10/30 Andrew <[EMAIL PROTECTED]>

>
> I am currently working through the django book and I've got to the
> fifth chapter where I would like to replace the __str__() methods with
> __unicode__() methods instead. The reason is that my database will
> hold a great deal of Japanese text, UTF-8 encoded. After declaring the
> UTF-8 encoding at the top of models.py, as a test, I replace
>
> def __str__(self):
>return self.name
>
> with
>
> def __unicode__(self):
>return u'テスト'
>
> Entering the following code into the manage.py shell doesn't give the
> expected output.
>
> >>> from books.models import Publisher
> >>> publisher_list = Publisher.objects.all()
> >>> publisher_list
>
> I expect:
>
> [, ]
>
> but instead, the テスト is replaced with random Japanese characters that
> are not the ones I expected.
>
> I am using a Japanese version of Windows XP with PostgreSQL installed.
> The encoding of the database and the file are both UTF-8. The cmd.exe
> prompt doesn't let me type in Japanese but it does display Japanese if
> print out something I've saved in a file for example.
>
> Any ideas on where I'm going wrong?
>
>
I do not know if this will work for Japanese Windows, but for the English
version, the two things I have found that need to be done to ensure a
command prompt properly displays utf-8
are first:

chcp 65001

in the command prompt to change the active code page to the one that works
for utf-8 (65001 is apparently Windows' spelling of utf-8) and second change
the font properties of the command prompt (left click upper left corner of
the window, choose Properties, then Font tab) to use Lucida Console, not
Raster Fonts.  If I do those two things then utf-8 data looks correct in my
command prompts.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Blank content from unit testing

2008-10-30 Thread Karen Tracey
On Thu, Oct 30, 2008 at 10:25 AM, jeffhg58 <[EMAIL PROTECTED]> wrote:

>
> I am currently the django test client and I have run across a
> stumbling block.
>
> When I do a get command for my main screen which is get('/resultsdb/
> search_form/'), the status code
> returns a 302 with no content.
> But, if a do a get on say ('/login/') or a subsequent window besides
> the main window such as ('/resultsdb/newresults/') and get a status
> code of 200 with the content of the window.
>
> Any help would be greatly appreciated. I am stumped on this.
>
>
Well a 302 is a redirect, so it won't have content.  response['Location']
will tell you where it is redirecting to, which might give you a hint.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: FileField doesn't repopulate after a ValidationError on another field

2008-10-30 Thread Karen Tracey
On Thu, Oct 30, 2008 at 10:52 AM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> Hello,
>
> I've having a problem with FileField and ImageField. Basically, I have
> a form for uploading images:
>
> Name: _a_  (throws ValidationError('This name is already taken. Choose
> another'))
> Notes: _test notes_
> Filename:  _abc123.txt_
>
> When I press SUBMIT, I get the form again, but it looks like this:
>
> -This name is already taken. Choose another
> Name: _a_
> Notes: _test notes_
> Filename:  _ (blank Not sure why)
>
> The FileField is not repopulated for some reason, but the other fields
> are.
>

I believe this is a browser security measure.  The browser won't allow a
server to pre-load a value into a File input, because that would mean a
naive user could easily submit a form which uploads some key file from their
machine to the server.  So for a File input the browser requires that the
user actually go and select a file to upload.  (I do not know if there are
any tricks one can play to get around this, I've never looked for one.)

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Blank content from unit testing

2008-10-30 Thread Karen Tracey
On Thu, Oct 30, 2008 at 11:50 AM, <[EMAIL PROTECTED]> wrote:

> But, when I initialling go to '/resultsdb/search_form/' and the request is
> not a get but I a WSGIRequest how to test the content? Because in my view
> the only redirect after a request.GET occurs during an if conditional of
> when a certain button is pressed
>

I can't parse your question in the first sentence.  Code snippets might
help.  There is no content if you are getting a 302, it is a redirect and
the only thing you can then examine would be the redirect Location.  Somehow
the path your code is taking in response to a get on
'/resultsdb/search_form/' is getting to a point where it returns a redirect,
not a response.

You've also got another thread that I hadn't seen when I first responded on
this one, where someone responded pointing out the likely line in your view
you are hitting.  I gather from your last sentence you don't believe you can
be hitting that line, but apparently you are. I couldn't get that far in
reading the view code because it gets badly mangled in an email interface;
dpaste.com would be a better place for putting code.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: FileField doesn't repopulate after a ValidationError on another field

2008-10-30 Thread Karen Tracey
On Thu, Oct 30, 2008 at 12:19 PM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> Ok, this sounds logical to me.
>
> I guess the best way to handle this is to make the uploading process
> require 2 separate submission pages, the first one for all the regular
> input, and then have a second page just to upload the file.
>
> Perhaps somebody has a better idea?
>

At the expense of some additional complexity in your view & template, you
can maintain a one-step submission for your users.  I'd probably look at
adding an additional hidden input field to the form that starts out empty
but is used in cases where a file has already been uploaded through a prior
submission which failed validation for some non-filefield-related problem.
The value in the hidden field would allow the server view code to locate the
previously-uploaded file when the form is re-submitted.  The template would
display the File input field only when necessary, if a file has already been
uploaded then the template would display a note to that effect instead.

So if there are no errors on the initial submission, it's a one-step process
for the user.

If there is an error (not related to the uploaded file), the server stashes
the uploaded file somewhere and sets the value of the hidden field so that
the file can be found on resubmit.  From a user's point of view the form is
redisplayed but they do not have to re-select the file -- rather the form
shows that the file has been uploaded and the other error messages on the
form show what needs to be corrected to complete the submission.

On resubmit, the server locates the previously-uploaded file via the
information in the hidden field instead of getting it from the post data.
Your view logic is a bit more complicated than for simple forms, and your
template has to be a little more involved than {{ form.as_p }}, but it's
probably more intuitive for users than a 2-step default submission process.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: cannot import name call_command

2008-10-30 Thread Karen Tracey
On Thu, Oct 30, 2008 at 12:27 PM, noureddine <[EMAIL PROTECTED]> wrote:

>
> this is what i specified :
>
> from django.core.management import call_command
>

OK, so you've got an import that should work on Django 1.0.  I suspect
you're either not running on Django 1.0 (that import doesn't work on 0.96)
or your installation is corrupt.  The former is probably more likely.

Karen


>
>
> On 29 oct, 15:39, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > On Wed, Oct 29, 2008 at 11:05 AM, noureddine <[EMAIL PROTECTED]>
> wrote:
> >
> > > i have this problem
> > > is there anybody hwo know the solution.
> > > please tell me.
> >
> > You've specified the wrong import, or the wrong pythonpath, or have a
> > corrupt installation, or ...? Without some specifics of what you are
> doing
> > to generate this error it is a bit hard to say.
> >
> > 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: appeal for help with #9232

2008-10-30 Thread Karen Tracey
On Thu, Oct 30, 2008 at 11:12 AM, Faheem Mitha <[EMAIL PROTECTED]> wrote:

>
>
> Hi,
>
> Can anyone help with
>
> http://code.djangoproject.com/ticket/9232
>
> ? Currently I don't even know if this problem is reproducible. If someone
> could solve it, or even indicate what was wrong, if anything, I'd be happy
> to pay for services rendered.
>

It's not a generally re-creatable problem. Using your project on one of my
machines (Ubuntu) with Django 1.0, Apache 2.2 & mod_wsgi 2.3 an upload of a
700M file takes about a minute and a half (during which time I can see the
tmp upload file continually growing in size), then gets an error on the
redirect at the end of the view since "top_folders" is not reversable in the
testproj config.

Random question that cross my mind:

Are you sure you have a clean install of Django 1.0 -- that is you removed
any old level before installing 1.0?

Are you trying the upload from a machine with a known good network
connection to the server (or from the sever machine itself?).

Do you see the same behavior if you run under the development server?

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: cannot import name call_command

2008-10-30 Thread Karen Tracey
On Thu, Oct 30, 2008 at 3:43 PM, noureddine <[EMAIL PROTECTED]> wrote:

>
> yes, i already thik in this idea
> but the application has an others bug with django 1.0 and the 1st
> developper says in his documentation that works with django 0.9
> thanks
>

You are saying this is code from someone else and they claim it runs on
0.96?  If so, I believe they are wrong.  That import won't work prior to
r5898:

http://code.djangoproject.com/changeset/5898

which is when the django.core.management package was created, along with
call_command.  Django 0.96 was tagged around r4810, about 1000 revisions and
six months earlier. It may be the original developer was using some svn
checkout of Django from between 0.96 and 1.0.

Karen


>
> On 30 oct, 17:04, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > On Thu, Oct 30, 2008 at 12:27 PM, noureddine <[EMAIL PROTECTED]>
> wrote:
> >
> > > this is what i specified :
> >
> > > from django.core.management import call_command
> >
> > OK, so you've got an import that should work on Django 1.0.  I suspect
> > you're either not running on Django 1.0 (that import doesn't work on
> 0.96)
> > or your installation is corrupt.  The former is probably more likely.
> >
> > Karen
> >
> >
> >
> > > On 29 oct, 15:39, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > > > On Wed, Oct 29, 2008 at 11:05 AM, noureddine <[EMAIL PROTECTED]>
> > > wrote:
> >
> > > > > i have this problem
> > > > > is there anybody hwo know the solution.
> > > > > please tell me.
> >
> > > > You've specified the wrong import, or the wrong pythonpath, or have a
> > > > corrupt installation, or ...? Without some specifics of what you are
> > > doing
> > > > to generate this error it is a bit hard to say.
> >
> > > > 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Table width when using list_filter

2008-10-30 Thread Karen Tracey
On Thu, Oct 30, 2008 at 4:28 PM, Fabio Natali
<[EMAIL PROTECTED]>wrote:

> Hi everybody!
>
> I'm a bit confused about the behaviour of my change list page.
>
> If I enable list_filter the table (the one listing my model instances)
> "shrinks" and its width is no more 100% of the space available. All
> the columns and data are perfeclty shown, it's just that everything is
> more narrow. Obviously, part of the width is taken by the list_filter
> window, but the table shrinks down far more.
>
> Is this behaviour normal? Is there any reason for it?
>
> I use trunk django and a cutting edge firefox browser.
>
>
I see the same behavior, at least for models that don't have a lot of
columns with wide text in the change list.  It appears that, with a filter
present, the columns are narrowed to only however wide they need to be to
fit the longest entry in the column, whereas without a filter the columns
are expanded so that the full set covers the whole width of the screen.  I
expect it's a side-effect of the css needed to get the filter in place;
whether it's a necessary or accidental side-effect I don't know -- I've
never cared about it enough to look into it, especially since css isn't my
favorite thing to play with.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom change list and list_display

2008-10-31 Thread Karen Tracey
On Fri, Oct 31, 2008 at 10:24 AM, Fabio Natali
<[EMAIL PROTECTED]>wrote:

>
> Rajesh Dhawan wrote:
> [...]
> > > What's more, how can I make those callables columns sortable
> > > within the change list page? I'm working with trunk. I read this:
> > > http://code.djangoproject.com/changeset/9211 Does this mean that I
> > > can add some callable and then alphabetically order them?
> >
> > No. While you can definitely add a callable column in the change
> > list[1], you can only sort by fields that are in the database table.
>
> Ok, we can't sort on callable columns. Anyway that's a pity... I
> thought providing a straight lexicographic order was not such a big
> deal. (But I probably miss some points and misjudge the difficulty of
> the matter.)
>
>
The sorting is done at the database level (SQL ORDER BY), as is the
pagination (SQL OFFSET & LIMIT), so it is efficient (DBs are optimized to do
these things efficiently).  In order to sort by something not in the
database, Django would need to retrieve all rows, do the sort (calling your
callable for each row in the DB), and then limit the result according to the
page you are viewing.  This would be prohibitively expensive for large
tables.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is there a way to use the Cut Filter to only do the first instance?

2008-10-31 Thread Karen Tracey
On Fri, Oct 31, 2008 at 11:55 AM, Frank Peterson
<[EMAIL PROTECTED]>wrote:

>
> I am using the following
> {{ section.get_absolute_url|cut:"/news/" }}
> on a string that is
> /news/new-york-jets/news/
>
> I need to remove the first /news but the CUT filter removes all
> instances of it, is there a way for me to remove on the first "/news"?
>

No, there's no way to make the existing cut filter do this, and I don't see
another built-in filter that does what you ask.  However if you look at the
implementation of cut here:

http://code.djangoproject.com/browser/django/tags/releases/1.0/django/template/defaultfilters.py#L325

and the doc for Python's string replace method you can pretty easily write
your own cut_first filter.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: updating a single field / attribute, is it possible? or better practices?

2008-10-31 Thread Karen Tracey
On Fri, Oct 31, 2008 at 12:39 PM, omat <[EMAIL PROTECTED]> wrote:

>
> Hi all,
>
> Is it possible to update a chosen subset of attributes of a model
> instance?
>

http://code.djangoproject.com/ticket/4102

asks for this, I believe.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to modify field error wording ?

2008-10-31 Thread Karen Tracey
On Fri, Oct 31, 2008 at 11:46 PM, nkulmati <[EMAIL PROTECTED]> wrote:

>
> Hi all:
>
>
> How to modify field error wording ?
> Please do not send me to the page "Form-subclasses-and-modifying-field-
> errors" in the docs.
>
> All I need is to override the error messages, NOT the validation
> system. That page does not address this need for some reason! I don't
> want to start customizing Form and Field classes and overriding
> clean() methods and do all this work just to change the wording of
> common error messages!
>
> Please help!
>

http://docs.djangoproject.com/en/dev/ref/forms/fields/#error-messages

(A different page than the one you asked not to be sent to.)

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: alert table while updating model automatically

2008-10-31 Thread Karen Tracey
On Sat, Nov 1, 2008 at 12:51 AM, Xian Chen <[EMAIL PROTECTED]> wrote:

> Hi All,
>
> I want to know whether Django support alerting the tables automatically
> while I modify the models or not.
>
> Suppose the website has run a long time and stored lots of data. In this
> case, the administrator wants to modify the model to add/remove some
> properties. Does the corresponding tables in the database will be alerted
> automatically?
>
> If not, how can make it happen? The administrator has no knowledge about
> SQL language. So, the administrator cannot run ALERT/DROP TABLE ...
>

(First just to clarify -- the word you want here is ALTER, not ALERT.  I was
a little confused reading your message until I realized that.)

There's nothing built into Django that does this. There are, however, at
least three external projects that offer this kind of thing:

http://code.google.com/p/django-evolution/
http://code.google.com/p/dmigrations/
http://south.aeracode.org/wiki

You might want to check them out.  Also if you search the list for terms
like 'schema evolution' or 'schema migration' you may find useful past
discussions on this topic.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Templaite:display li items alternatively using for

2008-11-01 Thread Karen Tracey
On Sat, Nov 1, 2008 at 1:58 AM, Xian Chen <[EMAIL PROTECTED]> wrote:

> Hi,
>
> I want to display a list of items by using {% for item in items %}.
>
> To make the web pages look better, I want to use two kinds of 
> alternatively.
>
> E.G item
>item
>
> My question is how can i use the tags to implement this requirement?
>
> Any build-in tags for this?
>

Yes:

http://docs.djangoproject.com/en/dev/ref/templates/builtins/#cycle

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Deploying multiple django applications in a single apache server

2008-11-01 Thread Karen Tracey
On Sat, Nov 1, 2008 at 9:03 AM, bluefireredsky <[EMAIL PROTECTED]>wrote:

>
> Hello,
>
> I have followed the link from django documentation on deploying an
> application to apache2.
>
> http://docs.djangoproject.com/en/dev/howto/deployment/modpython/
>
> I have two applications, which I would like to run on two different
> ports on the server. Basically one being an administrative website
> (not the django inbuilt admin website) and the other the user front
> end.
>
> Currently I have the following on my ports.conf:
>
> ===
> Listen 80
>
> 
>Listen 443
> 
> ===
>
> My httpd.conf is as follows:
>
> 
> 
>SetHandler python-program
>PythonHandler django.core.handlers.modpython
>SetEnv DJANGO_SETTINGS_MODULE mysitename.settings
>PythonOption django.root /mysitename
>PythonDebug On
>PythonPath "['/usr/local/'] + sys.path"
> 
> 
>SetHandler None
> 
> 
>SetHandler None
> 
> 
>
> What changes should I do on these files to run my second django
> application on a different port, say 8080, on the same apache server?
>
>
This is really more an Apache question than a Django one.  First you'll need
to add a Listen for the second port in your ports.conf, the doc for that is
here:

http://httpd.apache.org/docs/2.2/bind.html

At the bottom of that page they point to the VirtualHost directive, which is
the second thing you'll need to do.  You need to enclose your existing
directives for the app on port 80 in a VirtualHost block for port 80, and
create a second VirtualHost with directives for the new app that you want on
the second port.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Why is my string not auto escaped?

2008-11-01 Thread Karen Tracey
On Wed, Oct 29, 2008 at 8:35 AM, shabda <[EMAIL PROTECTED]> wrote:

>
> I need to create a custom filter which displays some data from db
> depending on its data type.
>
> My code is something like,
>
> from django.template.defaultfilters import linebreaks, urlize
>
> def filterxx(data)
> return linebreaks(urlize(data.value))
>
> My data.value is
>
> Asdfghjkl
>
> alert('hole')
>
> This is used in templates, and shows up unescaped, which allows users
> to run arbitrary scripts. What am I doing wrong?
>

You are calling built-in filters that rely on being told the current
autoescape setting without passing along the current autoescape setting in
effect.   I think you want something more like:

def filterxx(data, autoescape=None):
return linebreaks(urlize(data.value, autoescape), autoescape)
filterxx.needs_autoescape = True

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: HttpRequest with chunked encoding is not buffered

2008-11-01 Thread Karen Tracey
On Sat, Nov 1, 2008 at 11:37 AM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> I actually am seeing some input, but it is divided into several, well,
> chunks. I guess it's the same problem as seeing no input - I'd say
> you're right and chunked encoding is silently unsupported (it would be
> nice if Django said something though).
> However, could you please suggest any workaround? If mod_python does
> not work, what should I use? (My goal is to be able to receive chunked
> requests in some normal way in my django application).
>

Here's a workaround if you must used chunked requests with servers
(apparently many) that don't support it:  you can send a chunked request
through Apache's mod_proxy and force it to unchunk and add a
content-length.  Described here:

http://www.atnan.com/2008/8/8/transfer-encoding-chunked-chunky-http

Karen


>
> On Nov 1, 10:28 am, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
> > On Nov 1, 10:40 am, "Tomáš Brambora" <[EMAIL PROTECTED]> wrote:
> >
> > > I have a standard Django installation without any changes in the
> > > settings (except adding mysql db to the settings.py) and I'm sending
> > > the message to localhost:8000, so there is no proxy or anything else
> > > in the way. Still, the request body comes after me sending the
> > > response...
> >
> > As I said in the other similar thread you created about this.
> >
> > If you are getting empty input on read, then you are using hosting
> > mechanism that doesn't properly filter out chunked request content as
> > not being supported and instead assumes that content length of
> > request  was 0.
> >
> > In other words, chunked request content is not supported. Most hosting
> > mechanisms will flag it as an error. The internal Django development
> > server appears just to assume that content length on request is 0
> > since Content-Length header wouldn't be set. Thus why you are seeing
> > no input.
> >
> > Graham
> >
> >
> >
> > > On Fri, Oct 31, 2008 at 11:50 PM, Graham Dumpleton
> >
> > > <[EMAIL PROTECTED]> wrote:
> >
> > > > [EMAIL PROTECTED] wrote:
> > > >> Hello,
> > > >> I'm trying to receive a possibly large XML message via HttpRequest
> > > >> (POST method) with chunked encoding. However, when I send a
> response,
> > > >> I found out (using Wireshark) that the response is being sent before
> > > >> the whole POST request body is available. I expected Django to be
> > > >> buffering the chunks and that the request would be complete, but
> > > >> that's apparently not happening...
> >
> > > >> I'm reading the body like this:
> > > >> request.POST.values()[0]
> >
> > > >> (Which is probably a wrong way, but I don't know how to do it
> > > >> otherwise.)
> >
> > > > What hosting mechanism are you using. Anything that uses WSGI (eg,
> > > > mod_wsgi, fastcgi/flup) or mod_python will not work as neither WSGI
> > > > specification or mod_python support chunked transfer encoding on
> > > > request content. Certainly for mod_python and mod_wsgi, it should
> give
> > > > an error back before even gets to Django saying that content length
> > > > required to be set.
> >
> > > > Graham
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Overriding admin templates

2008-11-01 Thread Karen Tracey
On Sat, Nov 1, 2008 at 5:54 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote:

>
> Low Kian Seong wrote:
> > http://www.djangobook.com/en/1.0/chapter17/
>
> Yes, thank you, that's it.
>
> It worked nicely for the change_form.html example given in that
> chapter. However, for the change_list.html it still doesn't work.
> Seems to me I've hit a django bug. Anyone else?
>

I just tried this, and it works for me for change_list.html. So I'm not sure
what is going on in your case.  For me it just works, overriding change_list
on a per-model basis using a file:

templates/admin///change_list.html

Karen


> /L
>
> > On Sat, Nov 1, 2008 at 6:20 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote:
> >> Low Kian Seong wrote:
> >>> You are supposed to put the admin template you want to override in
> >>> your own template directory definition in settings.py
> >>>
> >>> So, if you defined it as /home/stava/ >>> name>/template/admin/change_list.html
> >> Huh?
> >> /L
> >>
> >>> On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROTECTED]>
> wrote:
>  I'd like to override part of an admin change_list template.
> 
>  Reading the documentation, my understanding is that I can place
>  a template in a certain place in the templates directory hierarchy,
>  and django will look for it and use it, i.e.:
> 
>  templates/admin/build/job/change_list.html
> 
>  ...where "build" is my application and "job" is my model class.
> 
>  The change_list.html file only contains the part I want to override,
>  i.e. the extrahead block. It contains:
> 
>  {% extends "admin/change_list.html" %}
>  {% block extrahead %}
>    
>  {% endblock %}
> 
>  However, this does not work for me, so I'm expecting it to be some
>  mistake on my part, I just can't figure out what the mistake is.
> 
>  Now, if I put the file in ./templates/admin/build/change_list.html
>  it still wont work. On the other hand, this would be overriding all
>  "build" application change lists, which is not what I was looking for.
> 
>  Only way I've found is to copy the change_list.html from the django
>  installation in contrib/admin/templates/admin, and then modify it to
>  my needs, using "if" statements to figure out which application model
>  class is being rendered, and the put the change_list.html in my app's
>  templates/admin directory, which doesn't feel right.
> 
>  Any input appreciated
>  /Lars Stavholm
> 
> 
> >>
> >>
> >
> >
> >
>
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Strange admin validation behaviour.

2008-11-03 Thread Karen Tracey
On Sun, Nov 2, 2008 at 12:07 PM, jiussa <[EMAIL PROTECTED]> wrote:

>
> Hi
>
> Been working through the online tutorial without problems up to the
> end of part 3. However if I now go back to the admin and try to edit
> choices for a Poll I get an error message saying "Please correct the
> errors below." without indicating any particular field.
>
> If I have created no Choices for a Poll this error doesn't seem to
> occur. When I create a brand new Poll I can add as many Choices to it
> as I want, however if I go to add choices to an existing Poll (or even
> just save a poll with which already has choices present) the error
> occurs.
>
> If I remove the "inlines = [ChoiceInline]" line from my PollAdmin
> class the problem seems to dissapear as well.
>
> I've added no code other than what's in the tutorial.
>
> Thanks.
>

Sounds like:

http://code.djangoproject.com/ticket/9076

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin behavior: what is errors.items in change_form.html?

2008-11-03 Thread Karen Tracey
On Mon, Nov 3, 2008 at 2:16 PM, nazar <[EMAIL PROTECTED]> wrote:

>
> I met some unusual behavior in my project in admin change form with
> inlines. There is code in template change_form.html:
>
> {% blocktrans count errors.items|length as counter %}Please correct
> the error below.{% plural %}Please correct the errors below.{%
> endblocktrans %}
>
> Template can't evaluate 'errors.items' object.
>
> As I saw in code there is no "items" attribute, method or dictionary
> key in 'errors'.
>
> Can anybody explain what is this and why it works?
>
>
Looks like a bug.  The '.items' part just shouldn't be there.  As it is no
matter whether there is a single or multiple errors the plural message is
displayed.  Removing the .items (errors is a list type, not a dictionary)
fixes things so that the singular message is displayed when there is only
one error to be fixed.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django: object has no attribute 'clean_data', Help me!!!

2008-11-04 Thread Karen Tracey
On Tue, Nov 4, 2008 at 10:19 AM, 为爱而生 <[EMAIL PROTECTED]> wrote:
> Environment:
> [snipped]
>
> File "C:\Python25\Lib\site-packages\django\forms\forms.py" in full_clean
> 227. value = getattr(self, 'clean_%s' % name)()
> File "D:\django\django_bookmarks\bookmarks\forms.py" in clean_username
> 26. username=self.clean_data['username']
>
> Exception Type: AttributeError at /register/
> Exception Value: 'RegistrationForm' object has no attribute 'clean_data'

You are apparently trying to use code written for an older version of Django
on a newer version of Django.  clean_data was renamed to cleaned_data quite
a while ago:

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Newforms:clean_datachangedtocleaned_data

Assuming you want to use a 1.0 level of Django, you either need to get a
version of the code you are running that has been updated to work with
Django 1.0, or you will need to migrate it yourself (in which case you may
need to do more beyond adjusting to this change, see the porting guide and
list of Backward Incopmatible changes pointed to above).

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: custom auth

2008-11-04 Thread Karen Tracey
On Tue, Nov 4, 2008 at 11:39 AM, Gabriel Rossetti <
[EMAIL PROTECTED]> wrote:

>
> Gabriel Rossetti wrote:
> > Hello everyone,
> >
> > I'm trying to get a custom auth handler to work but I keep on getting
> > this error when accessing request.user.get_profile() :
> >
> > DoesNotExist: User matching query does not exist.
> >
> > I followed the following tutorials :
> >
> > http://garage.pimentech.net/mdm_src_dj_auth_documentation/
> >
> http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/
> >
> > Here is my auth handler :
> >
> > from proj.app.models import User as MyUser
> > from django.contrib.auth.models import User, check_password
> >
> > def authenticate(self, username=None, password=None):
> > try:
> > myUser = MyUser.objects.get(email=username)
> > except MyUser.DoesNotExist:
> > return None
> > pwdValid = check_password(password, myUser.password)
> > if(pwdValid):
> > try:
> > user = User.objects.get(username=username)
> > except User.DoesNotExist:
> > user = User(username=username,
> > email=username,
> > first_name=myUser.firstName,
> > last_name=myUser.lastName,
> > password="none")
> > user.is_staff = False
> > user.is_superuser = False
> > user.save()
> > myUser.user = user # Not sure if this is really needed,
> > I tried it since it didn't work and it still doesn't
> > myUser.save() # Not sure if this is really needed, I
> > tried it since it didn't work and it still doesn't
> > return user
> > return None
> >
> > def get_user(self, userId):
> > try:
> > return User.objects.get(pk=userId)
> > except User.DoesNotExist:
> > return None
> >
> > here is my model :
> >
> > from django.db import models
> > from django.contrib.auth.models import User as DjangoUser
> >
> > class User(models.Model):
> > id = models.AutoField(primary_key=True)
> > firstname = models.CharField(maxlength=20)
> > lastname = models.CharField(maxlength=20)
> > email = models.CharField(maxlength=50)
> > password = models.CharField(maxlength=20)
> > user = models.ForeignKey(DjangoUser, unique=True)
> > #user = models.OneToOneField(DjangoUser, core=True) # This doesn't
> > work either
> >
> > I really don't see why it doesn't work...does anyone have a clue?
> >
> > Thank you,
> > Gabriel
> >
> > PS I've already looked at past posts on the subject but the common
> > answer is to create the profile, but in my case it's already created,
> > maybe I'm linking it wrong?
> >
> >
> Am I getting no responses because :
>
>   1) I missing something obvious
>   2) I said something wrong
>   3) The answer is so simple that no one wants to take the time to write it
>   4) No one has a clue
>   5) No on has the time
>   6) Another reason not listed here
>
>
It's a pretty safe bet that mostly people don't have the time for a question
that is sufficiently complicated/confusing to require more than a simple
answer.  From a high level it isn't immediately obvious how a custom
authenticate method can cause get_profile() to fail -- get_profile knows
nothing of custom authentication.  The error you are getting means that for
whatever user ID you are attempting get_profile() on, there is no record in
your custom User table (btw I find it confusing to name more than one model
the same thing and I think you are asking for trouble when you forget the
"as User" on your import of User somewhere) with that ID.

Looking at your custom authenticate, however, does provide some clues as to
what might have gone wrong -- you are doing more in authenticate than just
authenticating.  It appears you are auto-creating
django.contrib.auth.models.User objects to match your existing custom User
objects.  The lines you have that set the 'user' field in a  custom User
object and save it are necessary to link your custom User to the associated
Django user model, but from the comments it appears you did not have them
there initially.  Thus you may have created some number of Django user
objects without having set the appropriate value in the associated custom
user model.  Adding those lines after-the-fact won't fix the existing custom
User models that don't have the proper values set in the user field, since
on a 2nd run through of the same code you won't fall into the except
UserDoesNotExist case since you created the User on the first go-round.

So, check the values for the user column in your custom user table.  Based
on the error you are getting they don't appear to be correct and the code as
you have it won't fix that.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google

Re: Newb testing question

2008-11-04 Thread Karen Tracey
On Tue, Nov 4, 2008 at 12:07 PM, Rick <[EMAIL PROTECTED]> wrote:

>
> Give a man a fish...
>
> Right, so I see now what's going on. Is this the right place to argue
> about how this works?
>

It isn't clear what you see or what you want to argue about?

cleaned_data is established when the form is validated and is deleted if the
entire form does not pass validation (though I think there is a ticket open
that asks for cleaned_data to stick around with the valid values that did
pass validation, so that might change).

There is no way to validate part of a form -- it is all-or-nothing.  If you
want to check for an error on a specific field, then check for the existence
of that field's name in the errors dictionary after calling is_valid().
(You can also verify that you get the exact error message you are looking
for, if you like.)

Karen


>
> ---Rick
>
>
> On Nov 4, 8:46 am, Rick Kitts <[EMAIL PROTECTED]> wrote:
> > Thanks, it does but this is a bad test methodology. is_valid()
> > verifies the entire form and there is no way of knowing in the test if
> > the validation is failing because of other reasons or the specific one
> > I (think) I'm testing.
> >
> > I guess the broader question then is when is cleaned_data established?
> > It appears transient since if I call the clean_xxx() method after
> > calling is_valid() then I still get the attriberr.
> >
> > ---Rick
> >
> > On Nov 4, 2008, at 5:10 AM, Dan Fairs wrote:
> >
> >
> >
> > >> Running the test causes a splash of barf that says:
> >
> > >> AttributeError: 'TheFormClass' object has no attribute 'cleaned_data'
> >
> > > Try calling form.is_valid() (which should in addition return whether
> > > the validation framework as a whole thought the form was valid). This
> > > should invoke your clean_ method.
> >
> > > Cheers,
> > > Dan
> >
> > > --
> > > Dan Fairs <[EMAIL PROTECTED]> |http://www.fezconsulting.com/
> >
> >
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: link to other record in admin change list

2008-11-04 Thread Karen Tracey
On Tue, Nov 4, 2008 at 3:24 AM, chris <[EMAIL PROTECTED]> wrote:

>
> Dear Fabio,
>
> That did the trick!  I have searched all over the manuals, but must
> have overlooked this.  It is a bit confusing that this seems to be
> different from is_safe and mark_safe, but for the moment I am happy
> that its working now.  Thanks a lot for pointing it out!
>

allow_tags predates the general autoescaping support that added is_safe &
friends, that is why its name is a bit inconsistent.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin behavior: what is errors.items in change_form.html?

2008-11-04 Thread Karen Tracey
On Tue, Nov 4, 2008 at 7:36 AM, nazar <[EMAIL PROTECTED]> wrote:

>
> Now I got it!!!
>
> I had TEMPLATE_STRING_IF_INVALID = 'TEMPLATE_STRING_IF_INVALID'
>
> So that 'items' was rendered as 'TEMPLATE_STRING_IF_INVALID' (and I
> saw it clearly). And I met the bug, bacause gettext was unable to use
> it as int parameter.
>
> Now I cleared this: TEMPLATE_STRING_IF_INVALID = '' and bug
> disappeared.
>

Yes, the admin rather relies on TEMPLATE_STRING_IF_INVALID being empty.
See:

http://docs.djangoproject.com/en/dev/ref/templates/api/#invalid-template-variables
http://code.djangoproject.com/ticket/3579

However, this particular case is a genuine bug in the admin templates.  Even
with an empty TEMPLATE_STRING_IF_INVALID, the wrong message is displayed
when there is only one error to be corrected on the page.   I've opened a
ticket to get that (and anywhere else in the admin that this construct is
used) fixed:

http://code.djangoproject.com/ticket/9514

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Newb testing question

2008-11-04 Thread Karen Tracey
On Tue, Nov 4, 2008 at 2:06 PM, Rick Kitts <[EMAIL PROTECTED]> wrote:

> Well, I think it's clear what I see. I sort of disagree about the impl,
> design, call it what you will.
>

It wasn't clear to me what you had seen nor what you wanted to argue about
though you have clarified that some in this post.


>
> Specifically, the current impl makes testing harder than it needs to be, or
> at least the testing that I'd like to do. That is, I have a field, that
> field has validation rules and I'd like to test that the work. Strictly a
> field has 2 sets of validation rules, those on the field itself (or is it
> more correct to say on the widget), and a (possibly empty) set of rules
> defined by the form creator (call them creator validations).
>
> So a couple of issues about this.
>
> First, the cleaned_data attribute (member?) is not guaranteed to be
> populated fully at the time any creator validation is called. That is, if I
> have 2 dependent fields, say password1, password2, I cannot get
> cleaned_data['password2'] inside of the creator validator clean_password1()
> unless/until the full_clean() impl get's to the field password2. Thus the
> ordering of fields and the impls of clean_xxx() are coupled in what I'd call
> a non-obvious fashion. This seems unnecessary but that's just me.
>

The order of things during validation is specified clearly in the docs:

http://docs.djangoproject.com/en/dev/ref/forms/validation/

This page has a subsection on cleaning fields that depend on each other,
where it is recommended that such validation be done in the form clean()
method as opposed to an individual field's clean method.  An individual
field's clean method should really focus on validating that field's data,
not that field's data plus some other field's data.  It isn't clear to me if
you are unaware of the existence of the form's overall clean() method or if
you just don't agree with the recommendation that that is where cross-field
validation should be performed.  (Also cross-field validation didn't seem to
be an issue in your first message so I don't know if we've gotten off on a
tangent or if that was really an issue in your first example.)


>
> Second this tends to make righting unit tests rather more error prone. Or
> at least the sort of tests I'm used to writing. I realize there are various
> idiomatic ways of dealing with the problems I'm having (spelunk the error
> list, etc) but certainly I can imagine better ways. Keep in mind I'm not at
> all a python person (yet) so this may in fact be entirely infeasible. But
> presumably one can do something like declare clean_xxx as follows:
>
> def clean_something(self, password1, password2):
> # Stuff
>
> Provided one can get to the names of the arguments it seems then that it
> would be useful to do something in full_clean() like
>
> for each argument in the args list of each clean_xxx method:
> name = arg name
> if there_is_a_field_named(name):
> set the value of that argument to field.clean()
> else:
> raise somethingorother
>
> I like this in several dimensions, much as I'd like faster-than-light
> travel, which is to say it would be really cool but I don't see how to get
> there from here.
>

Regardless of whether this is implementable in Python I feel it would be
rather more complicated to explain and use than the current approach.  clean
for a field not only validates that the data is OK but normalizes it to a
consistent form -- if you start trying to do cross-field validation before
all of the individual data bits have been normalized then your cross-field
validation has to worry about handling non-normalized data.  As it is if you
put your cross-field validation in the form's clean() method then it only
has to deal with validating normalized data.


> Anyway, I can see several ways around this and I'll pick one or the other.
> OTOH, if testing at this level of granularity is inconsistent with the
> python/djano world view, I would love to hear what's better. Understanding
> code is easy(ish), philosophy is hard.
>

Testing that an individual field's validation works as expected is not
inconsistent with Django or Python philosophy.  However testing that by
calling the field's clean method directly is not the right approach -- this
method is intended to be called by Django as part of the overall form
cleaning.  Therefore to ensure that the environment/args/etc is set up for
it as it will be when your code actually runs in production, it is best to
test it by calling the form's is_valid() function, and examining the results
in the effect it has on the form.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~

Re: problem building project with python 2.6 startproject won't work

2008-11-04 Thread Karen Tracey
On Tue, Nov 4, 2008 at 4:12 PM, bizcuit <[EMAIL PROTECTED]> wrote:

>
> I have been using Django with Python 2.5 the past few months.
>
> Today I removed Python 2.5 installed Python 2.6 and downloaded Django.
>
> when I try to create a project from the command line in Windows Vista:
>
> django-admin.py startproject myProject
>
> I get "Type 'django-admin.py help' for usage." returned.
>
> Does anyone know why this is not working?
>

Do you have DJANGO_SETTINGS_MODULE defined in the environment?  startproject
is not a valid command if settings have been specified, see:

http://code.djangoproject.com/ticket/8639

which links to another ticket that asks for an improved error message in
this case.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: cleaned_data of invalid forms

2008-11-05 Thread Karen Tracey
On Wed, Nov 5, 2008 at 7:43 AM, Thomas Guettler <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> up to now cleaned_data is removed, if the form is invalid.
>
> What is the best way, to get the cleaned data (converted to
> python objects) of a form which is invalid?
>
> Example: The form has field for a group. You want to display
> the members of the group right to the input widget.
>
> I looked at forms/form.py ... def full_clean(). I could copy
> this method an write a utility function which only works
> for one field. But that is not a good solution.
>
> Do other people need this too? If yes, I could write a proposal with patch.
>

There is already a ticket for this:

http://code.djangoproject.com/ticket/5524

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Oracle Clob Field type

2008-11-05 Thread Karen Tracey
On Wed, Nov 5, 2008 at 5:54 PM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> Noob here...
>
> I have an existing table with two Clob fields.  While defining the
> model I use TextField as the filed type.
>
> running  gives me back the error:
>
> cx_Oracle.DatabaseError: ORA-01754: a table may contain only one
> column of type LONG
>
> Well, what I really want are clobs to begin with.  It sounds like what
> I really want to do is subclass Field, but this is starting to turn in
> to more trouble than it's worth...
>
> This has to be something somebody's come across before.
>
>
I've no experience with Oracle but -- you run syncdb to create your tables.
If you already have the table, why are you running syncdb?

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: date formats in settings.py

2008-11-06 Thread Karen Tracey
On Thu, Nov 6, 2008 at 11:30 AM, Benedict Verheyen <
[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> i have a question on the different date/time settings one can specify in
>  the settings.py.
> I currently have these:
> TIME_ZONE = 'Europe/Brussels'
> DATE_FORMAT = 'd/m/Y'
> DATETIME_FORMAT = 'd/m/Y H:i'
> TIME_FORMAT = 'H:i'
> YEAR_MONTH_FORMAT = 'm Y'
> MONTH_DAY_FORMAT = 'd m'
>
> However, any date i enter in the admin section is displayed as Y-m-d.
> I thought these settings would adjust the way dates are displayed but it
> doesn't seem so.
> What is the purpose of these settings?
>
> Possibly they are being over-ridden by the translation you are using --
see:

http://code.djangoproject.com/ticket/2203

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: defaultdict is not working on "for" template tag iteration.

2008-11-07 Thread Karen Tracey
On Fri, Nov 7, 2008 at 2:51 AM, Hyungyong Kim <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> Since a few hours ago, I've suffered following problem.
> I found this problem is due to collections.defaultdict.
>
> Normal dictionary is working collectly, but defaultdict is not
> working.
>
> >>> from django.template import Template, Context
> >>> t = Template("{% for k,v in data.items %}{{ k }}: {{ v }}{% endfor %}")
> >>> normal_dict = {'a':1, 'b':2}
> >>> t.render(Context({'data':normal_dict}))
> u'a: 1b: 2'
> >>>
> >>> from collections import defaultdict
> >>> default_dict = defaultdict(int)
> >>> default_dict[1]+=1
> >>> default_dict[2]+=1
> >>> default_dict[1]+=1
> >>> default_dict
> defaultdict(, {1: 2, 2: 1})
> >>> t.render(Context({'data':default_dict}))
> Traceback (most recent call last):
>  File "", line 1, in 
>  File "/usr/lib/python2.5/site-packages/django/template/__init__.py",
> line 176, in render
>return self.nodelist.render(context)
>  File "/usr/lib/python2.5/site-packages/django/template/__init__.py",
> line 768, in render
>bits.append(self.render_node(node, context))
>  File "/usr/lib/python2.5/site-packages/django/template/debug.py",
> line 81, in render_node
>raise wrapped
> django.template.TemplateSyntaxError: Caught an exception while
> rendering: 'int' object is not iterable
>
> Original Traceback (most recent call last):
>  File "/usr/lib/python2.5/site-packages/django/template/debug.py",
> line 71, in render_node
>result = node.render(context)
>  File "/usr/lib/python2.5/site-packages/django/template/
> defaulttags.py", line 122, in render
>values = list(values)
> TypeError: 'int' object is not iterable
>
> >>>
>

This is due to the interaction between the way in which Django attempts to
resolve variables containing dots in templates (see
http://docs.djangoproject.com/en/dev/topics/templates/#variables) and the
fact that when you attempt to access a non-existent key in a defaultdict
(that has a default_factory like you have specified) it automatically gets
created.  So, Django's first attempt to resolve data.items is a dictionary
lookup of 'items' in your default dict (default_dict['items']), and instead
of failing it returns the default value of 0.  Since the dictionary acess
attempt works, Django goes ahead and attempts to use the returned value
instead of moving on an trying the other lookup methods.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: problem with inlineformset_factory

2008-11-07 Thread Karen Tracey
On Fri, Nov 7, 2008 at 9:10 AM, Daniel Roseman <
[EMAIL PROTECTED]> wrote:

>
> On Nov 4, 6:02 pm, Petry <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > I'm having a weird problem when using inlineformset_factory, he can
> > only register up to 2 records, after that causes a validation error
> >
> > "(Hidden field id) User phone with this None already exists."
> >
> > Here is my forms [1], models [2] and views [3]
> >
> > [1]http://dpaste.com/88598/
> > [2]http://dpaste.com/88599/
> > [3]http://dpaste.com/88600/
> >
> > --
> >
> > Marcos Daniel Petryhttp://mdpetry.net
>
> The problem isn't anything to do with inline forms, it's this in your
> model:
>user = models.ForeignKey(User
>,blank=True
>,unique=True)
> What you are saying here is that you can only have each value for user
> once in the whole table - and that includes the value 'None', ie only
> one ShipSalesUser can have an empty user field.
>
>
I have not looked at the original problem in any detail, but the failure to
allow multiple NULL values when unique=True is set for the field was a
Django bug that has been fixed, see:

http://code.djangoproject.com/ticket/9039

So, if this is the cause of the problem, using the 1.0.X branch or current
trunk code instead of 1.0 should fix it.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: __import__(settings) failure

2008-11-07 Thread Karen Tracey
On Fri, Nov 7, 2008 at 5:28 PM, matthew <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I'm sure this is a properly neophyte post, but I'm stumped and would
> really appreciate some guidance. I am trying to serve a site under
> apache2 using django. I have apache2 and mod_python installed (setup
> below). I have followed the instructions at
>
> http://docs.djangoproject.com/en/dev/howto/deployment/modpython/?from=olddocs
> about configuring apache. My apache2.conf contains:
>
> 
>SetHandler python-program
>PythonHandler django.core.handlers.modpython
>SetEnv DJANGO_SETTINGS_MODULE WORD.settings
>PythonDebug On
>PythonPath "['/home/matthew/current/django','/home/matthew/current/
> django/WORD'] + sys.path"
> 
>
> When I navigate to localhost/WORD/publications (where my app is) I
> see:
>
> [START ERROR]
> Mod_python error: "PythonHandler django.core.handlers.modpython"
>
> Traceback (most recent call last):
>
> [snip]



> ... I'm sure that I'm missing
> something blindingly obvious, but if someone could please point it out
> to me I'd be really grateful.
>

Does the user Apache is running as have read access to the directory with
your code?


>
> I am using:
> Debian Stable (Etch)
> Python 2.4.4-2
> Django 0.95.1-1etch2
> Apache2  2.2.3-4+etch6
> mod_python  3.2.10-4
>

BTW unless you are using pre-existing code written for the 0.95 level of
Django I would not recommend that level.  Django 1.0 would be a much better
place to start from.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: select for update

2008-11-07 Thread Karen Tracey
On Fri, Nov 7, 2008 at 9:45 PM, tegbert <[EMAIL PROTECTED]> wrote:

>
> SELECT FOR UPDATE has been discussed in this group before, but I don't
> think it's been resolved whether it should be implemented in Django. I
> think it should.
>
> [snip]
>
... Any thoughts on how this could be implemented would be
> appreciated.
>

There's a ticket for this, with a not-too-old patch:

http://code.djangoproject.com/ticket/2705

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: App initialized twice? plus, debugging tips.

2008-11-08 Thread Karen Tracey
On Thu, Nov 6, 2008 at 6:43 PM, project2501 <[EMAIL PROTECTED]> wrote:

>
> Hi,
>  I'm new to django and have a couple questions.
>
> I have a __init__.py in my app and try to declare a simple module wide
> variable. I noticed __init__.py is called twice when I run "python
> manage.py runserver". Is this normal?
>

The may be caused by runserver's default autoreloader.  If you try runserver
with --noreload and don't see your __init__.py code getting called twice
than that is what is causing it.  You generally want to run with the
autoreloader, though, so that code changes are automatically picked up by
the running server (unless you are running under a debugger, where the
reloading prevents breakpoints from working).

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: problem with inlineformset_factory

2008-11-08 Thread Karen Tracey
On Sat, Nov 8, 2008 at 8:56 AM, Petry <[EMAIL PROTECTED]> wrote:

>
> somebody can help me?
>

I didn't recommend changing your code, I recommending trying with current
SVN level of the 1.0.X branch or trunk, in order to ensure you have a fix
that might be relevant (I still have not had time to look in detail at your
particular models/forms/etc so I'm not completely sure that is what you are
hitting, but it sounds likely based on Daniel Roseman's comments).  You do
not mention if you have tried your code on current SVN, not 1.0 Django?

Karen


>
> On 7 nov, 13:24, Petry <[EMAIL PROTECTED]> wrote:
> > I changed my template model to use OneToOneField and remove the
> > Blank=True, but the same error appears...
> >
> > On 7 nov, 12:30, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> >
> > > On Fri, Nov 7, 2008 at 9:10 AM, Daniel Roseman <
> >
> > > [EMAIL PROTECTED]> wrote:
> >
> > > > On Nov 4, 6:02 pm,Petry<[EMAIL PROTECTED]> wrote:
> > > > > Hi all,
> >
> > > > > I'm having a weird problem when usinginlineformset_factory, he can
> > > > > only register up to 2 records, after that causes a validation error
> >
> > > > > "(Hidden field id) User phone with this None already exists."
> >
> > > > > Here is my forms [1], models [2] and views [3]
> >
> > > > > [1]http://dpaste.com/88598/
> > > > > [2]http://dpaste.com/88599/
> > > > > [3]http://dpaste.com/88600/
> >
> > > > > --
> >
> > > > > Marcos DanielPetryhttp://mdpetry.net
> >
> > > > The problem isn't anything to do with inline forms, it's this in your
> > > > model:
> > > >user = models.ForeignKey(User
> > > >,blank=True
> > > >,unique=True)
> > > > What you are saying here is that you can only have each value for
> user
> > > > once in the whole table - and that includes the value 'None', ie only
> > > > one ShipSalesUser can have an empty user field.
> >
> > > I have not looked at the original problem in any detail, but the
> failure to
> > > allow multiple NULL values when unique=True is set for the field was a
> > > Django bug that has been fixed, see:
> >
> > >http://code.djangoproject.com/ticket/9039
> >
> > > So, if this is the cause of the problem, using the 1.0.X branch or
> current
> > > trunk code instead of 1.0 should fix it.
> >
> > > 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin interface crashes when adding a new item with a ForeignKey

2008-11-10 Thread Karen Tracey
You left off the actual exception you get.  Also, the details of your Model
and ModelAdmin definitions would be helpful (please post to dpaste.com and
point to them if they're big enough to display poorly in email), since I've
used this method myself without error so I suspect there is something
specific about your setup coming into play.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin Interface - "You don't have permission to edit anything"

2008-11-10 Thread Karen Tracey
On Mon, Nov 10, 2008 at 5:06 AM, Saravana Kumar K, Bangalore <
[EMAIL PROTECTED]> wrote:

>  Hi All,
>
>I was trying to install Autotest tool, which is used for kernel testing.
> It uses the Django also, Please  find the link below
>
>http://autotest.kernel.org/wiki/AutotestServerInstall
>
>  I followed all the instructions from the above link, But when i try to
> access the Admin interface, getting error Site Administrator "You don't have
> permission to edit anything". Can any one help me out of this issue...
>

I know nothing of this tool, but that error generally means you have not
included `admin.autodiscover()` in your urls.py file.  However, that command
was added in Django 1.0 (and I never saw an occurrance of that error
reported prior to the additon of admin.autdiscover()) and I see from looking
at the page you point to that they tell you to install Django 0.96.  So, if
you are using 0.96 admin.autodiscover() won't help.  It might not really
help on 1.0 either since if the app was written for 0.96 it is unlikely to
run unchanged on 1.0.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: has more than 1 ForeignKey to

2008-11-10 Thread Karen Tracey
On Mon, Nov 10, 2008 at 3:50 AM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> Hi all,
>
> I have a UserProfile connected to auth.models.User using
>
>user = models.ForeignKey(User, unique=True)
>
> Additionally, I'd like to connect users to each other with manager/
> managed hierarchical relationships, whereby everyone has one manager
> (except the big boss who has none):
>
>manager = models.ForeignKey(User, blank=True,
> related_name='employees_userprofile_manager')
>
> My models fail to load with the exception:
>  has more than 1
> ForeignKey to 
>
> This doesn't seem logical to me at all: the above is a perfectly fine
> example of two foreign keys being meaningful. Why is this not possible
> and what is the workaround, or rather, the proper way to do this?
>
> I'm using Django 1.0.
>
> Any help is much appreciated.
>

I don't know what "fails to load" means -- that is, you haven't made it
clear what you are doing when the error is triggered.  manage.py runserver?
Something in the admin? Also the full traceback would be helpful, since that
would give a clue what portion of the Djano code is objecting.  As is I
suspect you are doing something with inlines but haven't told the admin
which ForeignKey to use, see:

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#fk-name

If that's not it please provide more specifics of what you are doing and the
traceback received.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom prepopulated SelectField's in DjangoAdmin

2008-11-10 Thread Karen Tracey
On Mon, Nov 10, 2008 at 3:19 PM, ilmarik <[EMAIL PROTECTED]> wrote:

>
> PS. django documentation is getting crapy these days :(
>

Comments like this are not particularly helpful.  What do you expect anyone
to do in response to this comment? It's quite likely all it will do is
discourage anyone who has spent any significant effort on the docs (and that
set of people doesn't include me so I am not reacting out of any personal
feelings here).  The docs recently underwent a complete restructure in an
effort to make them more useful, not less -- it is not a case that they have
been neglected.

If you have specific suggestions for improvement, please share them.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: using Etags or http response code 304 (not modified)

2008-11-10 Thread Karen Tracey
On Mon, Nov 10, 2008 at 4:14 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

>
> I've tried using the USE_ETAGS=true in my project settings and even
> tried using the ConditionalGet Middleware. However, whenever an http
> request is made to my page, it always seems to return a http code 200
> along with the entire data.
>
> how / what do I need to do so that a http 304 is issued if the data
> hasnt been modified ?
>
> do i need to do do anything within my view to issue the http 304 ?
>

No, I just set USE_ETAGS=True in my settings.py and (since I already had
CommonMiddleware specified) now I see my server return 304 for unchanged
pages.  Presumably you're using something to look at the headers in the
requests/responses -- can you see the Etag in the responses?  Is your client
sending If-None-Match when it then requests the same page?

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.

2008-11-10 Thread Karen Tracey
On Mon, Nov 10, 2008 at 6:10 PM, ayayalar <[EMAIL PROTECTED]> wrote:

>
> Hello I am new to Django.
>
> I am trying to exercise "templates" through the interactive shell,
> however I end up getting this error. Can anyone help?
>
> here is the exact steps I follow:
>
> 1) cd C:\Django\mysite
>
>manage.py
>settings.py
>settings.pyc
>urls.py
>urls.pyc
>views.py
>views.pyc
>__init__.py
>__init__.pyc
>
> 2) set DJANGO_SETTINGS_MODULE=mysite.settings I've also tried set
> DJANGO_SETTINGS_MODULE=settings.py
>

Setting it to mysite.settings will work if c:\django is on your PYTHONPATH.

Setting it to settings.py won't work at all because of the .py.  Assuming
you are running the python from c:\django\mysite, setting
DJANGO_SETTINGS_MODULE to just 'settings' will work.  Or, use 'python
manage.py shell', which assumes settings.py is in the current directory and
sets the environment up for you.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error in: python manage.py syncdb

2008-11-10 Thread Karen Tracey
On Mon, Nov 10, 2008 at 8:16 PM, Sean <[EMAIL PROTECTED]> wrote:

>
> When I run the command python manage.py syncdb to sync database, but
> failed
>
> I got the following error messages:
>
> File "C:\Python25\Lib\site-packages\django\contrib\auth\management
> \_init_.py". line 47 , in 
> signals.post_syncdb.connect object has no attribute 'connect''>
>
> I got django1.0, Python2.52, Apache2.2.9, MySQL5.0.67,
> PHPMyAdmin2.11.9.2
>
>
Are you sure you have a clean install of Django 1.0? That's a somewhat
mangled (there should be a paren, not an angle bracket, before
create_permissions, AttributeError should start a new line, the first object
should have an end quote, etc.) version of the error you would get if you
had 1.0 code in django\contrib\auth\management but 0.96 level code in
django\db\models\signals.py.  You might want to delete the whole
c:\Python25\Lib\site-packages\django tree and re-install Django 1.0.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Setting Up Django on Vista and Creating a Database

2008-11-11 Thread Karen Tracey
On Tue, Nov 11, 2008 at 1:40 AM, John Antony <[EMAIL PROTECTED]> wrote:

>
> I am currently using Vista OS
> I have installed Python in the path
> D:\Python26\
> and extracted the tarred file downloaded from www.djangoprojects.com
> ie "Django-1.0.tar.gz" in the path
> D:\Python26\Django-1.0\Django-1.0
> I am however unable to intall Django
> on typing the following command in command prompt I get this error:
>
> D:\Python26\Django-1.0\Django-1.0>python setup.py install
> 'python' is not recognized as an internal or external command,
> operable program or batch file.
>

The Python installer did not put the directory containing the python.exe
executable in the Windows PATH environment variable.  That is why all the
Django instructions for Windows generally drop the 'python' from such
commands, since on Windows usually all you can count on when writing
instructions is that the Python installer set up an association between
'.py' files and the python executable.  So, if you drop the python from the
front of the command, that should work.

However, I have heard reports that the association created by the Python 2.6
installer on Vista is broken, see here:

http://groups.google.com/group/django-users/msg/1d00809e826fa8c3

So, you may need to fix that as described in that message.

You can also put the path to python.exe in your Windows system path, so that
you can use the 'python whatever' form of commands.  In older versions of
Windows you would do that by going to Start->Settings->Control Panel,
choosing "System", selecting the "Advanced" tab, clicking on "Environment
Variables", and finding/editing the one for PATH.  I do not know if that has
changed in Vista.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: don't escape html tags

2008-11-12 Thread Karen Tracey
On Wed, Nov 12, 2008 at 4:20 AM, izzy <[EMAIL PROTECTED]> wrote:

>
> Hi.
>
> I'm new to Django. And I'm having problems with templates.
>
> I have a richtext field that stores HTML(using TinyMCE). But when I
> display it on template it simply renders all in html:
>
> http://www.thesynapticleap.org/files/
> tsl/images/tinymce_0_0.png"
> alt="sample image" width="530"
> height="392" />
>  
>
> I would like to see it as plain text.
>
> Any help would be appreciated.
>

As mentioned earlier in the thread, you want to read what the docs have to
say about autoescaping, e.g.:

http://docs.djangoproject.com/en/dev/topics/templates/#id2

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: TemplateDoesNotExist

2008-11-12 Thread Karen Tracey
On Wed, Nov 12, 2008 at 1:39 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>wrote:

>
> I tried this using the development server on my local machine and got
> the same result:
>
> Template-loader postmortem
>
> Django tried loading these templates, in this order:
>
>* Using loader
> django.template.loaders.filesystem.load_template_source:
>  o /django_projects/django_templates/polls/index.html (File
> does not exist)
>* Using loader
> django.template.loaders.app_directories.load_template_source:
>  o /Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/contrib/admin/templates/polls/
> index.html (File does not exist)
>

You are saying you do have a file named '
/django_projects/django_templates/polls/index.html'?  You can cut-and-paste
that value into a command prompt and cat the contents of the file?  Every
time I have run into TemplateDoesNotExist I've been in error, not the
template loader.  Perhaps you put the files directly in
'/django_project/django_templates' instead of in a polls subdirectory
there?  Or left the l off of html?

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with named URL and parameters

2008-11-12 Thread Karen Tracey
On Wed, Nov 12, 2008 at 10:27 PM, Brandon Taylor <[EMAIL PROTECTED]>wrote:

>
> Hi everyone,
>
> So I have a question/problem with a named URL pattern...
>
> #urls.py
> url(r'^resources/conversions/(?P[-\w]+)/$',
> 'my_site.views.conversions', name='conversions'),
>
> This is a mostly static site, but I would like to be able to pass the
> "conversion_template" parameter to do a dynamic include. However, when
> I try to provide the parameter in my template:
>
> Some text
>
> I receive an error:
> Reverse for 'my_site.conversions' with arguments '(u'steel-plate-
> weight',)' and keyword arguments '{}' not found.
>
> What am I doing wrong?
>
>
The \w in your specifier for conversion_template matches [a-zA-Z0-9_] but
you are trying to match something with dashes in it.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with named URL and parameters

2008-11-12 Thread Karen Tracey
On Wed, Nov 12, 2008 at 10:56 PM, Malcolm Tredinnick <
[EMAIL PROTECTED]> wrote:

>
> > The \w in your specifier for conversion_template matches [a-zA-Z0-9_]
> > but you are trying to match something with dashes in it.
>
> That isn't the issue. The pattern is [-\w], which will also match
> dashes. I'm not sure what is going wrong yet, though, since it looks
> like it should be working.
>

Oh, right.  Time to get some glasses, apparently.
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Basic concept for templatetag using node and parser

2008-11-13 Thread Karen Tracey
On Thu, Nov 13, 2008 at 6:33 AM, suganthi saravanan <
[EMAIL PROTECTED]> wrote:

>
> Thanks bruno...but i have already read the documentation for the Custom
> template tag.
>
>
> http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writing-custom-template-tags
>
> I need simple example for  more clarification
>

The doc is built around the simple example of a "current_time" tag, so it is
hard to know what exactly you are looking for in a 2nd simple example.
Perhaps if you explained what it is you don't follow about the existing
example?  Or what it is you would like to do with a custom tag that isn't
covered by that example?

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Query for all objects in table1 that DO NOT have corresponding objects in table2

2008-11-13 Thread Karen Tracey
On Thu, Nov 13, 2008 at 6:47 AM, Ropley <[EMAIL PROTECTED]> wrote:

>
> Noob question, but I've been running around in circles. I'm building
> an in-house jobs board, and have 2 models:
>
> class jobs(models.Model):
> ...
>
> class viewed_jobs(models.Model):
> job=models.ForeignKey(job)
> ...
>
> I would like to create a query that returns all jobs that have not
> been viewed - that is, those jobs for which there are no corresponding
> entries in viewed_jobs. I'm rather stuck with the model definitions as
> they are, for many reasons, and would like the database to do as much
> work as possible. Web research has shown some potential in the 'extra'
> QuerySet qualifier, but my noobness has defeated me. Grateful for any
> pointers.
>
>
Try:

jobs.objects.filter(viewed_jobs__isnull=True)

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: TabularInline across apps causing unknown error in admin.

2008-11-14 Thread Karen Tracey
On Fri, Nov 14, 2008 at 11:28 AM, J. Cliff Dyer <[EMAIL PROTECTED]>wrote:

>
> Using Django 1.0, devel server, on RHEL5, with python 2.4.
>
> I have two apps, venues and content.  A venues.Venue is linked to
> content.Source via a ManyToManyField defined through VenueSource.  When
> I try to include VenueSource in the Admin form, the admin page for a
> given Venue shows up fine, but when I save it, I get an error saying
> "Please correct the errors below," but no errors show up below.
>
> venues/models.py: http://dpaste.com/90775/
> venues/admin.py :
> http://dpaste.com/90785/
>
> (please ignore the list_filter by ['city'].  It's an artifact from
> stripping down the
> Any thoughts?
>

Your first dpaste link doesn't work for me

Possibly this was fixed by the fix for #9076, which went in earlier this
morning.  Could you try with a current checkout of either the 1.0.X branch
or trunk?

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Serialization of custom model fields

2008-11-15 Thread Karen Tracey
On Sat, Nov 15, 2008 at 9:56 AM, AndyH <[EMAIL PROTECTED]> wrote:

>
> So I'm not missing anything. It's a bug. Ouch...
>
> Thanks for the info, before I trawled my way through the serializers.
> May well have to apply the patch locally to move forward. There
> doesn't seem to be much movement on the ticket.
>

The ticket is only 2 weeks old!  That's not so old for a project with
all-volunteer developers, really.  Also, the ticket got some attention
shortly after it was opened. Russell noted it needed a test minimally to
demonstrate the problem, ideally that integrated into the test suite.  That
might have been provided by the updated patch but that is not clear since
the flags for "patch needs improvement" and "needs tests" were not turned
off.  If you've got a patch that you think addresses the reason for "patch
needs improvement" and "needs tests" it's best to reset the flags when you
attach it, otherwise the ticket continues to look like it's not a candidate
for an easily-evaluated-and-committed fix.

Karen


>
> On Nov 15, 1:40 pm, "Alex Koshelev" <[EMAIL PROTECTED]> wrote:
> > There is ticket and patch for this issuehttp://
> code.djangoproject.com/ticket/9522
> >
> > On Sat, Nov 15, 2008 at 16:38, AndyH <[EMAIL PROTECTED]> wrote:
> >
> > > Hi,
> >
> > > I have a custom model field class that stores event recurrence
> > > information. In python this is an instance of dateutil.rrule.rule, and
> > > in the database I am storing it as an iCal recurrence string. To
> > > convert between these two formats I have to_python and
> > > get_db_prep_value methods on the custom field class (subclassing
> > > models.Field).
> >
> > > Things works more-or-less OK, but when I run dumpdata to serialize the
> > > database into json, at some point to_json gets executed and the
> > > returned value for rrule is ' > > 0x1121828>' and not the value that should be returned by
> > > get_db_prep_value. I also have a 'value_to_string' method on the
> > > fiels, but this does not get executed either.
> >
> > > What am I missing about the way dumpdata handles these custom model
> > > fields?
> >
> > > Thanks
> > > Andy.
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Bug in Admin or in my model ?

2008-11-15 Thread Karen Tracey
There's a bug both in your models and in Django, I think.  Your __unicode__
method for class Metadata:

   def __unicode__(self):
>return "%s %s" % (self.vrstva,self.nazov)
>

needs to be:

   def __unicode__(self):
>
   return u"%s %s" % (self.vrstva,self.nazov)


The bug in Django is that the attempt to report that your existing
__unicode__ method generated an error generated yet another error, and I
haven't quite figured that one out yet.  But if you want to make progress
you can just fix your __unicode__ method.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Css and Images are missing

2008-11-15 Thread Karen Tracey
On Sat, Nov 15, 2008 at 10:49 AM, Luis Goncalves
<[EMAIL PROTECTED]>wrote:

>
> Hello guys I need your help in here.
>
> Sorry I am new in Django and I am having a problem, my css and jpgs
> are missing.
>
> I will write everything what i have and then maybe someone could give
> me a hint :)
>
>
> My settings.py:
> MEDIA_ROOT = '/home/lgoncalves/Arquivos/MyVitaminesShop/media/'
> MEDIA_URL = 'http://127.0.0.1:8000/media/'
> ADMIN_MEDIA_PREFIX = '/media/'
>
>
> My urls.py:
> (r'^media/(?P.*)', 'django.views.static.serve',{'document_root':
> 'settings.MEDIA_ROOT'}),
>
>
> And an example of base.html:
> http://127.0.0.1:8000/media/
> mm_health_nutr.css" type="text/css" />
> http://127.0.0.1:8000/media/picture.jpg"; alt="Header image"
> width="382" height="101" border="0" />
>
>
You've essentially got the same value for MEDIA_URL and ADMIN_MEDIA_PREFIX,
which doesn't work (see:
http://docs.djangoproject.com/en/dev/ref/settings/#admin-media-prefix).  The
development server has a built-in media server for admin which picks off
anything starting with ADMIN_MEDIA_PREFIX and serves up the admin media
files.  You've set things up so your own media files have that same prefix
(the http://127.0.0.1:8000 just serves to route it to a server, once at that
server all that matters is what follows, in your case '/media/', which is
the same as your ADMIN_MEDIA_PREFIX), so the request for your CSS, etc. are
going to the built-in admin media server (which can't find them since it's
looking among the admin media), not the static server.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: installing django on a shared server

2008-11-15 Thread Karen Tracey
On Sat, Nov 15, 2008 at 12:39 PM, Carl <[EMAIL PROTECTED]> wrote:

>
> When I run the installation script I get this error:
>
> error: could not create '/usr/lib/python2.3/site-packages/django':
> Permission denied
>
> How do I get around this?
>

If you're on some flavor of Unix, as you appear to be based on the path, the
instructions (
http://docs.djangoproject.com/en/dev/topics/install/#installing-official-release)
tell you to use the command:

sudo python setup.py install

sudo is what allows you to run the command 'python setup.py install' with
permissions that let it write to system files such as
/usr/lib/python2.3/site-packages.

If you don't actually have permissions to write to system files, you can
"install" Django simply by un-tarring it somewhere you can write to and
setting up your PYTHONPATH environment variable to point to it.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Bug in Admin or in my model ?

2008-11-15 Thread Karen Tracey
On Sat, Nov 15, 2008 at 2:29 PM, Ivan Mincik <[EMAIL PROTECTED]> wrote:

> On Saturday 15 November 2008 18:57, Karen Tracey wrote:
>
> > The bug in Django is that the attempt to report that your existing
> > __unicode__ method generated an error generated yet another error, and I
> > haven't quite figured that one out yet.  But if you want to make progress
> > you can just fix your __unicode__ method.
> What to do with this? Do I have to fill some bug report ?
>

No need, I opened one myself since I wanted to lay out the sequence of what
happens and I'm not entirely sure of the right fix:

http://code.djangoproject.com/ticket/9608

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 [EMAIL PROTECTED]
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   >