Re: Model A imports Model B imports Model A - I'm completely lost as to how to get around circular imports

2009-04-05 Thread Ramiro Morales

On Sun, Apr 5, 2009 at 11:43 AM, codecowboy <guy.ja...@gmail.com> wrote:
>
> Hi Everyone,
>
> I'm new to the Django community and I am having trouble with circular
> imports.  I've read every article that I can find about the issue
> including posts on this group.  I'm going to paste my model files and
> the stack trace.  I'm sure that this must be an issue that has come up
> before.  Thank you in advance for any help.  If you know of an article
> that explains the problem then point me to it.  Thanks again.
>
> [snip]

Do you need to have two, parallel, many to many relationships between Scientist
and Conference?. If the answer is no then yo don't need to define that
relationship in both models. This alone almost solves your circular reference
problem.

The technique of using a string with the name of the model instead of tthe Model
class onject iself to indicate the target of a relationship is only needed (and
accepted) when:

* The target model hasn't yet been defined (It comes after in the same
  application models.py file).

* or when you have two mutually referencing relationships between
  two models located in diferent applications (actually, this second use case
  isn't clearly explained in our documentation)

Using these guidelines and simplifying you example to the relevant bits,
something like this could be a start of a solution to your problem:

-- scinet.scientists.models ---
from django.db import models

class Scientist(models.Model):
# ...
# no many to many field needed here

-- scinet.conferences.models ---
from django.db import models
from scinet.scientists.models import Scientist

class ConferenceAttendee(models.Model):
# ...
conference = models.ForeignKey('Conference')
scientist = models.ForeignKey(Scientist)

class Conference(models.Model):
# ...
scientists = models.ManyToManyField(Scientist, through=ConferenceAttendee)


Relevant documentation links worth reading:

http://docs.djangoproject.com/en/dev/topics/db/models/#many-to-many-relationships
http://docs.djangoproject.com/en/dev/topics/db/models/#models-across-files
http://docs.djangoproject.com/en/dev/ref/models/fields/#lazy-relationships

HTH

--
Ramiro Morales
http://rmorales.net

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



Re: can't connect with dbshell

2009-03-20 Thread Ramiro Morales

On Wed, Mar 18, 2009 at 7:23 PM, waltbrad <waltb...@hotmail.com> wrote:
>
> First time I think I've ever tried this. I'm using postgres and the
> database is configured correctly and I have psql.exe on my path.
>
> So at the dos prompt I can:
>
> C:\>psql -d postgres -U admin
>
> type in the password and I'm fine. If I open the prompt within my
> project directory I can do the same with Django as user.
>
> But, when I open the dbshell in my project directory, it goes this
> way:
>
> C:\myproj>python manage.py dbshell
>
> C:\myproj>Password for user Django
>
> I type in the password and get:
>
> '*' is not recognized as an internal or external command,
> operable program or batch file.
>
> C:\myproj>
>
> Then if just hit enter, I get:
>
> psql: fe_sendauth: no password supplied
>
> hit enter again and I'm back at the prompt again.

I suspect this is the same issue described in ticket [2]10357.

Please try applying the latest patch attached to that ticket and share
your experiences because that would confirm this is happening with
Postgres' psql in addition to the equivalent SQLite and MySQL command
line tools and this would increase the chances of it or a similar fix
getting applied to solve this problem with dbshell on Windows.

HTH,

-- 
Ramiro Morales
http://rmorales.net

1. http://code.djangoproject.com/ticket/10357

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



Re: Test Client doesn't populate request.META["HTTP_HOST"] ...

2009-03-19 Thread Ramiro Morales

On Thu, Mar 19, 2009 at 11:40 AM, Johan <djjord...@gmail.com> wrote:
>
>  Given:
>
>>>> from django.test.client import Client
>>>> c = Client()
>>>> c.post('/register/',{username=username,password=password})
>
> Traceback (most recent call last):
> ...
> KeyError: 'HTTP_HOST'
>
> Part of the register view  code contains the following:
>
>  ... request.META["HTTP_HOST"] ...
>
> The problem seems to be  that the test client does not inject the META
> (Or at least some of the META) data.
>
> Am I using the wrong construct? If so how do I get around this
> problem?
>

See this thread from a few days ago:

http://groups.google.com/group/django-users/browse_frm/thread/ab3c16762a4aceab

The last example Russell gave there:

> or by providing an 'extra' argument to an individual request:
>
> >>> client.get('/foo/bar/',extra={'HTTP_HOST':'example.com'}

 actually results in a 'extra' key whose value is a nested dictionary
in the request.META dictionary. Use

>>> client.get('/foo/bar/', HTTP_HOST='example.com'}

instead.

HTH,

-- 
Ramiro Morales
http://rmorales.net

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



Re: ImportError with Django rev. 10087

2009-03-18 Thread Ramiro Morales

On Wed, Mar 18, 2009 at 12:06 PM, bobbyc <bobbyc...@gmail.com> wrote:
>
> r10071 was the last successful one.
>

Ok. Several questions, hopefully you have the time
needed to answer them:

What value does your DEBUG setting have?

Can you checkout different revisions of Django
and test to confirm if 10074 is the revision where your
problems started?

Can you reduce your problematic models to a minimal test case?
and paste it to dpaste.com?

Do the problematic models have circular references among them?.

Regards,

-- 
Ramiro Morales
http://rmorales.net

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



Re: ImportError with Django rev. 10087

2009-03-18 Thread Ramiro Morales

On Wed, Mar 18, 2009 at 11:24 AM, bobbyc <bobbyc...@gmail.com> wrote:
>
> Is anyone else having trouble with importing models into other models
> with the latest Django rev. (as I write this, 10087).
>
> ../python2.5/site-packages/django/db/models/loading.py", line 57, in
> _populate
>    self.load_app(app_name, True)
> ../python2.5/site-packages/django/db/models/loading.py", line 72, in
> load_app
>    mod = __import__(app_name, {}, {}, ['models'])
> ../gchub_db/apps/joblog/models.py", line 11, in 
>    from gchub_db.apps.workflow.models import Job, Item
> ImportError: cannot import name Job
>
> This has worked fine for months. I've looked at the changes in that
> revision, but don't see what could be doing this.

I've just tested this with trunk at r10087 and I'm not seeing
this problem.

What would be more useful is to also know which revision
you had been (successfully) using before so we can
search for a commit in the range, not necessarily 10087.

-- 
Ramiro Morales
http://rmorales.net

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



Re: Poll Tutorial regarding __unicode__

2009-03-17 Thread Ramiro Morales

On Tue, Mar 17, 2009 at 9:20 AM, TP <tommi.pres...@gmail.com> wrote:
>
> Right I have now changed to use __unicode__
>
> This looks like:
>
>
> from django.db import models
>
> class Poll(models.Model):
>    question = models.CharField(max_length=200)
>    pub_date = models.DateTimeField('date published')
>    def __unicode__(self):
>        return self.question
>    def was_published_today(self):
>        return self.pub_date.date() == datetime.date.today()
>
>
> class Choice(models.Model):
>    poll = models.ForeignKey(Poll)
>    choice = models.CharField(max_length=200)
>    votes = models.IntegerField()
>    def __unicode__(self):
>        return self.choice
>
> This still does not work, any advice?

What exactly do you mean when you say "does not work"?.

Remember that if you are testing this with the interactive shell
(manage.py shell) you need to restart it to see the efefct of the
changes you perform in model.py.

HTH

-- 
Ramiro Morales
http://rmorales.net

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



Re: fastcgi can not send url to my backend server

2009-03-15 Thread Ramiro Morales

On Sun, Mar 15, 2009 at 8:50 AM, Robert Chen
<wintim.opensou...@gmail.com> wrote:
> Hi, all:
> I used Lighttpd + fastcgi to deploy my Django project. My lighttpd
> configuration is as following:
>
>
>   fastcgi.server = (
>   "/ziyoudu.fcgi" => (
>
>   "main" => (
>   "host" => "127.0.0.1",
>
>   "port" => 8080,
>
> [..]
>
> The configuration is the same as that in www.djangoproject.com. But lighttpd
> return 404 when I access http://www.ziyoudu.com/login/
> I enabled the debug information then and found it seems that the url is
> translated to a static file path. The debug infomation is:

That's because you aren't really following the documentation
example, you are missing the "check-local" => "disable"
directive.

-- 
Ramiro Morales
http://rmorales.net

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



Re: Forms: label translation fails

2009-03-10 Thread Ramiro Morales

On Tue, Mar 10, 2009 at 10:59 AM, Jana Álvarez Muñiz
<jana.alva...@fundacionctic.org> wrote:
>
> Hello!
>
> I want to use translation in Django forms (and ModelForms), but the only 
> solution I've found is using the 'label' attribute in the form fields
> ('from django.utils.translation import ugettext as _' is omitted):

You need to use ugettext_lazy() instead of ugettext().

>
> forms.py:
> class MyForm(ModelForm):
>    name = forms.CharField(label=_('Name'))
>    description = forms.CharField(label=_("Description"))
>    class Meta:
>        model  = models.MyModel
>        fields = ('name', 'description')
>
> models.py:
> class MyModel (models.Model):
>    name = models.CharField(max_length=50,verbose_name=_("Name"))
>    description = models.CharField(max_length=200,              
> verbose_name=_("Description"))
>
-- 
Ramiro Morales
http://rmorales.net

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



Re: Different Database object behavior on Production and Development servers.

2009-03-09 Thread Ramiro Morales

On Mon, Mar 9, 2009 at 12:03 PM, NoviceSortOf <dljonsson2...@gmail.com> wrote:
>
>
> On the command line I'm unable to get a coherent return on my data
> object filters or fetches,
>
> Instead of getting any detail I get a dictionary with nothing but the
> words UserProfile,
> UserProfile object where Field name and value should be.
>
> ie.
>
>>>>g = UserProfile.objects.filter(email = "dljonsson2...@gmail.com")
>  [,  object>]
>
> instead of something like
>
>>>>g = UserProfile.objects.filter(email = "dljonsson2...@gmail.com")
> [username : DLJ99, email : "dljonsson2...@gmail.com]
>
> other tables as well in the database have the same behavior, others do
> not.

This might be related to these models haveing or not a __unicode__ method.
See

http://docs.djangoproject.com/en/dev/intro/tutorial01/#playing-with-the-api

and

http://docs.djangoproject.com/en/dev/ref/models/instances/#django.db.models.Model.__unicode__

>
> my production server does not seem to have a problem with this, but
> development server does. i've double checked model and postgres sql
> server stuctures.
>
> Any clues why my development server fetches and filters will not
> return coherent
> data?
>

It's not cleat to me what does the development server have to do with this.
Could you explaining it a bit further.

-- 
Ramiro Morales
http://rmorales.net

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



Re: translating app name ... again

2009-03-08 Thread Ramiro Morales

On Fri, Mar 6, 2009 at 11:21 PM, Malcolm Tredinnick
<malc...@pointy-stick.com> wrote:
>
> On Fri, 2009-03-06 at 07:01 -0800, patrickk wrote:
>> so, now here´s a little tutorial for translating app-names throughout
>> the admin-interface:
>
> Nice summary. :-)
>
>> 3. change app-names in index.html /// on line 18 replace {% blocktrans
>> with app.name as name %}{{ name }}{% endblocktrans %} with {% trans
>> app.name %}
>
> Not sure what's going on there, but it's a bug. Blocktrans shouldn't be
> behaving strangely (using "trans" isn't wrong and we could just switch
> to that, but I'd like to understand what's going with "blocktrans",
> too).
>
> That's why I thought this should have just worked with marking the names
> for translation in a file somewhere. Hmm ... mysterious. :-(
>
>>
>> 4. change breadcrumbs in change_list.html /// on line 25 replace
>> {{ app_label|capfirst }} with {% trans app_label %}
>>
>> 5. change breadcrumbs in change_form.html /// on line 28 replace
>> { app_label|capfirst }} with {% trans app_label %}
>>
>> 6. change app-names in app_index.html /// on line 11 replace {%
>> blocktrans with app.name as name %}{{ name }}{% endblocktrans %} with
>> {% trans app.name %}
>>
>> 7. change title in base_site.html /// on line 69 replace {{ title }}
>> with {% trans title %}

I've opened [1]ticket 10436 for this , please test the patch attached
and/or post
feedback about it or the ticket description notes.

>
> All of those are bugs (the same bug: not marking app name for
> translation). If you'd like to open a ticket and drop in a patch, it's
> an more-or-less obviously correct set of changes to make.
>
> Put it in the "internationalisation" component.
>

I've selected django.contrib.admin instead, change it to internationalization
if you consider it more correct.

-- 
Ramiro Morales
http://rmorales.net

1. http://code.djangoproject.com/ticket/10436

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



Re: Cookie problem on multiple sites

2009-03-04 Thread Ramiro Morales

On Wed, Mar 4, 2009 at 9:14 AM, Dids <didierblanch...@gmail.com> wrote:
>
> Fixed the problem :)
>
> Turns out, underscores '_' are not valid characters for domain
> names ...
>
> Told you I was new to this...
>
> Thanks all for your input, much appreciated :)
>

Oops, when I saw your email, I searched in my GMail inbox for "cookie
admin ie" and one of the ten or so threads it found was this one from
django-users:

http://groups.google.com/group/django-users/browse_frm/thread/17d26d2b19b092d4

where the same conclusion was arrived at.

So that would be another tip: search in the relevant mailing lists
archives with sensible terms. With pieces of code like IE probabilities
are high somebody has already suffered the same problems.

-- 
 Ramiro Morales

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



Re: Cookie problem on multiple sites

2009-03-03 Thread Ramiro Morales

On Tue, Mar 3, 2009 at 1:44 PM, Dids <didierblanch...@gmail.com> wrote:
>
>
>> Then it's not working fine.
>
> What could explain the missing cookies then? I get them for FF.
> Is there something "special" in IE that could explain the problem?

Equip yourself with a network sniffer , or a debugging proxy, or
a Firebug equivalent for IE and see if the cookie is arriving
to the browser at all and if it does, why IE is ignoring it.

-- 
 Ramiro Morales

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



Re: problem about "You appear not to have the 'sqlite3' program installed or on your path."

2009-02-26 Thread Ramiro Morales

On Thu, Feb 26, 2009 at 9:51 AM, jason zones <zou...@gmail.com> wrote:
> hello, all.
> i have a problem when i type "python manage.py dbshell" in the commandline
> within the mysite folder. i used sqlite3 as the db.
> when i typed the command, it showed the error "You appear not to have the
> 'sqlite3' program installed or on your path."
> my installed python version is 2.6 and it is said the sqlite3 being a
> module in the python, so i tried "import sqlite3", and it worked. so it
> seemed sqlite3 module was there in the python, but it just cannot go into
> the dbshell with "python manage.py dbshell" as the djangobook told. i also
> tried to append the dir"c:\python26\Lib\sqlite3" to the sys path, but it
> seemed not work.  my operating system is windows xp, anyone knows what's
> wrong?

There are two thing named sqlite3 at play here:

First, the sqlite3 module that is part of the standard library  for Python 2.5
and newer. The fact that's it's included means, in your platform, some files
and directories named sqlite3.* and _sqlite3 under your C:\python2x
installation directory, but you aren't supposed to mess with them because they
are an implementation detail and you'd be breaking your Python installation if
you did (just for completeness: they are the SQLite library in a dynamic
library form and the Python DB-API 2module that allows Python programs like
Django to access SQLite databases).

Second there is the sqlite3.exe utility that can be download from SQLIte web
site. It's a program that also knows how to access SQLite databases because it
includes the SQLite library compiled statically for its own use (so the program
can be used in an standalone fashion).

The dbshell Django management command uses this utility. So you need
to download sqlite3.exe if you want to use it.

Regards,

--
 Ramiro Morales

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



Re: OT: hide directory listing on server

2009-02-18 Thread Ramiro Morales

On Wed, Feb 18, 2009 at 4:08 PM, PeteDK <petermoel...@gmail.com> wrote:
>
> Hi. I know this is not really Django related, but this is one of the
> best forums out there so i hope you can help me :-)
>
> The thing is, i have a django website.
>
> The media files are handled by the apache server instead of django,
> which works great.
>
> However when i go to .com/media/profile_pics/ i get a directory
> listing of all the folders in this directory.
>
> Can i disable this?? so its not possible to "browse" all the profile
> pics, without knowing the exact path of a given file.

You can disable Apache mod_autoindex

http://httpd.apache.org/docs/2.2/mod/mod_autoindex.html

for that directory.

But the easiest way to avoid the generation of the directory content
listing is simply creating an empty index.html file there.

-- 
 Ramiro Morales

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



Re: Python Versions and manage.py

2009-02-18 Thread Ramiro Morales

On Wed, Feb 18, 2009 at 3:50 PM, djandrow <andrewkenyon...@gmail.com> wrote:
>
> I've had some success by specifying the path manually
>
> python "C:\ProgLangs\Python25\Lib\site-packages\django\conf
> \project_template\manage.py" sqlall

If you are using manage.py then the most common scenario
is the one when you already are at the directory containing it
so you don't need to specify its full path.

What you need to specify is the full path to the python
binary you want to use:

C:\python25\python manage.py help

or

C:\python26\python manage.py help

(obviously, you need to have Django installed
under both Python versions)

Yo can create your own  .BAT files containing just
that if you want to save some keystrokes.

Regards,

-- 
 Ramiro Morales

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



Re: Verbose field name DjangoUnicodeDecodeError

2009-02-11 Thread Ramiro Morales

On Wed, Feb 11, 2009 at 3:29 PM, Joshua Russo <joshua.rupp...@gmail.com> wrote:
>
> Ok, I'm still having issues.
>
> I'm using Django 1.0.2-final and Python 2.5.4
>
> The models.py starts with the proper encoding string of: # -*- coding:
> utf-8 -*-

Adding that encoding string isn't enough, the other thing you need to be
sure is that the file is really using that encoding (UTF-8 in your
case). It could be you editor created it with a iso-8859-1 encoding and
just adding the # -*- coding: utf-8 -*- header wouldn't solve things.

Using

$ file models.py

can tell you the real encoding, and it isn't the one you expect, you can
re-code it using the iconv utility or re-create the models.py file from
scratch making sure you tell from the beginning your text editor you want
the file to use UTF-8 encoding.

HTH

(sorry for not making this clear in the previous reply)

-- 
 Ramiro Morales

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



Re: Another thread about static content

2009-02-11 Thread Ramiro Morales

On Tue, Feb 10, 2009 at 8:11 PM, djandrow <andrewkenyon...@gmail.com> wrote:
>
> I've move it just to the apache2.2 file so my conf is now:
>
> Options Indexes FollowSymLinks
>
> 
>SetHandler python-program
>PythonHandler django.core.handlers.modpython
>SetEnv DJANGO_SETTINGS_MODULE akonline.settings
>PythonOption django.root /akonline
>PythonDebug On
>PythonPath "['C:/Program Files/Apache2.2'] + sys.path"
> 
>
>  media/">
>Order Allow,Deny
>Allow from all
>SetHandler None
> 
>
> Alias /media/ "C:/Program Files/Apache2.2/akonline/templates/blogSite/
> media/"
>
> 
>SetHandler None
> 
>
> But i'm still having the same problems
>

One think I'm realizing now is that you haven't realy  told us what the problem
is in the first place, and I haven't asked for it :)

I've just tested a similar setup and it is working for me. I tested it
by accessing the http://myhost/media/feedicon.png URL
and the image is shown in my browser.

Something very helpful in these cases is to look what the Web server
reports in its logs (some common filenames for Apache are
access.log and error.log). For example, this is what is shown
for the  above request and for another failed one (a non-existent
foo.gif file, in this last case it gives a clear hing about what paths it's
trying to examine in oder to to server the resource):

access.log:

192.168.190.2 - - [11/Feb/2009:15:07:07 -0200] "GET
/media/feedicon.png HTTP/1.1" 200 9076 "-" "Mozilla/5.0 (X11; U; Linux
i686; en-US; rv:1.9.0.6) Gecko/2009020409 Iceweasel/3.0.6
(Debian-3.0.6-1)"

192.168.190.2 - - [11/Feb/2009:15:13:00 -0200] "GET /media/foo.gif
HTTP/1.1" 404 211 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.9.0.6) Gecko/2009020409 Iceweasel/3.0.6 (Debian-3.0.6-1)"

error.log:

[Wed Feb 11 15:13:00 2009] [error] [client 192.168.190.2] File does
not exist: /var/djapps/dtests/templates/blogSite/media/foo.gif


-- 
 Ramiro Morales

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



Re: Verbose field name DjangoUnicodeDecodeError

2009-02-11 Thread Ramiro Morales

On Wed, Feb 11, 2009 at 11:22 AM, Joshua Russo <joshua.rupp...@gmail.com> wrote:
>
> I'm developing an app and want to use Portuguese characters in the
> verbose field names for my models. The tables were created fine but
> when I tried to implement the admin pages I received a
> DjangoUnicodeDecodeError when it hit the first non-ASCII character. Is
> this just a bug with the admin page processing?

No,  Django and its admin app supports internationalization.

Don't forget to specify the encoding of your Python source code files
(models.py in this case) as described at
http://www.python.org/dev/peps/pep-0263/

Also, make your to wrap your Portuguese literals with a call to the
django.utils.translation.ugettext_lazy() function as described in the
Django I18n documentation:

http://docs.djangoproject.com/en/dev/topics/i18n/#lazy-translation

Regards,

-- 
 Ramiro Morales

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



Re: Another thread about static content

2009-02-10 Thread Ramiro Morales

On Tue, Feb 10, 2009 at 7:40 PM, djandrow <andrewkenyon...@gmail.com> wrote:
>
> Hello all,
>
> I know theres alot of threads like this out there but I'm still
> struggling. I've got a simple html template which i access through a
> view:
>
> 
> 
> 
>
> the template is in C:/Program Files/Apache2.2/htdocs/akonline/
> templates/blogSite
> and the image is then in blogSite/media
>
> then in my conf I have:
>
> 
>SetHandler python-program
>PythonHandler django.core.handlers.modpython
>SetEnv DJANGO_SETTINGS_MODULE akonline.settings
>PythonOption django.root /akonline
>PythonDebug On
>PythonPath "['C:/Program Files/Apache2.2/htdocs'] + sys.path"
> 
>
>  blogSite/media/">
>Order Allow,Deny
>Allow from all
>SetHandler None
> 
>
> Alias /media/ "C:/Program Files/Apache2.2/htdocs/akonline/templates/
> blogSite/media/"
>
> 
>SetHandler None
> 
>
> I'm using mod_python and Windows XP, I have the same setup (with
> different locations and directories) on my linux host and it works
> fine. So whats going on. I would be grateful for any help.

Problem with this is how doas Apache what rule should it apply when
it come to server something under /akonline or /media
The one set by the

DocumentRoot C:/Program Files/Apache2.2/htdocs

directive ? or the one set by the Alias or Location
blocks/directives above?.

It is really better for you and for anybody trying to help
you if you follow some basic common sense practices
because it isn't  very practical having to set up
a test Django app under one's Apache document root
just to reproduce your setup.

-- 
 Ramiro Morales

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



Re: date error

2009-02-10 Thread Ramiro Morales

On Tue, Feb 10, 2009 at 6:51 PM, Hervé Edorh <senobo...@gmail.com> wrote:
>
> nobody for helping me?

It seems you have several problems:

First,  the code you are pasting has the indentation totally broken.

Second,

>i forgot, the first ulrs.py (in the project directory) is like this
>
> (r'^weblog/$',include('dibongo.urls')),
> (r'^weblog/(?P\d{4})/(?P\w{3})/(?P\d{2})/(?P\w+)/$',include('dibongo.urls')),
>
> this is the second that i put before. It for the chapiter decoupling
> the URLs

You aren't really decoupling things, because with the first entry in the URL map
you are correctly delegating all things under  weblog/ to the dibongo/urls.py
URL map  file but then in the second entry you show that you still want
to handle URsL for the dibongo app in the main urls.py. Ideally that
entry should
be moved to dibongo/urls.py ith the appropiate modification in the regexp
possibly merging it with the entry that invokes the
django.views.generic.date_based.archive_index generic view.

Third,

> urlpatterns = patterns('django.views.generic.date_based',
> (r'^$','archive_index',entry_info_dict,'dibongo_entry_archive_index'),
> (r'^$','object_detail', entry_info_dict,'dibongo_entry_detail'),

The regexp for the two entries in this URLmap are the same (r'^$')
and, as the URL resolution is performed from top to bottom,
the one using the django.views.generic.date_based.archive_index
generic views is matching.

Fix these problems first and then post again if you are still
experimenting problems.

HTH,


-- 
 Ramiro Morales

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



Re: Pretty admin pages

2009-02-10 Thread Ramiro Morales

On Tue, Feb 10, 2009 at 12:38 PM, djandrow <andrewkenyon...@gmail.com> wrote:
>
> I believe its quite akward to create a system link in XP so I tried
> copying them to myproject/media file, but it didn't like that either.
>
> Should they go in the htdocs file or what?
>

This is more an Apache question, things should be set up in a way such
that when you access, for example django/contrib/admin/media/img/arrow-down-png
(or a copy of it) can be accessed through

http://yourhost/media/img/arrow-down-png

and yes, as the "2. Or, copy the admin media files so that they live
within your Apache document root." blurb suggests, copying the
django/contrib/admin/media tree to your document root would be one way
of achieving this.

Another option would be to use the Alias and Directory apache
configuration directives
(http://httpd.apache.org/docs/2.2/mod/mod_alias.html#alias)

-- 
 Ramiro Morales

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



Re: Pretty admin pages

2009-02-10 Thread Ramiro Morales

On Mon, Feb 9, 2009 at 10:07 PM, djandrow <andrewkenyon...@gmail.com> wrote:
>
> Hello all,
>
> I have just set up the admin pages for my site and if i use the built
> in server i get the admin with the nice templates, but if I display it
> on mod_python I just get the plain text, which is pretty hard to work
> with.
>
> I have these set up in the conf:
>
> 
>SetHandler None
> 
>
> 
>SetHandler None
> 
>
> and my setting py has:
>
> MEDIA_ROOT = ''
> MEDIA_URL = ''
> ADMIN_MEDIA_PREFIX = '/media/'
>
> what am i doing wrong or what have i missed?
>

This is described in the documentation:

http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#id3

You should be sure the django/contrib/admin/media/
directory from the Django source code tree is published by Apache
at the URL set by the ADMN_MEDIA_PREFIX setting (/media
in your case).

-- 
 Ramiro Morales

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



Re: syncdb Issue: OneToOneField with User model from contrib.admin

2009-02-07 Thread Ramiro Morales

On Sat, Feb 7, 2009 at 7:26 AM, elith...@gmail.com <elith...@gmail.com> wrote:
>
> Hi all - I'm having an issue when trying to generate my models after a
> syncdb command. I know where it's failing, and almost why - but I'm
> also trying to figure out the correct solution to what I'm trying to
> achieve.
>
> In my model (http://github.com/elithrar/eatsleeprepeat.net/blob/
> 5f63cac3dda09421882905abbb5b268569f6de1d/projects/articulate/
> models.py) I have the following line:
>
>author = models.OneToOneField(User, _('author'))

Try using:

author = models.OneToOneField(User, verbose_name=_('author'))

the verbose_name option for the relationship type fields
is currenty documented in the model topics document but not in the
field options refererence.

HTH,

-- 
 Ramiro Morales

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



Re: looking for patch to user.messages that adds a category

2009-02-06 Thread Ramiro Morales

On Fri, Feb 6, 2009 at 7:52 PM, Margie <margierogin...@yahoo.com> wrote:
>
> Thanks very much, Karen.  That makes perfect sense.  Well, it was at
> least a good excercise in learning how easy it is to download the
> source from the svn repository!

Also, take a look at ticket [1]4604 that deals with implementing (and moving?)
these messages so they are associated with sessions instead of users (it was on
the list of possible features for version 1.1 but has been [2]deferred,
possibly to 1.2)

One of the things that came out of the discussion related to that ticket is a
[3]snippet that extracts this functionality and avoids the need to patch
Django, it includes a new type property for the messages. The author also
posted a link to a [4]blog entry describing it.

Regards,

--
 Ramiro Morales

1. http://code.djangoproject.com/ticket/4604
2. http://code.djangoproject.com/wiki/Version1.1Features#Must-havefeatures
3. http://www.djangosnippets.org/snippets/1002/
4. 
http://traviscline.com/blog/2008/08/23/django-middleware-session-backed-messaging/

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



Re: Wierd FileField behavior

2009-02-03 Thread Ramiro Morales

On Tue, Feb 3, 2009 at 9:40 AM, Erwin Elling <erwinell...@gmail.com> wrote:
>
>> I went back to 9781 (which was still on my system for a previous
>> project) and the problem seems not to exist here. Haven't had the time
>> to dig into this any further, but maybe this helps someone else.
>
> Sorry, made a mistake; On 9781 the problem is still there.
> On 9084 (also quite randomly chosen) it seems to be allright.

Revision 9766 introduced some changes related to file fields, can
you try to refine your tests and see if it is the one that broke
things in your case and report back please?

-- 
 Ramiro Morales

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



Re: models created from database table

2009-02-03 Thread Ramiro Morales

On Tue, Feb 3, 2009 at 9:29 AM, Waruna de Silva <waruna@gmail.com> wrote:
> Hi,
>
> In Django is it possible to created models automatically from
> existing database.

Yes, see

http://docs.djangoproject.com/en/dev/howto/legacy-databases/#howto-legacy-databases

-- 
 Ramiro Morales

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



Re: docs: Problem with 'make html'

2009-02-01 Thread Ramiro Morales

On Sat, Jan 31, 2009 at 8:48 AM, Benjamin Buch <benni.b...@gmx.de> wrote:
>
> Hi,
>
> if I do 'make html' in my django-trunk/docs directory, I get this error:
>
> [...]
>
> Traceback (most recent call last):
>   File "/opt/local/lib/python2.5/site-packages/sphinx/__init__.py",
> line 114, in main
> confoverrides, status, sys.stderr, freshenv)
>   File "/opt/local/lib/python2.5/site-packages/sphinx/
> application.py", line 81, in __init__
> self.setup_extension(extension)
>   File "/opt/local/lib/python2.5/site-packages/sphinx/
> application.py", line 120, in setup_extension
> mod.setup(self)
>   File "/Users/benjamin/Code/django/django-trunk/docs/_ext/
> djangodocs.py", line 15, in setup
> app.add_crossref_type(
> AttributeError: 'Sphinx' object has no attribute 'add_crossref_type'
>
> I'm using a recent version of django.

Which version of Sphinx are you using?.

-- 
 Ramiro Morales

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



Re: in what namespace do widgets reside?

2009-01-27 Thread Ramiro Morales

On Tue, Jan 27, 2009 at 3:42 PM, JonUK <jdo...@flinttechnology.co.uk> wrote:
>
> Apologies for the daft question, but after 10 mins of trawling through
> the official docs and various random google articles, I cannot find
> thyis info.

I found it by clicking ion "the Module Index" link in the main
documentation page,
which took me to this page:

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

and then searching for 'widget'.

HTH,

-- 
 Ramiro Morales

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



Re: Queryset unexpectedly turning into list

2009-01-24 Thread Ramiro Morales

On Sat, Jan 24, 2009 at 8:26 PM, mb0...@googlemail.com
<mb0...@googlemail.com> wrote:
>
> Hi,
>
> please have a look at: http://dpaste.com/112603/
>
> Can someone tell me why the sliced queryset suddenly turns into a
> list?
> I'm still new to Python/Django so I can't tell if it is a bug... but
> it sure cost me some time because in my eyes it was something complete
> out of the blue.
>
> Django version 1.0.2
> Python 2.5.2
>

What DB backend are you using?.

-- 
 Ramiro Morales

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



Re: Related Field has invalid lookup error

2009-01-24 Thread Ramiro Morales

On Sat, Jan 24, 2009 at 2:30 AM, dwil...@gmail.com <dwil...@gmail.com> wrote:
>
> I've got an odd-looking error when I try to use a related model's
> field in the ORM. Here's the traceback:
>
> [...]
>  File "/home/dwillis/lib/python2.5/django/db/models/fields/
> related.py", line 157, in get_db_prep_lookup
>raise TypeError, "Related Field has invalid lookup: %s" %
> lookup_type
> TypeError: Related Field has invalid lookup: year
>
> It's caused by the following query:
>
> active_hc = CollegeCoach.objects.select_related().filter
> (jobs__name='Head Coach', end_date__isnull=True,
> collegeyear__year=CURRENT_SEASON).order_by('-start_date')

Try changing that lookup to

collegeyear__year__exact=CURRENT_SEASON

Django has a 'year' lookup for Date (and DateTime?) fields
that in you case is clashing eith the name of one of your field
and is trying to use it, that explains the error you get
(it can't apply it to an integer field).

Hopefully, adding exact will help in disambiguating your
intentions.

>
> And here are the models in question:
>
> class CollegeYear(models.Model):
>college = models.ForeignKey(College)
>year = models.IntegerField()
>wins = models.IntegerField(default=0)


-- 
 Ramiro Morales

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



Re: Raw SQL parameters

2009-01-19 Thread Ramiro Morales

On Mon, Jan 19, 2009 at 3:56 PM, Karen Tracey <kmtra...@gmail.com> wrote:

>
> That's using MySQL as the DB, so perhaps it is backend-specific?

So it seems. the MySQL and PostgreSQL backend seem to (still?)
support it. But the Oracle crew removed it a while back:

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

Regards,

-- 
 Ramiro Morales

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



Re: Raw SQL parameters

2009-01-19 Thread Ramiro Morales

On Mon, Jan 19, 2009 at 3:15 PM, Matias Surdi <matiassu...@gmail.com> wrote:
>
> The curious thing here, is that the above query works perfect running it
> directly through sqlite3.
>

>From what I have seen by reading DB backend source code, Django cursor's
execute() method supports only the printf-like parmeter maker style with a list
or tuple of actual parameters.

If you want to use the pyformat parameter marking style (as described
in PEP 249),
you' ll need to use the native DB-API driver API as you've already discovered.

Regards,

-- 
 Ramiro Morales

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



Re: Possible to see sql for queryset before database gets it?

2009-01-18 Thread Ramiro Morales

On Sun, Jan 18, 2009 at 5:27 PM, phoebebright <phoebebri...@spamcop.net> wrote:
>
> I have a problem with the sql being generated by this:
>
>tasks = Task.objects.filter(status='open').order_by('-priority')
>tasks = tasks.extra(where=['list IN %s'], params=
> [settings.MY_LISTS])
>
> Is there a command where I can say something like 'print tasks.sql'
> that would generate the sql but not send it to the database, so I can
> see exactly why the sql is failing?

First, you can try what's suggested at this Django FAQ entry:

http://docs.djangoproject.com/en/dev/faq/models/#how-can-i-see-the-raw-sql-queries-django-is-running

For another option, try printing the output of:

.query.as_sql()

or if you are using a recent trunk version (more recent than two weeks or so)
you might want to try printing the output of:

.as_sql()

They should print the complete SQL query generated by the
QuerySet.

Both the query  attribute  and as_sql() method are internal implementation
details of QuerySet. That's why they are not documented, but you can count
on them being present for the foreseeable future.

HTH

-- 
 Ramiro Morales

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



Re: ManyToManyField.through for what?

2009-01-18 Thread Ramiro Morales

On Sun, Jan 18, 2009 at 2:46 PM, Erik Bernoth <shol...@gmx.net> wrote:
>
> Thanks very much. I see I have still other options where I can look
> first: trac and unit tests. Will read all of that. :)

Ideas and patches to enhance the documentation making this
more straight forward to understand for the next person stumbling
the same doubts are welcome 8)

-- 
 Ramiro Morales

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



Re: ManyToManyField.through for what?

2009-01-18 Thread Ramiro Morales

On Sun, Jan 18, 2009 at 1:20 PM, Erik Bernoth <shol...@gmx.net> wrote:
>
> Hi guys,
> I'm trying to create a db model in Django. And until now I created n:m-
> Relations with own tables, because in many cases I need extra
> information like the creation date of that connection-entity. And now
> I found in the docs that it is possible to connect these individual
> n:m tables of myself with the foreign-key tables. But all together it
> does not look like I can do more with  that .through attribute as I
> could without.
>

Take a look at ticket #6095 to know the motivation and rationale behind
the addition of the through option and some of the advantages when
compared with using you own model with FKs to the two related models.

Also and the documentation you pointed to modeltests/m2m_through tests
show the usage of the new API that allows you to do the same things you
were able to do but in a clearer way.

Regards,

-- 
 Ramiro Morales

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



Re: syncdb error

2009-01-18 Thread Ramiro Morales

On Sun, Jan 18, 2009 at 6:13 AM, joti chand <joti.ch...@gmail.com> wrote:
>
> Can you elaborate more please because iam new to this...iam using
> python, django and mysql 5.0.django and python works but python
> and mysql5.0 not working

As you've been told, you need to install the Python library that
allows the language
to access MySQL databases, it's called MySQLdb.

This something that is well documented:

http://docs.djangoproject.com/en/dev/intro/install/#intro-install
http://docs.djangoproject.com/en/dev/topics/install/#database-installation

and in you case (win32 platform) means you need to download
and execute an .exe installer for your version of Python.

HTH

-- 
 Ramiro Morales

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



Re: django searching wrong package for 'static.serve'

2009-01-17 Thread Ramiro Morales

On Sat, Jan 17, 2009 at 6:19 PM, Tim Valenta <tonightslasts...@gmail.com> wrote:
>
> Hello all.  Just trying to make django serve my static media files
> (css is my main test case right now) during development.  I've
> included the lines in my URLconf as instructed by this page:
> http://docs.djangoproject.com/en/dev/howto/static-files/
>
> My issue is that this line is causing a 500 error when my site's main
> template HTML requests a URL that falls into the regex for a static
> file serve.  The error says:
>
> ViewDoesNotExist: Could not import mysite.django.views.static. Error
> was: No module named django.views.static
>
> The issue here is that it's trying to root the search for the
> 'static.serve' package in "mysite".

This seems to indicate you are using 'mysite as the common prefix
for your application views, something like

urlpatterns = patterns('mysite',


then the URL dispatcher concatenates the prefix and the
name of the views you specified, including the static file
serving one.

Something you can do to accommodate both requeriments
is to group the patterns with different prefixes.
See http://docs.djangoproject.com/en/dev/topics/http/urls/#the-view-prefix
and 
http://docs.djangoproject.com/en/dev/topics/http/urls/#multiple-view-prefixes
for details.

Regards,

-- 
 Ramiro Morales

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



Re: Path problem with jsi18n - internationalization

2009-01-11 Thread Ramiro Morales

On Sun, Jan 11, 2009 at 6:43 PM, Tipan <t...@ortengo.co.uk> wrote:
>
> Hi Ramiro,
>
> I'm using the latest development version of Django. Apache web server.
> MySqL/Mod_python, all served from same apache on my laptop.
>
> I get a 404 error when I put http:///jsi18n/ into the browser
> URL.
>

That's strange, are you succesfully using another component of Django
i18n infrastructure in the same application?. De you have USE_I18N set to
True in the settings file you are using?

-- 
 Ramiro Morales

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



Re: Path problem with jsi18n - internationalization

2009-01-11 Thread Ramiro Morales

On Sun, Jan 11, 2009 at 2:48 PM, Tipan <t...@ortengo.co.uk> wrote:
>
> I'm having a problem accessing Javascript Translation catalog whilst
> converting my site to multi-language. As suggested in the docs, I have
> added the following to my applications top level urls file.
>
>
> js_info_dict = {
>'packages': ( 'myapp.myproject',),
> }
>
> (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
>
> However, when I render my template the url to jsi18n generates a "url
> not found" error in Firebug. The docs say /path/to/jsi18n, but I'm not
> sure how to reconcile this properly with my app.
>
> 
>
> Can anyone give me a pointer - I'm sure I'm missing the obvious, but
> can't see it at the moment.

What version of Django are you using?, which web server? what deployment
method? Does the web server show a 404 error in its logs when the /jsi18n/
URL is accessed from the browser? What happens if you manually open with
your browser the http:///jsi18n/ URL?.

Regards,

-- 
 Ramiro Morales

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



Re: forms/widgets media: position of 'class' directive

2009-01-11 Thread Ramiro Morales

On Sun, Jan 11, 2009 at 10:33 AM, Artem Skvira <artem.skv...@gmail.com> wrote:
>
> Hi all,
>
> I've stumbled upon strange behaviour in django: when declaring form/
> widget with class Media, ie.:
>
> class AddressForm(ModelForm):
>streetNo = forms.CharField()
>...
>
>class Meta:
>...
>
>class Media:
>js = ('prototype.js', )
>
> I get tons of javascript inclusions rendered to page, for each
> character in 'prototype.js', ie.
> 
> 
> 
>
> etc
>
> However, when I move 'class Media:' to the top of the class everything
> works ok.
> Seems to be a bug to me.

I can't reproduce this. I've pasted at http://dpaste.com/107769/
a patch against Django forms regression tests that adds a test
demonstrates this works as expected.

Can you try to massage that new test to see if, adding details from
your own case to it, you can reproduce what you are seeing?.

Of course, the only way I could reproduce what you report is
using:

js = 'prototype.js'

-- 
 Ramiro Morales

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



Re: Does using the IPython shell add "LIMIT" to Django ORM discussion (using SQLite)

2009-01-08 Thread Ramiro Morales

On Thu, Jan 8, 2009 at 7:58 AM, Christopher Mutel <cmu...@gmail.com> wrote:
>
> Hello all-
>
> I recently filed a bug about incorrect SQL generation, and Malcom
> Tredinnick said that the example SQL I provided couldn't be correct,
> because there was an extra LIMIT clause that shouldn't be there. After
> poking around for a bit, I realized that everytime I was executing my
> query in the IPython shell, it was appending a LIMIT 21 to the SQL,
> but this limit clause wasn't being appended if the query was part of a
> regular python process. Both queries are run against SQLite 3.
>
> I uploaded a small test case here that demonstrates this behaviour:
>
> http://www.bitbucket.org/cmutel/extra_limit_21/
>
> It is possible that I have poor python-fu, or is this known behaviour?
> Is it possible that Django is truncating the result list because
> IPython won't show all results anyway?
>
> I have tried searching the Django codebase, and the mailing list, but
> to no avail.

Django [1]generates a LIMIT 21 in the __repr__ method of a queryset,
because it limits such representation to 20 items when it's in the
context of (for example) showing it in a traceback, this was added in
[2]r9202. Maybe you are getting the SQL clause generated by you ROM
query with .query().as_sql() in the interactive Python interpreter and
triggering this?

See if r9717 solves you duplicate column name problem, the problem
in the query isn't caused by that LIMIT part as it isn't sent to the
DB in other 'normal' conditions.

Regards,

-- 
 Ramiro Morales

1. 
http://code.djangoproject.com/browser/django/trunk/django/db/models/query.py#L146
2. http://code.djangoproject.com/changeset/9202

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



Re: I would like to report a bug but I can't log in

2009-01-03 Thread Ramiro Morales

On Fri, Jan 2, 2009 at 8:03 AM, Friendless <friendless.farr...@gmail.com> wrote:
>
> I tried to report a bug anonymously and got told I was spam, so I
> signed up, got the email, activated the account, and still can't log
> in and still can't report the bug. I've been using Django 30 minutes
> and I'm already frustrated!

I've just took 15 seconds and followed the same process creating a test user
and I can login perfectly to the code.djangoproject.com site.

Something slightly weird: after activating the account, I followed
the link to login for the first time, once I entered the user
name and password I got redirected to the djangoproject.com
site and going back to code.djangoproject still didn't show me
as logged in.

So I had to log in again using the 'Login' link located at the upper
right corner of the page (in the light green strip), that
worked right away.

Regards,

-- 
 Ramiro Morales

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



Re: Why doesn't syncdb ever modify or drop tables anymore?

2008-12-25 Thread Ramiro Morales

On Thu, Dec 25, 2008 at 8:21 PM, Fluoborate <motoy...@gmail.com> wrote:
>
> It never modified tables? But in the tutorial, you "accidentally" omit
> the __unicode__ method and then you add it in later, and that works.
> Was the __unicode__ method simply an attribute of the Python and not
> the database, and that's why it works?
>

Exactly, the __unicode__ method is that, a Python method and not
a model field that represent a DB table column.

> Also, shouldn't sqlclear appname drop the tables, allowing me an
> opportunity to reestablish the tables? Sqlclear didn't clear the
> tables, even though it printed appropriate DROP TABLE statements, it
> just didn't issue the statements. Thanks.

That's exactly the intended behavior (and always has been. Please
read the fine documentation for more details:

http://docs.djangoproject.com/en/dev/ref/django-admin/#sqlclear-appname-appname

-- 
 Ramiro Morales

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



Re: Simple ManyToManyField/Model question

2008-12-25 Thread Ramiro Morales

On Thu, Dec 25, 2008 at 5:13 PM, Chris Czub <chris.c...@gmail.com> wrote:
>
>
> I think I need to use a ManyToManyField for this but I'm having
> trouble finagling it to be the way I want. Here's what I have right
> now but I can't figure out where to put the amount and unit for the
> ingredients:
>
> class Ingredient(models.Model):
>name= models.CharField(max_length=255)
>amount  = models.IntegerField()
>unit   = models.CharField(max_length=12)
>
>def __unicode__(self):
>return self.name
>class Admin:
>pass
>
> class Recipe(models.Model):
>name= models.CharField(max_length=255)
>ingredients = models.ManyToManyField('Ingredient')
>
>def __unicode__(self):
>return self.name
>class Admin:
>pass
>
>
> Any ideas would be greatly appreciated :)

Take a look at the relevant documentation:

http://docs.djangoproject.com/en/dev/topics/db/models/#many-to-many-relationships
http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships

also, the m2m_through m2m_intermediary and m2m_through example:

  http://www.djangoproject.com/documentation/models/m2m_intermediary/

(tests/modeltests/m2m_intermediary/models.py in the Django source tree.)
and the m2m_through example (tests/modeltests/m2m_through/models.py in
the Django source tree.)

HTH

-- 
 Ramiro Morales

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



Re: problem with make-messages.py russian language

2008-12-15 Thread Ramiro Morales

On Mon, Dec 15, 2008 at 12:15 PM, Dafidov <dafi...@gmail.com> wrote:
>
> Hi Karen.
> Thank You for quick answer.
> Unfortunately after check and changing commend still not work :(
> Before I was using django 0.9.6 changeset 7496 and all worked fine.
> It's strange because when I'm using old command
> make-messages.py -l pl  I have no errors...
>
> I was checking coding and in all languages files - they are saved with
> utf-8 encoding so it's not a problem too.
> I' working on:
> Distributor ID: Ubuntu
> Description:Ubuntu 8.04.1
> Release:8.04
> Codename:   hardy
>
> and have xgettext (GNU gettext-tools) 0.17
>
> I'm using as translation editor poedit in version 1.3.9.
>
> By saying that make-massages suspend - i have on my mind that in
> console it looks like it is working - but never ends... can wait hours
> and nothing :/

If you are using a correctly installed 1.0.2 then make-messaages should
be showing something like:

$ make-messages
make-messages has been moved into django-admin.py
Please run "django-admin.py makemessages " instead.

If yours don't, maybe leftovers of aprevious installation
are still in /usr/sbin or similar?

>
> Do You have any other ideas why make-massages.py and django-admin.py
> makemessages -l ru doesn't work correct on Russian language ?
>

Something you could do is to manually apply the bisection method
between your revision that worked (r7496) and 1.0.2 (r9503)
to try to find the commit that broke things for you. The functionality
was moved from make-messages to django-admin at revision 7844.

Regards,

-- 
 Ramiro Morales

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



Re: Problem with i18n in tests

2008-11-22 Thread Ramiro Morales

On Sat, Nov 22, 2008 at 9:52 AM, Florencio Cano
<[EMAIL PROTECTED]> wrote:
> Hi!
> I'm testing a Django application where I'm using i18n.
>
> [...]
>
> FAIL: test_agregar_responsable_nombre_duplicado_tildes
> (gesfich.fichlopd.tests.RegistrarUsuariosTestCase)
> --
> Traceback (most recent call last):
>  File "/home/fcano/GesFichLOPD/gesfich/../gesfich/fichlopd/tests.py",
> line 228, in test_agregar_responsable_nombre_duplicado_tildes
>self.assertFormError(respuesta2, 'responsable_form', 'nombre', 'Ya
> existe un responsable con este nombre')
>  File "/usr/lib/python2.5/site-packages/django/test/testcases.py",
> line 317, in assertFormError
>repr(field_errors)))
> AssertionError: The field 'nombre' on form 'responsable_form' in
> context 0 does not contain the error 'Ya existe un responsable con
> este nombre' (actual errors: [u'Responsable with this Nombre already
> exists.'])
>

Does the settings file being used for the tests have USE_i18N=True?

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Caching an image in Django

2008-11-20 Thread Ramiro Morales

On Thu, Nov 20, 2008 at 6:00 PM, bfrederi <[EMAIL PROTECTED]> wrote:
>
> I am trying to cache a small thumbnail image. The code is a bit
> extensive, but the part this is breaking is that I am opening the
> image file, then this:
>
> cache.set('thumbnail_file', image_file.read())
>
> when I go to retrieve the image with:
>
> cache.get('thumbnail_file')
>
> I get this traceback:
>
> Traceback (most recent call last):
>  File "/home/django-code/aubrey_ark/tests.py", line 48, in
> testResourceObject
>ro = ResourceObject(self.meta_id)
>  File "/home/django-code/aubrey_ark/resource_handler.py", line 102,
> in __init__
>cache.get(self.meta_id+'_thumbnail')
>  File "/usr/lib/python2.5/site-packages/django/core/cache/backends/
> memcached.py", line 30, in get
>return smart_unicode(val)
>  File "/usr/lib/python2.5/site-packages/django/utils/encoding.py",
> line 35, in smart_unicode
>return force_unicode(s, encoding, strings_only, errors)
>  File "/usr/lib/python2.5/site-packages/django/utils/encoding.py",
> line 70, in force_unicode
>raise DjangoUnicodeDecodeError(s, *e.args)
> DjangoUnicodeDecodeError: 'utf8' codec can't decode byte 0xff in
> position 0: unexpected code byte. You passed in '\xff\xd8\xff...
> [...]
>
> Any clue on how to fix this. Should I be doing a special encoding/
> compression before placing the image file into the cache?
>

See tickets #9180 and #5589 for related reports and proposed workarounds/fixes
when using the memcache backend.

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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 list_filter with a foreign key field in the Admin

2008-11-20 Thread Ramiro Morales

On Thu, Nov 20, 2008 at 11:23 AM, dash86no <[EMAIL PROTECTED]> wrote:
>
> Having reread that documentation I can see it says "ForeignKey" as
> plain as day.
>
> Sorry I'm an idiot. I'll work on this again tomorrow, time for sleep I
> think
>
>
>
> On Nov 20, 10:19 pm, dash86no <[EMAIL PROTECTED]> wrote:
>> Karen,
>>
>> Most people I know say "hey guys" to refer to mixed groups. I'm 27 and
>> mostly spending time with Americans nowadays so I don't know if that
>> has anything to do with it.
>>
>> Anyway, I did try it, and I found whenever I tried to specify a
>> foreign key it was simply ignored. I.e. no error message the filter
>> table just didn't come up.
>>
>> I got my info about it not working here:
>>
>> http://groups.google.com/group/django-users/browse_thread/thread/cb18...
>>

Note that in the referenced thread I understood [1]you were [2]asking
for being able
to filter on fields of the FK-related model instead of by the FK iself.

Regards,

-- 
 Ramiro Morales

1. If you are effectively the same person as "caio ariede"
2. It could be me but re-reading your original message there I keep
doing the same interpretation.

--~--~-~--~~~---~--~~
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: Caching and I18n

2008-11-20 Thread Ramiro Morales

On Sun, Nov 16, 2008 at 10:14 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> Hello Ramiro,
>
> thanks for your reply. According to the docs, the Locale and Session
> middlewares should set the Vary-On headers accordingly, and indeed
> they are:
>
> Date: Sun, 16 Nov 2008 23:49:29 GMT
> Server: WSGIServer/0.1 Python/2.5.2
> Vary: Accept-Language, Cookie
> Content-Type: text/html; charset=utf-8
> Content-Language: de
>
> 200 OK
>
> I'm lost. Maybe Beegee from the other thread found a solution in the
> meantime.

I asked Antoni Aloy that was the OP in one of these threads.
He pointed me to [1]ticket 5691 he opened back then. You might want to take
a look at it (to know propossed solutions, code devs opinions and
perhaps to post feedback and enhance the patch si it can be applied?).

HTH

-- 
 Ramiro Morales

1. http://code.djangoproject.com/ticket/5691

--~--~-~--~~~---~--~~
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: validate fields in the admin as some local flavor form fields

2008-11-19 Thread Ramiro Morales

On Mon, Nov 17, 2008 at 10:00 PM, TeenSpirit83
<[EMAIL PROTECTED]> wrote:
>
> I'm writing an app with some italian zip and vat number fields and
> also a province select field
> can i force the admin class to validate the fields like
> class it.forms.ITVatNumberField
> class it.forms.ITZipCodeField
> class it.forms.ITProvinceSelect
> ??

There was a thread in the django-es mailing list a while ago about a
similar requirement, the OP needed being able to replace a generic
model-derived field in the admin app forms with a localflavor form field
that uses the same database column type, this would have the same effect
you are looking for: having the specific validation being aplied to it:

http://groups.google.com/group/django-es/browse_thread/thread/ead0c017040a8cd4/56dc130cbe269b9d?hl=en=gst

What we came up with was:

http://dpaste.com/hold/73468/

that uses the formfield_for_dbfield() ModelAdmin method.

The condition in line 16 can (and in fact should) be made more
specific to include the name
of the field.

There could be another way though, take a look at this documentation section:

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin

Regards,

--
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Caching and I18n

2008-11-16 Thread Ramiro Morales

On Sun, Nov 16, 2008 at 10:51 AM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> Hello everyone,
>
> I'm trying to implement caching for my bilingual site. The problem is
> that once I enable caching and I change the language (via the example
> code in 
> http://docs.djangoproject.com/en/dev/topics/i18n/?from=olddocs#the-set-language-redirect-view
> ), the page does not change. The Content-Language header that the
> browser receives is indeed changed accordingly, but apparently the
> caching system is not aware of the change.
> I've set up my middleware as follows:
>
> MIDDLEWARE_CLASSES = (
>'django.middleware.cache.UpdateCacheMiddleware',
>'django.contrib.sessions.middleware.SessionMiddleware', # muss vor
> auth
>'django.contrib.auth.middleware.AuthenticationMiddleware',
>'django.middleware.locale.LocaleMiddleware',
>'django.middleware.common.CommonMiddleware',
>'django.middleware.cache.FetchFromCacheMiddleware',
> )
>
> I also tried per-site caching (disabling caching in the middleware),
> but did get the same results, even when I specified vary_on_headers
> ('Content-Language','Accept-Language').
>
> I have found a snippet (http://www.djangosnippets.org/snippets/443/)
> that might work, but I'm reluctant to use this hack and also rely on
> the deprecated CacheMiddleware.
>
> Any help and hints are appreciated!
>
> Thanks,
> Maik
>
> PS. relevant settings.py excerpt:
> CACHE_BACKEND = 'locmem:///'
> CACHE_MIDDLEWARE_SECONDS = 300
> CACHE_MIDDLEWARE_KEY_PREFIX = ''
> CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
>

The user's language preference might end being stored (and sent back) in
the django language preferences cookie or the session-related cookie.
So, to cover all the possible channels that preference could come in,
you will also need to indicate 'cookie', in the Vary header:

@vary_on_headers(''Accept-Language', 'Cookie')

See the following posts for related discussions:

http://groups.google.com/group/django-developers/browse_thread/thread/740f8d434e0660ff/5033945a4cdde102?hl=en=gst
http://groups.google.com/group/django-users/browse_thread/thread/256faa01c62b4f27/f4a382c540f47b5b?hl=en=gst

Regards,

--
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Foreignkey field in admin list_filter, Django 1.0

2008-11-13 Thread Ramiro Morales

On Thu, Nov 13, 2008 at 4:28 PM, caio ariede <[EMAIL PROTECTED]> wrote:
> Nothing about this? :(
>
> I can't put a field came from a foreignkey in a list_filter..
>
> If someone can help..

Have you tried reading the documentation?:

  http://docs.djangoproject.com/en/dev/ref/contrib/admin/#list-filter

it doesn't talk about fields of related models being supported at all.

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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-06 Thread Ramiro Morales

On Thu, Nov 6, 2008 at 2:16 PM, gontran <[EMAIL PROTECTED]> wrote:
>
> hello,
>
> I just started to learn django, so my question may be stupid:
>
> In my template, I would like to display a html string (stored in my
> database). My problem is that it displays the string but it
> automatically escapes the html tags.
>
> for example, if my string is: my text
>  instade of showing: my text
>  it shows: my text
>
> any idea to fix that?
>

Searching over the documentation with terms like "automatically
escaping" or "autoescaping"
gives this

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

as the first hit. Unsurprisingly, one of the sections in that document
is "Automatic HTML escaping"

Try reading it to know how you can control the feature.

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: syncdb problem with standalone applications

2008-11-06 Thread Ramiro Morales

On Thu, Nov 6, 2008 at 10:26 AM, cnole <[EMAIL PROTECTED]> wrote:
>
> Hi everybody,
>
> i'm new to django framework and i found a problem during learning
> django. I wrote a standalone application for my project and registered
> it as installed applications in the project settings. But everytime i
> made a change to models of the standalone application and run the
> syncdb command to the project, all the standalone application related
> database schema won't be updated. I must remove the whole .db file and
> create it with command sqlall again, than i get the reflection of the
> changed i've made.
>
> Is this a feature or a bug?

It's a functionality that isn't currently included in Django. See:

http://docs.djangoproject.com/en/dev/faq/models/#if-i-make-changes-to-a-model-how-do-i-update-the-database

> Or is there another tricky ways to get the
> syncdb command to work? Please help me, i can't remove and then create
> the whole database schema everytime i make a change to models. Any
> suggestions would be appreciated.

There are some external projects that offer provide schema evoluton
functionality:

south, dmigrations, django-evolution, dbmigrations, deseb,
django-schemaevolution

Google for them.

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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 inheritance question

2008-11-02 Thread Ramiro Morales

On Sun, Nov 2, 2008 at 4:52 AM, void <[EMAIL PROTECTED]> wrote:
>
> Can someone point to the correct way to do this?
>
> Suppose i'm working in a tumblelog, it's basically , 4 o 5 tipes of
> "post item" that share some cmmon information.
>
> So the first approach i would go is:
>
> cllass Post(models.Model):
>   here goes common metada of all things that can be "posted" like
> taggin , dates, etc
>
> class TextPost(Post)
>  This model inherits all the metadata of the "normal" posteable
> objects and add some of it's own like
>
>  text = TexField()
>
> also we can provide a ImagePost(Post) with the same characteristics as
> textpost,
>
> The caveat folllow:
>
> Inheritance gives me a reference in the "child" model to the pk of the
> parent, that's ok.
> But i have no way of iterating to Posts elements and instantiating
> them osr seeing their attrs without knowing the correct nadme.
>
> Is any correct way to do this? will i have to hack django (or add a
> field) that backreferences the reference?
>
> The idea is traverse only the Posts objects instead o N tables (1 for
> each kinkd of post)
>

See this thread for some ideas:

http://groups.google.com/group/django-users/browse_thread/thread/f4241bc16455f92d/dcd2bfcc91d99cc9

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Dev & Production difference: escaping html in admin

2008-11-01 Thread Ramiro Morales

On Sat, Nov 1, 2008 at 4:21 PM, Alexey Moskvin <[EMAIL PROTECTED]> wrote:
>
> Hi, I have developer (win) & production (debian) installations of
> Django 0.97.

There is not such thing as a 0.97 release, are you sure you are using
the same SVN revisions in both environments?

>  [...]
> But on my production stage there is a problem: no pictures are
> displayed, all tags, returned by show_thumb method are escaped, and I
> have raw HTMl in corespondend column.

Auto-escaping was added in revision 6671, read

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Auto-escapingintemplates

to see if you are being affected by it.

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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 does Django generate HTTP 500 errors for static media when Debug is set to False?

2008-09-23 Thread Ramiro Morales

On Tue, Sep 23, 2008 at 1:36 PM, h <[EMAIL PROTECTED]> wrote:
>
> I suspect you have something like this in your urls.py and your static
> media is not being served
>
>
> if not settings.DEBUG:
>urlpatterns += patterns('',(r'^media/(.*)$',
> 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),)
>
>

I was going to suggest the same. If so, we  should consider renaming the
http://docs.djangoproject.com/en/dev/howto/static-files/
document from "Serving static files" to "Serving static files with the
Django development server".
to avoid helping people making wrong assumptions based in
the generality of the document title.

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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 1.0 lighttpd FastCGI redirect issue

2008-09-12 Thread Ramiro Morales

On Fri, Sep 12, 2008 at 9:33 PM, Anders Bergh <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm trying to host a Django 1.0 project on lighttpd 1.4.19 on Linux,
> following the lighttpd FastCGI in the Django documentation. However,
> it doesn't work, it seems to redirect to /mysite.fcgi for almost
> anything I do.
>
> Here's the config:
>
> $HTTP["host"] == "labs.lamepunch.org" {
>  fastcgi.server = (
>"/labs.fcgi" => (
>  "main" => (
>"socket" => "/srv/django/lamepunch/django.sock",
>"check-local" => "disable",
>  )
>),
>  )
>
>  alias.url = (
>"/media/" => 
> "/usr/lib/python2.5/site-packages/django/contrib/admin/media/",
>  )
>
>  url.rewrite-once = (
>"^(/media.*)$" => "$1",
>   "^(/.*)$" => "/labs.fcgi$1",
>  )
> }
>
>
> I run Django like so:
>
> ./manage.py runfcgi socket=django.sock pidfile=django.pid
>
> When I visit the site it gives me a 404:
>
> Page not found (404)
> Request Method: GET
> Request URL:http://labs.lamepunch.org/labs.fcgi/
>
> Trying to access the admin I get:
>
> The current URL, labs.fcgi/labs.fcgi/admin/, didn't match any of these.
>
> Any clues? I've been asking around on IRC and experimenting with the
> conf, but nothing has helped yet. I'm sure it worked prior to 1.0.
>

Have you tried what's suggested in

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#ChangedthewayURLpathsaredetermined

(under the "lighttpd + fastcgi (and others)" sub-section)?

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: i18N with templates in separate directory

2008-09-08 Thread Ramiro Morales

On Mon, Sep 8, 2008 at 12:53 PM, timc3 <[EMAIL PROTECTED]> wrote:
>
>> I'd say that for being able to scan you project's locale/ subdir
>> (althouth this isn´t obvious from the docs) and the dirs listed in
>> LOCALE_PATHS you need specify the Python module path of
>> your settings file with the --settings command line switch
>> as explained in:
>>
>> http://docs.djangoproject.com/en/dev/topics/i18n/#using-translations-...
>>
>> You might also want to take a look at
>>
>> http://docs.djangoproject.com/en/dev/topics/i18n/#message-files
>>
>> (Yes, we need to refactor and enhance that document.)
>>
>
> When I run it from the directory above and putting in --
> settings=mysite/settings I get the django.po file created, but two
> problems (perhaps). The locale directory is on the same level as the
> template and site directory:
>
> code/
> -mysite/
> --mysiteapp1/
> --mysiteapp2/
> --settings.py
> --manage.py
> -mysitetemplates/
> -mysitestaticmedia/
> -locale/

Shouldn't you run it from the mysite/ directory? Even further, now that I think
about it, you should can simplify things by simply manually
creating the mysite/locale directory  and then doing

mysite $ python manage.py makemesages -l se

(just tested it and it works)

(manage.py is functionally equivalent to django-admin.py but
it knows it should use the settings.py file located in the
same directory).

>
> And the django.po file has longer paths to everything.

The paths in the PO file comments have no effect.

HTH,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Template tag i18n failing

2008-08-31 Thread Ramiro Morales

On Sun, Aug 31, 2008 at 2:09 PM, Ramiro Morales <[EMAIL PROTECTED]> wrote:
>
> This is a bug and has been reported as ticket |1] #7027, you can track
> the advance of the issue there.
>

This is fixed as of revision 8769.

cheers,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Template tag i18n failing

2008-08-31 Thread Ramiro Morales

On Sun, Aug 31, 2008 at 1:58 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I would like to use
> {% printformfooter _("Submit Message") "Cancel" %}
>
> as it is documented here:
> http://www.djangoproject.com/documentation/i18n/#in-template-code
>
> but I get the error:
> "
> TemplateSyntaxError at /project/1/message/create/
>
> printformfooter takes 3 arguments
> "
>
> printformfooter is working fine if I don't put _().
>
> Could someone please tell me what I'm doing wrong.
>

This is a bug and has been reported as ticket |1] #7027, you can track
the advance of the issue there.

Also, you can help by applying the latest patch attached to it and posting you
experience there as a comment if you find some problem with it.

Regards,

1. http://code.djangoproject.com/ticket/7027

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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 svn 8631

2008-08-27 Thread Ramiro Morales

On Wed, Aug 27, 2008 at 4:44 PM, Hernan Olivera <[EMAIL PROTECTED]> wrote:
>
> Hello
>
> My app crashes when I update to the last svn version 8631 with this error:
>
> ImproperlyConfigured: Error while importing URLconf 'dataentry.urls':
> 'module' object has no attribute 'STACKED'
>
> Obviously, my app were ok before that.
>
> Ideas?

edit_inline has been replaced with InlineModelAdmin objects:

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-objects

Following the new version of part 2 of the tutorial will be also
of help:

http://docs.djangoproject.com/en/dev/intro/tutorial02/#intro-tutorial02

If you are using Django from SVN and updating it periodically you *should*
wlways read the [1]BackwardsIncompatibleChanges page, in your case

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Mergednewforms-adminintotrunk

Good luck

1. http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: SVN checkout for users without access to SVN

2008-07-18 Thread Ramiro Morales

On Fri, Jul 18, 2008 at 7:39 AM, warsng <[EMAIL PROTECTED]> wrote:
>
> I cannot install SVN on the machine i am currently accessing the
> internet through, is it possible for someone to provide me with a
> tarball/zip of the latest SVN co?

You can use the web interfaces of the distributed version control mirrors of
Django's SVN repo (Git, Mercurial, Bazaar), the URLs are published at:

http://code.djangoproject.com/wiki/DjangoBranches#Distributedversioncontrolmirrors

some of these provide tarballs with snapshots of the tree.

HTH,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: IOError with files uploads bigger than 2.5 MB

2008-07-14 Thread Ramiro Morales

On Mon, Jul 14, 2008 at 1:19 PM, tom <[EMAIL PROTECTED]> wrote:
>
> I am running on this version:
> Revision: 7920
> Node Kind: directory
> Schedule: normal
> Last Changed Author: russellm
> Last Changed Rev: 7917
>

Try applying the [1]tempfile3.diff patch attached to ticket [2]7658
but it is a bit unclear because the
reporter has reported  two different issues in teh same ticket. One of
these is the same as yours.

Please report back here your experiences with these tests.

Something a bit strange about the temporary file full path contained
in the traceback
you posted:

Exception Type: IOError at /admin/ads/ad/11/
Exception Value: [Errno 2] No such file or directory:
'/var/folders/g2/g2k+MI0fHlCR7GvjpacMPU+++TI/-Tmp-/tmpR3rxkC.upload'

What's your temporary folder? /var/folders/g2/ ? or
/var/folders/g2/g2k+MI0fHlCR7GvjpacMPU+++TI/ ?

Because  the g2k+MI0fHlCR7GvjpacMPU+++TI/-Tmp-/tmpR3rxkC.upload part
is very long
and contains / characters.

Regards,

-- 
 Ramiro Morales

1.(http://code.djangoproject.com/attachment/ticket/7658/tempfile.3.diff
2. http://code.djangoproject.com/ticket/7658

--~--~-~--~~~---~--~~
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: IOError with files uploads bigger than 2.5 MB

2008-07-14 Thread Ramiro Morales

On Sun, Jul 13, 2008 at 10:48 PM, tom <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have a problem with file uploads which are bigger than 2.5 MBs. When
> I use files which are smaller than 2.5 MBs, the files save as
> expected. As soon as they are bigger than that, I get an IOError (see
> traceback further down). I have checked that i have write and delete
> permissions on this directory. When I change the
> FILE_UPLOAD_MAX_MEMORY_SIZE the uploads are working fine.
>

What SVN revision of Django are you using?.

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: many to many field

2008-06-24 Thread Ramiro Morales

On Tue, Jun 24, 2008 at 3:40 PM, Stephan Jäkel <[EMAIL PROTECTED]> wrote:
>
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> OK. I hoped, there is a possibility to use ManyToManyField. Well, the
> Model-way is already implemented but i would like to use
> ManyToManyField. Anyway, it works.
>

If you are using Django from SVN trunk and willing to patch and test
code, you might
be interested in taking a look at ticket [1]6095 and helping with the
testing of the
most recent patch attached to it.

Regards,

-- 
 Ramiro Morales

1. http://code.djangoproject.com/ticket/6095

--~--~-~--~~~---~--~~
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: Some Django unit tests fail...

2008-06-20 Thread Ramiro Morales

On Thu, Jun 19, 2008 at 11:20 AM, Russell Keith-Magee
<[EMAIL PROTECTED]> wrote:
>
> On Thu, Jun 19, 2008 at 10:08 PM, Ramiro Morales <[EMAIL PROTECTED]> wrote:
>>

>>
>> Maybe a note about this dependency of that particular Django test
>> suite component could
>> be added to the "Unit tests" section of the "Contributing to Django"  
>> document?.
>
> I'm happy to add the note. Open a ticket with some draft text, bump it
> to ready-for-checkin and I'll commit it when I get a chance.
>

Done on #7513

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Some Django unit tests fail...

2008-06-19 Thread Ramiro Morales

On Thu, Jun 19, 2008 at 10:27 AM, Peter Melvyn <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I wanted to make sure that all unit tests will pass after #3030 fix
> and run Django unit tests on trunk updated to r7703 on Windows, Python
> 2.4 and MySQL 5.0.37.
>
> But I found that some test failes:
>
> 1. If I've run all tests, I get error:
>
> Traceback (most recent call last):
>  File "C:\Python24\Lib\site-packages\django-trunk\tests\runtests.py",
> line 183, in ?
>django_tests(int(options.verbosity), options.interactive, args)
>  File "C:\Python24\Lib\site-packages\django-trunk\tests\runtests.py",
> line 153, in django_tests
>failures = run_tests(test_labels, verbosity=verbosity,
> interactive=interactive, extra_tests=extra_tests)
>  File "C:\Python24\Lib\site-packages\django-trunk\django\test\simple.py",
> line 136, in run_tests
>suite.addTest(build_suite(app))
>  File "C:\Python24\Lib\site-packages\django-trunk\django\test\simple.py",
> line 59, in build_suite
>test_module = get_tests(app_module)
>  File "C:\Python24\Lib\site-packages\django-trunk\django\test\simple.py",
> line 17, in get_tests
>test_module = __import__('.'.join(app_path + [TEST_MODULE]), {},
> {}, TEST_MODULE)
>  File 
> "C:\Python24\Lib\site-packages\django-trunk\tests\regressiontests\templates\tests.py",
> line 23, in ?
>from loaders import *
>  File 
> "C:\Python24\Lib\site-packages\django-trunk\tests\regressiontests\templates\loaders.py",
> line 13, in ?
>import pkg_resources
> ImportError: No module named pkg_resources
>

AFAICT the failing test is the one trying to execise the Python egg
template loader.

I've found this same problem last week both on a Linux system and on a
Windows one.
The common factor was they were systems where the 'stack' has had just
been installed
Python 2.4 and Python 2.5 respectively). Installing the right
setuptools version solved the
problems.

Maybe a note about this dependency of that particular Django test
suite component could
be added to the "Unit tests" section of the "Contributing to Django"  document?.

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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 know the current apache authenticated user

2008-06-01 Thread Ramiro Morales

On Mon, Jun 2, 2008 at 12:27 AM, Maykel Moya <[EMAIL PROTECTED]> wrote:
>
> I'm running a Django site via apache2 + mod_python. I'm not using any
> Django related authentication mechanism, just apache digest
> authentication against a flat file.
>
> [...]
>
> I'm thinking on a environment variable or alike that holds the
> username that is currently authenticated to apache but Google and
> docs/ had not been of much help.
>

You migh want to take a look at ticket [1]689 and one of latest patches
attached to it.

HTH.

-- 
 Ramiro Morales

1. http://code.djangoproject.com/ticket/689

--~--~-~--~~~---~--~~
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: i18n issues.

2008-05-29 Thread Ramiro Morales

Jack,

On Thu, May 29, 2008 at 2:51 PM, Jack M. <[EMAIL PROTECTED]> wrote:
>
> [...]
>
>  Used make-message.py -l sp to generate the Spanish language files.

Why are you using "sp" for Spanish?. You should be using "es" as that's the
two-letter code for the spanish language used both by the gettext
infrastructure and the browser language preferences.

If you insist on using a new "sp" custom language code you will need to make
sure:

a) you (and your users') browsers sends "sp" in the list of languages
   preference represented by the Accept-Language HTTP request header.

b) you create a minimal translation of Django to "sp" (in addition to the
   translation of your app), as per the "Locale restrictions" note here:

 
http://www.djangoproject.com/documentation/i18n/#how-to-create-language-files

   and here:

 http://www.djangobook.com/en/1.0/chapter18/

   (starting on the paragraph that begins with: "The LocaleMiddleware can only
select languages for which there is a Django-provided base translation.")

But even if you do that, I'm not sure you will get because the GNU gettext
machinery Django uses might simply refuse to handle a language that doesn't
exist (from what I can see "sp" isn't a two-lteer code known by gettext), so I
can't imagine why would you want to embark yourself in such a task.

Regards,

--
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Authentication backend question

2008-05-12 Thread Ramiro Morales

On Mon, May 12, 2008 at 10:48 AM, finnam <[EMAIL PROTECTED]> wrote:
>
>  Hi,
>
>  I need to create a custom authentication backend that will
>  authenticate user based on the HTTP headers for the request. But in
>  django manual I don't see any way to obtain HttpRequest instance in
>  the authenticate() method.
>  For example, if I receive a request with http header USER_NAME equal
>  to "admin", I would like request.user to return admin User instance
>  for me.
>  Any ideas how I can implement this behaviour?
>

You may want to take a look at [1]ticket 689 that implements integration of
Django authentication with pre-existing authentication systems implemented
at the Web server by using the REMOTE_USER variable handed by it.

If you decide to follow this way, please share your experiences about
it (regarding functionality, documentation suitability, etc.).

Regards,

-- 
 Ramiro Morales

1. http://code.djangoproject.com/ticket/689

--~--~-~--~~~---~--~~
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: Adding new language for i18n

2008-04-24 Thread Ramiro Morales

On Thu, Apr 24, 2008 at 4:07 PM, Mihai Damian <[EMAIL PROTECTED]> wrote:
>
>  So new lines on blocktrans tags get a \r\n on Windows as opposed to
>  just \n on Linux. That's what's causing the whole problem. Maybe the
>  make-messages.py could be modified to check if os.name is nt or os2
>  and if so read the target file, replace \r with '', write the new
>  content to a temporary file, pass this to xgettext and finaly delete
>  the temp file ( + keeping the previous version for the else branch, of
>  course). Might not be the best ideea to have all these file accesses
>  but it's better that nothing.
>
>  What do you guys think?
>

Please open a ticket in the Django Trac so this issue doesn' t get forgotten.

Thanks!

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Adding new language for i18n

2008-04-15 Thread Ramiro Morales

On Tue, Apr 15, 2008 at 10:04 AM,  <[EMAIL PROTECTED]> wrote:
>
>  Hi
>
>  I try to add translation for Thai language. I did following,
>
>  1. My environment is Window so I use Window version of xgettext, see
>  http://gnuwin32.sourceforge.net/packages/gettext.htm
>  2. Under my application path, I created directory conf/locale.
>  3. Executed make-messages.py -l th.
>  4. I can see conf\locale\th\LC_MESSAGES\django.po.

For aplications this should be locale\th\LC_MESSAGES
(no intermediate conf\). See:

  http://www.djangoproject.com/documentation/i18n/#message-files

>  5. I successfully executed make-messages.py -a.
>  6. Comoiled, compile-messages.py
>  7. Set LANGUAGE_CODE to "th".
>  8. Tested by adding trans tag in template (using message I've added
>  in .po file).
>  9. Try to force session and cookie language.
>  10  Nothing is translated.
>

Perhaps you missed this part from the documentation:

http://www.djangoproject.com/documentation/i18n/#how-django-discovers-language-preference

"
The LocaleMiddleware can only select languages for which there is a
Django-provided base translation. If you want to provide translations
for your application that aren't already in the set of translations in
Django's source tree, you'll want to provide at least basic
translations for that language.
[...]
A good starting point is to copy the English .po file and to translate
at least the technical messages — maybe the validator messages, too.
"

This is relevant because Django itself hasn' t yet been translated to Thai.

I would recommend you to read:

http://www.djangoproject.com/documentation/i18n/

to avoid these gotchas, The two problems you' ve found seem to be
related to not following what's documented there.

Good luck,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: TemplateSyntaxError when moving from 0.96.1 to SVN

2008-04-13 Thread Ramiro Morales

On Sun, Apr 13, 2008 at 7:36 PM, Gonzalo Delgado
<[EMAIL PROTECTED]> wrote:
> Hi there, I'm trying to move my django projects to  0.97-pre (trunk). The 
> first error I get is this one (when trying to load the admin interface in a 
> small project):
>
>  TemplateSyntaxError at /admin
>  Template u'admin/base_site.html' cannot be extended, because it doesn't exist

Are you extending the admin app UI?.

>
>  Is there a guide for this kind of migration?

Yes, take a look at

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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 while trying to work through chapter 3 of the django book name 'hours_ahead' is not defined

2008-04-07 Thread Ramiro Morales

On Mon, Apr 7, 2008 at 10:10 PM, Purcell <[EMAIL PROTECTED]> wrote:
>
>  views.py--
>  from django.http import HttpResponse
>  import datetime
>
>  def current_datetime(request):
> now = datetime.datetime.now()
> html = "It is now %s." %
>  now
> return HttpResponse(html)
>
>  def hours_ahead(request, offset):
> offset = int(offset)
> dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
> html = "In %s hour(s), it will be %s." %
>  (offset, dt)
> return HttpResponse(html)
>
>  [...]
>
>  urls.py--
>  from django.conf.urls.defaults import *
>  from mysite.views import current_datetime

You should also import the hours_ahead symbol as you did with
the current_datetime one

>  from mysite.views import current_datetime, hours_ahead

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: lighttpd & django, fcgi issues

2008-04-07 Thread Ramiro Morales

On Sun, Apr 6, 2008 at 6:53 PM, skunkwerk <[EMAIL PROTECTED]> wrote:
>
>  I'm having trouble running django with lighttpd (I'm not on a shared
>  host).  Here is what I've installed:
>
>  ubuntu 7.10
>  lighttpd
>  flup
>  cmemcache
>  python
>
>  When I go to my web address which maps to the django project
>  directory, all I see is a directory listing, not any django pages.
>
>  I started fcgi like this, as in the docs:
>  ./manage.py runfcgi method=threaded host=127.0.0.1 port=3033
>
>  have this in my lighttpd.conf:
>  server.modules  = (
> "mod_access",
> "mod_alias",
> "mod_accesslog",
> "mod_compress",
> "mod_fastcgi",
>   )
>
>  fastcgi.server = (
> "/mnt/project/mysite.fcgi" => (
> "main" => (
> "host" => "127.0.0.1",
> "port" => 3033,
> "check-local" => "disable",
> )
> ),
>  )
>
>  and the mysite.fcgi file:

Why did you create the .fcgi file? As the documentation says, that file needs
to be created if you are using FastCGI through Apache and you are using
lighttpd.

What you are missing (and that's also something that is documented) is the
url.rewrite-once directive in your lighttpd configuration.

The pipeline when using lighttpd + fastcgi + apache is:

1. HTTP Request arrives to lighttpd
2. lighttpd uses the::

"^(/.*)$" => "/mysite.fcgi$1"

   entry in the url.rewrite-once directive to route that request to the
   mysite.fcgi location. Note mysite.fcgi file itself doesn't need to exist
   it's just a ghost placeholder for the request routing. That's because of
   the::

 fastcgi.server."/mysite.fcgi"."main"."check-local" => "disable"

   setting.

   (note also thaat you need to correct that "/mnt/project/mysite.fcgi"
   entry because it doesn't match "/mysite.fcgi$1". they should.

3. lighttpd's mod_fastcgi module gets the request and routes it via a TCP or
   Unix socket to thegastCGi server

4. The fastCGI server (in your case Django's manage.py runfastcgi + flup) gets
   the request

Regards,

--
 Ramiro Morales

--~--~-~--~~~---~--~~
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: datetime 8 hours off

2008-04-01 Thread Ramiro Morales

On Tue, Apr 1, 2008 at 5:46 AM, Simon Oberhammer
<[EMAIL PROTECTED]> wrote:
>
>  hey group,
>  I have an inconsistant time problem, which goes away when I restart
>  apache, but then creeps up again after some time. When writing
>  comments in my custom app the time is 8hours behind (i'm CEST) *for
>  some users*. When I login with others, its okay.
>
>  in settings.py I have
>  TIME_ZONE = 'Europe/Vienna'
>
>  [EMAIL PROTECTED]:~/pm3$ date
>  Tue Apr  1 10:44:32 CEST 2008
>
>  any ideas what I should look for? This is annyoing.. it forces my to
>  apache2ctl restart quite often :-)
>

What version of Django are you using?, what deployment method
are you using? (mod_python, fast cgi, mod_wscgi).

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Google Maps API

2008-03-30 Thread Ramiro Morales

On Sun, Mar 30, 2008 at 10:08 PM,  <[EMAIL PROTECTED]> wrote:
>
>  I have a field I'm using that shows where events are around our area
>  for sports collectors, what I'd like to do is implement Google Maps,
>  kind of like the Washington Post does here:
>
>  
> http://projects.washingtonpost.com/2008-presidential-candidates/tracker/dates/2008/apr/09/6741/
>
>  Where/what would I need to search for?

I'd start by going to the Google web site and searching with the
following three words: django google maps

Good luck,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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 Apache + mod_python [SOLVED]

2008-03-29 Thread Ramiro Morales

On Fri, Mar 28, 2008 at 11:45 PM, Graham Dumpleton
<[EMAIL PROTECTED]> wrote:
>
>  On Mar 29, 5:04 am, Slayer_X <[EMAIL PROTECTED]> wrote:
>  > Problem solved!
>  >
>  > I deleted the symlinks, delete de django-trunk dir and make a fresh
>  > install directly in
>  >
>  > /usr/lib/python2.4/site-packages/django
>
>  What do you mean by 'make a fresh install directly in'? Do you mean
>  you copied it in by hand or did you use an appropriate setup.py file
>  script?
>

We were chatting on #django-es when César solved this. What he means when
he says a fresh install is that he removed the django symlink from
/usr/lib/python2.4/site-packages/ (that pointed to a Django SVN WC on his
home dir)

Then, as root, he did a

cd /usr/lib/python2.4/site-packages/
svn co http://code.djangoproject.com/svn/django/trunk/django

The problem he was having with the symlink approach was related to the fact
that, even when he theoretically disabled SElinux and rebooted, something
wasn´t working when mod_python wanted to import django (importing
django in a normal user interactive python session worked ok.)

>
>  > In my Apache conf I use this path
>  >
>  > PythonPath "['/'] + sys.path"
>

>  Why are you adding '/' to the module search path. There shouldn't be
>  any need to add the root of the file system to it.
>

This is because his project was located in a dir below / as in:

/
ripsol/
settings.py
urls.spy
...

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: revert database migration

2008-03-04 Thread Ramiro Morales

On Tue, Mar 4, 2008 at 2:58 AM, stranger <[EMAIL PROTECTED]> wrote:
> After searching this group archive i didnot find much regarding my question

Really?

http://groups.google.com/group/django-users/search?hl=en=migrations=0=d=en;

There is a difference between searching the archives to find the answer
and searching it trying to find the answer one expects :)

On Tue, Mar 4, 2008 at 3:04 AM, stranger <[EMAIL PROTECTED]> wrote:
>  It is very sad that django donot track models. I migrated myself from
>  Rails. In rails there is migration where we can make changes to models
>  and sync with database. hope django will find a solution.
>

http://www.djangoproject.com/documentation/faq/#if-i-make-changes-to-a-model-how-do-i-update-the-database

Take a loo to third party efforts in this regard:

http://code.google.com/p/deseb/
http://code.google.com/p/django-evolution/
http://www.aswmc.com/dbmigration/
http://code.google.com/p/django-schemaevolution/

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Converting relational data to hiechical data

2008-02-21 Thread Ramiro Morales

On Thu, Feb 21, 2008 at 10:22 AM, shabda <[EMAIL PROTECTED]> wrote:
>
>  I have a model like
>
>  class Task(models.Model):
>   name = Models.CharField(max_length = 100)
>   parent = models.ForeignKey('Task', null = True)
>
>  Using this model say I have got a table like,
>
>  Task
>  ---
>  ID  Name Parent_id
>  1   Foo null
>  2  Bar   1
>  3 Baz1
>  4 Bax2
>
>  [...]
>
>  Essentially I want to convert a relational data to monarchical data.
>  Does any body have snippets/recipe to do something similar? I am using
>  mySQL

Isn't just for this kind of cases that [1]django-mptt has beeen created?

-- 
 Ramiro Morales

1. http://code.google.com/p/django-mptt/

--~--~-~--~~~---~--~~
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: Newbie sqlite3 dbshell confusion

2008-01-31 Thread Ramiro Morales

On Jan 31, 2008 2:27 PM, bobhaugen <[EMAIL PROTECTED]> wrote:
>
> Installed the latest Django package from the Synaptic package manager
> on Ubuntu 7.10. I understand the Django version to be 0.96.1 (package
> says 0.96-1ubuntu0.1).
>
> I'm on the first django tutorial:
> http://www.djangoproject.com/documentation/tutorial01/
>
> Got my sqlite database set up.  Now trying to "run the command-line
> client for your database".
>
> I understand the way to do that is $ python manage.py dbshell
>
> I get an error message saying "No such file or directory".
>
> Googling for this situation, I find http://code.djangoproject.com/ticket/6338
> Which says I need to Sqlite3.
>
> But I thought sqlite3 came along with Python 2.5.  No?
>
> Any clues to what am I missing here?  Need to install something else?

What you have installed is the SQLite library and the Python bindings, both
pieces come now included in Python 2.5 (if you were using an older
Python version you would have to install Ubunto packages named libsqlite3
and  python-sqlite3 or similar).

But what dbshell does is to execute tue command line client
for your backend (mysql for MySQL, etc,...) aleady configured
to work with the database of your Django project, and for
SQLite that command line client application is sqlite3
that in Debian/Ubuntu comes in the sqlite3 package:

http://packages.ubuntu.com/cgi-bin/search_packages.pl?searchon=names=all=1=sqlite3

Note the "A command line interface for SQLite 3" part. Install it
using the package management tool of the distribution
and try again.

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Decimal separator

2008-01-31 Thread Ramiro Morales

Mauro,

On Jan 31, 2008 10:23 AM, Mauro Sánchez <[EMAIL PROTECTED]> wrote:
>
> Hello.
> How can I establish the comma ',' as the decimal separator?
> Is there any config file where I should set it up?
> Thanks.

You can try with the decimalfmt filter of Christopher Lenz's [1]Babel
[2]Django plugin that
includes template filters and a context processor.

You can find additional information at:

  http://www.cmlenz.net/archives/2007/09/djangobabel-integration#more

Regards,

-- 
 Ramiro Morales

1. http://babel.edgewall.org/
2. http://babel.edgewall.org/wiki/BabelDjango

--~--~-~--~~~---~--~~
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: SESSION_SAVE_EVERY_REQUEST creates new session?

2008-01-27 Thread Ramiro Morales

On Jan 6, 2008 10:58 AM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> [...]
> The situation is a little subtle: by default, we use the same session
> cookie name for every Django site. You can change that. In fact, when I
> first saw this message, I couldn't repeat the problem because the case I
> tested it on had the session cookie being called something unique.
>
> Anyway, with the default name, you will sometimes be submitting a
> session cookie that comes from another Django site. The session id won't
> match anything in your database, so the subversion version of Django
> (with the new pluggable backends ... this shouldn't be a problem in
> 0.96) will save a new session to the database. However, it wasn't
> marking this new session as "modified", so the HTTP response wasn't
> sending back a set-cookie header. Thus, on the next request, you'd get
> the same bad session id, a *new* session entry would be created...
> rinse, wash, repeat.
>
> This would happen even if you weren't specifically using the session on
> a particular request (in fact *only* in that case -- because if you
> wrote to the session, it was being sent to the user each time). So
> [7001] makes sure the new session cookie is sent back to the user as
> well.
>

Just managed to put on Trac some mental notes I had made about topics
being discussed on the mailing lists and tickets I had seen being opened
and found this isue had already been reported as bug #5593. I'm closing it
and leaving a link to this thread there.

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: multilingual projects in django...

2008-01-26 Thread Ramiro Morales

On Jan 26, 2008 10:40 AM, halukdogan <[EMAIL PROTECTED]> wrote:
>
> hello
>
> i'm trying to develop a multilingual web app with django. i've
> acchieved making django translate the messages in the views.py but it
> does not translate the messages in the template files.
> my message file for English is:
>
> #: html/anasayfa.html:9
> #, fuzzy
> msgid "Hatali Giris"
> msgstr "Not Authorized"
>

See

http://groups.google.com/group/Django-I18N/browse_thread/thread/5989b67618a1705a?hl=en#bd2ed8f23b826e02

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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 Book: The Django Administration Site

2008-01-07 Thread Ramiro Morales

On Jan 7, 2008 12:40 AM, Mikey3D <[EMAIL PROTECTED]> wrote:
>
> Thank you so much it works. :-) One question, why is that I have Auth
> and Sites are showing up when my "class Admin: pass" were wrong way of
> coding still works?
>

Because these are different apps? and they have their Admin inner classes
correctly defined in their own models.py files.

> Thank you. You know I can't copy/paste the text from new django book.

I meant copy/paste  from your code to the e-mail.

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Passing a form via a generic view

2008-01-07 Thread Ramiro Morales

Rodrigo,

On Jan 7, 2008 4:05 PM, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote:
> [...]
>
> Since this parameter is not passed from the generic view, the form
> doesn't show. The form is defined in views.py and works for my other,
> non-generic views. Is there a way to pass the form via a generic view?
>

Remember views are Python functions. Take a look at
http://www.b-list.org/weblog/2006/nov/16/django-tips-get-most-out-generic-views/
("Getting more out of a generic view"section). and
http://www.pointy-stick.com/blog/2006/06/29/django-tips-extending-generic-views/

The key word is the "extra_context" argument of the generic views.

HTH,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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 Book: The Django Administration Site

2008-01-06 Thread Ramiro Morales

On Jan 6, 2008 5:10 PM, Mikey3D <[EMAIL PROTECTED]> wrote:
> [...]
> 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()
>
> class Admin: pass
>
> def __str__(self):
> return self.name
>
> class Meta:
> ordering = ["name"]
>

So, is this a copy/paste error or you are really defining what
should be model inner classes (Admin, Meta) as top-level classes?.

If he latter, that could be a posible reason for he behaviour you are
seeing. Rewrite them
like:

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()

class Admin: pass

def __str__(self):
return self.name

class Meta:
ordering = ["name"]


(same thing for the model methods)

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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 on MediaTemple (dv) howto?

2008-01-03 Thread Ramiro Morales

On Jan 3, 2008 6:30 PM, Josh Ourisman <[EMAIL PROTECTED]> wrote:
>
> Is there any good howto on setting up Django on a MediaTemple (dv)
> server? Up until now I've been running various Django-powered sites
> from Dreamhost. Now I'm migrating all my hosting over to MediaTemple,

Brian Rosner posted an entry about this on his blog a while back:

  http://oebfare.com/blog/2007/dec/13/django-and-mediatemple/

HTH

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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 ldap, not ldap auth!

2007-11-26 Thread Ramiro Morales

On Nov 26, 2007 6:02 PM, tinti <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> have a really big problem getting ldap working with django.
> Tried almost everything :( My code is in the views.py :
>
> from ldap import *
> def ldapListUsers(ldap):
> """List all ldap users"""
> l = ldap.initialize("ldap://localhost:389/;)
> l.simple_bind_s("cn=Manager,dc=local,dc=net", "secret")
>
> [...]
>
> When I now enter the url http://localhost:8000/ldapListUsers/ I get
> the following error:
>
> AttributeError at /ldapListUsers/
> 'WSGIRequest' object has no attribute 'initialize'
> Request Method: GET
> Request URL:http://localhost:8080/ldapListUsers/
> Exception Type: AttributeError
> Exception Value:'WSGIRequest' object has no attribute 'initialize'
> Exception Location: /workspace/django_ldapAdmin/ldap/views.py in
> ldapListUsers, line 26
>
> [...]
>
> Please help me find the error ;)
>

You have a name clash between the ldap module you are importing at the top of
the module and the parameter to the view, both are named "ldap", you intend to
call functions from the ldap module but inside the view function the
ldap name is
the name of request. hence the error.

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Dynamically load objects

2007-11-16 Thread Ramiro Morales

On Nov 16, 2007 8:18 PM, Grupo Django <[EMAIL PROTECTED]> wrote:
>
> Thanks a lot! get _model works.
> Only one thing, I've been reading the code in te file django/db/models/
> loading.py and I don't understand how it works, and now I need to know
> or I won't sleep :-)
>
> What should I do to reference stuff?
>
> app = __import__('app_name',{},{},['models'])
> mods = getattr(app,'models')
> module = getattr(mods,'ModuleIWant')
>
> This actually works, but I'm not sure if it's the right way or the
> "python way".
>

Do you want to reimplement or do you want to use
get_model()?. If the answer is the latter you might
find this article helpful:

http://www.b-list.org/weblog/2007/nov/03/working-models/

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: _real_get_response: global name '_' is not defined

2007-10-22 Thread Ramiro Morales

On 10/22/07, l5x <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> my code was working fine, until I put it on my another system.
> The error I get with newest SVN django version is:
>
> NameError at /
> global name '_' is not defined
> Request Method: GET
> Request URL:http://localhost:8000/
> Exception Type: NameError
> Exception Value:global name '_' is not defined
> Exception Location: /usr/lib/python2.5/site-packages/django/core/
> handlers/base.py in _real_get_response, line 81
> Python Executable:  /usr/bin/python
> Python Version: 2.5.1
>
> Traceback (most recent call last):
> File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py"
> in _real_get_response
>   81. response = callback(request, *callback_args, **callback_kwargs)
>
>   NameError at /
>   global name '_' is not defined
>

See ticket #5795:

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

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: extends isn't working

2007-10-22 Thread Ramiro Morales

Randall,

On 10/22/07, DjangoFett <[EMAIL PROTECTED]> wrote:
>
> The more I "fiddle" with these templates, the more I'm understanding
> them. It was the initial learning curve that just had me confused b/c
> it wasn't what I was looking for...

There is a description of how template inheritance works in the no-tutorial
documentation:

  http://www.djangoproject.com/documentation/templates/#template-inheritance

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Index

2007-10-02 Thread Ramiro Morales

On 10/2/07, Atayal <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I understand that I can have custom primary keys. Aside from primary
> key, MySQL allows indexing  on certain fields to facilitate searching.
> Is it supported via Django's API?
>

Yes, it's in the very complete documentation:

  http://www.djangoproject.com/documentation/model-api/#db-index

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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 error, trying to deploy Django with mod_wsgi

2007-09-24 Thread Ramiro Morales

On 9/24/07, Steve Potter <[EMAIL PROTECTED]> wrote:

> [...]
> But when I
> tried to load the site I still received a 500 error and the apache
> error log had the following:
>
> mod_wsgi (pid=5070): Exception occurred within WSGI script '/home/
> missed/projectsmt/pjsmt.wsgi'.
> [...]
> OSError: [Errno 13] Permission denied: '/home/missed'
>
>
> The permission denied error doesn't make much sense, obviously it is
> able to read the project files, or it wouldn't get this far.
>

Are you sure that the user Apache is running as has permissions
to read directories/files under the missed user's home dir?.

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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,what's wrong with the runserver

2007-09-19 Thread Ramiro Morales

On 9/19/07, Hannus <[EMAIL PROTECTED]> wrote:
>
> Hi,guys
> After input the "manage.py runserver" ,there is the following
> errors,what's wrong?The process of installation was always followed
> the documents.My OS is winxp sp2,python is2.51.
> --- 
> -
> Traceback (most recent call last):
> File"D:\python25\lib\site-packages\django\bin\newsite\manage.py",line
> 11,in 
> File"D:\python25\lib\site-packages\django\core
> \managemet.py",line1657,in execute_manager
> project_directory=setup-environ
> File"D:\python25\lib\site-packages\django\core
> \managemet.py",line1649,in setup_environ
> project_module=_import_<project_name,<>,<>,['']>
> import error:no module named mysite

Hmm a few strange things:

* managemet.py does not exist on django
* The error is about a "mysite" project but above
  thre is a \newsite\manage.py asi if the name of the
  project were "newsite"

Are you sure that backtrace is a copy paste  from the real one?

Also, it seems you are creating your project inside the bin subdir
of Django. Try creating it on another place of the file system.

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: cronjob

2007-09-18 Thread Ramiro Morales

On 9/18/07, patrickk <[EMAIL PROTECTED]> wrote:
>
> now I get:
> ImportError: No module named django.core.management
>
> the directory "django_src" is on my python-path.
>

Read cron documentation; the cronjobs run with a crippled environment
but you can set/add the env vars (PYHTONPATH in this case) you need on
the crontab.

HTH

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: More deployment woes

2007-09-10 Thread Ramiro Morales

On 9/10/07, shabda <[EMAIL PROTECTED]> wrote:
>
> I am trying to deploy django, and to test the install I am doing this,
> I run django-admin.py startproject hello in directory /root/django
> I have added to my httpd.conf
>
> 
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE hello.settings
> PythonDebug On
> PythonPath "['/root/django', '/root/django/hello'] + sys.path"
> 
>
> [...]
>
> EnvironmentError: Could not import settings 'hello.settings' (Is it on
> sys.path? Does it have syntax errors?): No module named hello.settings
>
> What am I doing wrong?

I wouldn't be surprised if the user Apache is running as can't access anything
under the /root hierarchy. Try putting your project under another
directory that can
be made accessible to the Apache user and avoiding the temptation
to break the overall system security in the process :)

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Parents and Childrens in the same table

2007-09-03 Thread Ramiro Morales

On 9/3/07, qwerty <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've a category table, where a category can be related as a "child" to
> another, and a "parent" to others.
>
> Is there any django-way of doing this, where I've methods like
> modelinstance.childrens () and modelinstance.parent()?
>

There is some meterial in the wiki about that:

http://code.djangoproject.com/wiki/CookBookDataModels
http://code.djangoproject.com/wiki/CookBookCategoryDataModelPostMagic
http://code.djangoproject.com/wiki/CookBookDataModels

hth

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Obtain a range of values out of the database

2007-09-02 Thread Ramiro Morales

On 9/2/07, Chris Hoeppner <[EMAIL PROTECTED]> wrote:
>
> Hi there!
>
> I'd like to obtain a range of possible values out of the database. So,
> if for a certain field, the values in the database are [3,7,5,1,8,12,6],
> I'd like to push those into a dropdown. No problem with the dropdown
> part. But how do I manage to get such a list? And what about sorting it?
>

Take a loot at the values() method:

  http://www.djangoproject.com/documentation/db-api/#values-fields

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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   >