Re: Problem with running the database shell through cmd lime

2009-08-26 Thread Arul



On Aug 26, 7:19 pm, Arul  wrote:

> I did the same steps that you followed, it didnt work for me.
> But when i tried in another system it works fine.
> Probably there is some problem with my system settings.

I found the problem in my machine.It is the version problem.
In django 1.0.2 it was not working. when i upgraded to version 1.1 it
works fine

Thanks,
Arul
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



how to identified what changed in an instance due to save of a ModelForm?

2009-08-26 Thread Margie Roginski

Let's say I have a model and an associated ModelForm and am doing the
typical save of the ModelForm to modify the instance.  I'd like to
generate a report that identifies what fields were changed and what
the old and new values were.  I initially did this by doing a deepcopy
of my instance, then saving the ModelForm, then just comparing the
copy with the saved instance.  This works fine when I have no
ManyToMany fields.  But now that I have a ManyToMany field, I find
that deepcopy doesn't really "deepcopy" the ManyToMany field.
Instead, after I save the ModelForm, the deepcopy of the instance now
points to the new ManyToMany field.  IE, if my Manytomany field is
'publications' and the model form specifies 3 new publications, the
deepcopied version of the instance (created prior to saving the
ModelForm) now has a field 'publications' which contains those 3 new
publications.

It looks like to get this right I would have to subclass
ManyToManyField and provide a __deepcopy__ method.

Is there some easier way of doing this that I'm missing?

Thanks!

Margie
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: the parameters of the self-defined tags

2009-08-26 Thread PanFei
Thank you very much , I got it

On Wed, Aug 26, 2009 at 6:07 PM, Daniel Roseman wrote:

>
> On Aug 26, 6:55 am, Apple  wrote:
> > hi , now I want to pass a parameter named user (user is a instance of
> > User) to the self_defined tags,could I do this ? I think the passed
> > parameter are all strings , is there a way to get its real type ?
> > thank you for your replying !
>
> You can use the template.Variable() class to access the real variable
> referenced the name you pass to the tag. See
>
> http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#passing-template-variables-to-the-tag
> --
> DR.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 + Godaddy

2009-08-26 Thread Justin Lilly
On 26 Aug 2009 03:58:58-0700, Nanopino wrote:
> 
> i've actually have semi success in getting django to work on godaddy.
> It displays the "Congratulations on your first Django-powered page."
> You will have to be signed up for the linux shared hosting Deluxe or
> higher plan in order for fastcgi to be enabled. I can show you how to
> get it up and running but the only problem is that once it is up and
> running you can't do anything with it because the pysqlite2 and python
> bindings for mysql aren't installed making django useless. I'm trying
> to see if godaddy tech support will "yum install python-sqlite2" but i
> really doubt it. They keep trying to upsell me to a VPS. I've been at
> them for 2 weeks now... :-/
> 
> On Aug 25, 10:02 am, Andrés Martín - martyn
>  wrote:
> > Hi django Users.
> >
> > I need to know if somebody has used Django on godaddy Host service ?
> >
> > If yes, is easy to configure ? what recomended to me in that case ?
> >
> > Thank you!
> >
> > Regards
> > --
> > Andrés Martín Ochoa;

Save yourself a headache and ditch godaddy. They're fantastic for domain
purchasing, but leave you wanting when it comes to hosting. Especially
for something like Django. I might suggest http://webfaction.com/ as a
reasonable alternative. Trust me in that any amount you may have prepaid
for godaddy hosting will be worth nothing when compared to the amount of
frustration you will face trying to get something setup on a host that
isn't accomodating.

 -justin



signature.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)


Re: pyfacebook, No module named facebook.djangofb...

2009-08-26 Thread Matias
Where did you get the files?
if you go to the pyfacebook at google
http://code.google.com/p/pyfacebook/the project is now hosted in
github.
So if you downloaded from google it may be outdated.
The installation is much more simpler than what the tutorial says, so i
recommend to download from http://github.com/sciyoshi/pyfacebook/tree/master

HTH,

Matias.


On Wed, Aug 26, 2009 at 9:58 PM, garagefan  wrote:

>
> steps followed here:
>
> http://wiki.developers.facebook.com/index.php/PythonPyFacebookTutorial
>
> page with error is here:
>
> http://kennethdavid.net/fbapp/fbsample/
>
> obviously, python.conf is setup correctly to call the correct settings
> file. facebook is a link (ln -s) to /pyfacebook/facebook, as per
> instructions. facebook IS in the site-packages directory, same as
> django
>
> settings as per instructions:
>
> MIDDLEWARE_CLASSES = (
>'django.middleware.common.CommonMiddleware',
>'django.contrib.sessions.middleware.SessionMiddleware',
>'django.contrib.auth.middleware.AuthenticationMiddleware',
>'facebook.djangofb.FacebookMiddleware',
> )
>
>
> svn for pyfacebook is http://pyfacebook.googlecode.com/svn/trunk/ if
> anyone wants to check out the files that come in the folders...r
> you can check them out here
> http://github.com/sciyoshi/pyfacebook/tree/master
>
> running python setup.py install in pyfacebook ends up being an error
> looking for config/Makefile saying that it does not exist, infact... i
> do not have a config dir in python2.5
>
> any help would be appreciated
> >
>


-- 
:wq

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



ImageField width_wield

2009-08-26 Thread TheIvIaxx

Assume i have the following:

class Image(models.Model):
image = models.ImageField(upload_to="path/to",
width_field="width", height_field="height"

do i create new Integer fields there for width and height?  With this
i can do things like:

>>> Image.objects.get(pk=1).image.width

However this is just opening the file with PIL which is slow.  The
documentation suggestions the width/height will be updated upon save,
thus being quick :)

class Image(models.Model):
image = models.ImageField(upload_to="path/to",
width_field="width", height_field="height"
width = models.IntegerField()
height = models.IntegerField()

did not seem to do anything.  Am i missing something?

Thanks


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



pyfacebook, No module named facebook.djangofb...

2009-08-26 Thread garagefan

steps followed here:

http://wiki.developers.facebook.com/index.php/PythonPyFacebookTutorial

page with error is here:

http://kennethdavid.net/fbapp/fbsample/

obviously, python.conf is setup correctly to call the correct settings
file. facebook is a link (ln -s) to /pyfacebook/facebook, as per
instructions. facebook IS in the site-packages directory, same as
django

settings as per instructions:

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'facebook.djangofb.FacebookMiddleware',
)


svn for pyfacebook is http://pyfacebook.googlecode.com/svn/trunk/ if
anyone wants to check out the files that come in the folders...r
you can check them out here http://github.com/sciyoshi/pyfacebook/tree/master

running python setup.py install in pyfacebook ends up being an error
looking for config/Makefile saying that it does not exist, infact... i
do not have a config dir in python2.5

any help would be appreciated
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



unicode problem?

2009-08-26 Thread lerner

def output(request):
response = HttpResponse(mimetype='text/csv')
response['Content-Disposition'] = 'attachment; filename=%s' %
'address.csv'
t = loader.get_template('csv.html')
#objs = Address.objects.get_list()
objs = Address.objects.all()
d = []
for o in objs:
d.append((o.name, o.gender, o.telphone, o.mobile, o.room))
c = Context({
'data': d,
})
response.write(t.render(c))
return response
-
I define a funtion to write some chinese into a csv type file,
but i I get this file and open it  in windows, it will appear messy
code.
I know this file is encoded in utf-8 default,  but I find the
response.write module
have no encoding method, because django just has utf-8 encoding.
how to write it encoding "Gb2312" or "GBK" or some others chinese
encoding.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: print PDF on windows

2009-08-26 Thread Sam Lai

2009/8/27 mettwoch :
>
> I'm now using Foxit Reader. Thanks for the tip. The following works
> perfectly in the Django shell and prints the document in
> attachment.file.path to the specified network printer:
>
> p = Popen (['C:\\Program Files\\Foxit Software\\Foxit Reader\\Foxit
> Reader.exe',
>        '/t',
>        attachment.file.path,
>        'SM03\\HPCOMPTOIR0'])
>
> The same code works silently in a Apache / mod_wsgi context but does
> not produce any result on the printer. Do You have any ideas?

Could be a permissions issue - what user is apache running under?

Also, you might want to try enabling the 'allow service to interact
with desktop' option to see if that works. If it does, you might have
to look at another solution or somehow impersonating another user to
do the printing as there are security risks associated with this
option.

>
> Marc
>
> On Aug 26, 1:46 am, Sam Lai  wrote:
>> Use python to call a PDF reader via the command line -
>>
>> http://support.adobe.com/devsup/devsup.nsf/docs/52080.htm
>>
>> http://foxit.vo.llnwd.net/o28/pub/foxit/manual/enu/FoxitReader30_Manu...
>> (see the Command Line section)
>>
>> Depending on the complexity of your PDFs, I'd recommend using Foxit
>> instead; Adobe Reader on windows isn't the most stable especially when
>> it comes to open many PDFs - you might have to manually manage
>> instances to make sure it doesn't eat up all your memory. Foxit Reader
>> however doesn't render all PDFs perfectly, or at least the same way
>> that Adobe Reader does. YMMV though.
>>
>> 2009/8/26 mettwoch :
>>
>>
>>
>> > How do the Django people handle printing directly on Windows? I
>> > remembered abouthttp://timgolden.me.uk/python/win32_how_do_i/print.html,
>> > but unfortunately his method for PDFs only print on the default
>> > printer. I need the server to produce the PDF, save it (works already)
>> > and send it to a specific shared printer on the network. The printer
>> > should be determined from a table that holds 'host' - 'printer' pairs
>> > e.g. ('PC01', '\\PC01\PR01'). The host ('PC01') determined from the
>> > http request allows to choose the right printer ('\\PC01\PR01') from
>> > that table.
>>
>> > Printing should be executed directly when the user has submitted the
>> > request. Any solution that pops up the document locally in a PDFReader
>> > and where the user has to hit the print button is not viable.
>>
>> > Kindly Yours
>> > Marc
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Model Theory 101 - Video Sharing App

2009-08-26 Thread thornomad

Hi - need some suggestions.

I am trying to put together an app that allows users to submit links
to videos at popular video sharing sites (e.g., youtube, vimeo, etc)
-- the links get submitted, data about the video (title, description,
play count, etc) is collected from the respective site and populates
model fields, and the video entry is queued for review.

Caveats: I would like to keep the original "synced" data in its own
field and the "approved" data (as edited) in separate field.  I
imagine that the data first gets brought into the "edit" field, admin
may make changes and save, but the "originating" data will remain
separate and continue to be updated (synced).

This means I need at least

I am stuck, though, on the most appropriate/logical approach to this
app.  Some approaches I've considered.

[1] My first thought is to create base model "Video" (with the main
fields) and then create child models like YoutubeVideo and VimeoVideo
and BlipVideo ... when the user submits a url, would do a regex on it
in the view, and send it through the appropriate child class.  I could
then grab the base Video model in my views (not having to distinguish
the type of video) and use a "leaf" technique (eg,
http://www.djangosnippets.org/snippets/1031/) to run the child's
"sync" or "update" command.  CONS: seems tacky and not easy to build
on.  The leaf technique isn't working when I override the save()
function in leaf models.

[2] Perhaps create only a single model and then create separate
classes/functions to handle the the syncing of data based on the
URLField data ... so, perhaps when Video.update() is called, it would
run the logic then to see what kind of url it has, and how to update
it.  CONS: I thought maybe I could just create a ForeignKey field to a
non-model group of classes with common functions (update, sync,
etc) ... but I am not sure how, or if, I can do that.

[3] Outsourcing.

Hope this makes sense and folks have some feedback about how they
might approach this.  I would like this to be easily expandable -- for
example, add YouTube and Vimeo support to start, and easily add other
sites without having to "hack" it.

I know this is a huge question, but am interested in your "Design
Approach" thoughts ...

Thanks,
Damon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: template tag response None. but why?

2009-08-26 Thread MIL

Hi again. Sorry to disturb you again, but I ran into another issue
related to this template tag I wrote.

I get the following error:

TemplateSyntaxError at /
Caught an exception while rendering: Truncated incorrect DOUBLE value:
'user'


I am not sure what it means exactly, but I beleive the error is
produced by the template tag somehow.

Here is my template tag as it looks now:

@register.tag
def total_num_objects(parser, token):
# {% total_num_objects in viblevraske.User as num_users %}
bits = token.contents.split()
if len(bits) != 5:
raise TemplateSyntaxError, "total_num_objects tag takes exactly 
5
arguments"
if bits[1] != 'in':
raise TemplateSyntaxError, "second argument to 
total_num_objects tag
must be 'in'"
if bits[3] != 'as':
raise TemplateSyntaxError, "fourth argument to 
total_num_objects tag
must be 'as'"
return CountObjectsNode(bits[2], bits[4])


class BlogNode(Node):
def __init__(self, user, varname):
self.user, self.varname = user, varname

def render(self, context):
try:
context[self.varname] = 
Blog.objects.get(user=self.user) # I
beleive this line is causing the trouble
except ObjectDoesNotExist:
return ""



I dont know if its possible to help me with this little information,
but it would be nice :o)

Thanks :o)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Configure Django project in a subdirectory using mod_python. Apps and Admin not found.

2009-08-26 Thread David

HI guys. I was trying to configure my django project in a subdirectory
of the root, but didn't get things working.(Locally it works perfect).
I followed the django official django documentarion to deploy a
project with mod_python. The real problem is that I am getting "Page
not found" errors, whenever I try to go to the admin or any view of my
apps.

Here is my python.conf file located in /etc/httpd/conf.d/ in Fedora 7

LoadModule python_module modules/mod_python.so

SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonOption django.root /mysite
PythonDebug On
PythonPath "['/var/www/vhosts/mysite.com/httpdocs','/var/www/vhosts/
mysite.com/httpdocs/mysite'] + sys.path"

I know /var/www/ is not the best place to put my django project, but I
just want to send a demo of my work in progress to my customer, later
I will change the location.

For example. If I go to www.domain.com/mysite/ I get the index view I
configured in mysite.urls. But I cannot access to my app.urls
(www.domain.com/mysite/app/) and any of the admin.urls.(www.domain.com/
mysite/admin/)

Here is mysite.urls:

urlpatterns = patterns('',

 url(r'^admin/password_reset/$',
'django.contrib.auth.views.password_reset',  name='password_reset'),
(r'^password_reset/done/$',
'django.contrib.auth.views.password_reset_done'),
(r'^reset/(?P[0-9A-Za-z]+)-(?P.+)/$',
'django.contrib.auth.views.password_reset_confirm'),
(r'^reset/done/$',
'django.contrib.auth.views.password_reset_complete'),
(r'^$', 'app.views.index'),
(r'^admin/', include(admin.site.urls)),
(r'^app/', include('mysite.app.urls')),
(r'^photologue/', include('photologue.urls')),
)

I also tried changing admin.site.urls with
''django.contrib.admin.urls' , but it didn't worked. I googled a lot
to solve this problem and read how other developers configure their
django project, but didn't find too much information to deploy django
in a subdirectory. I have the admin enabled in INSTALLED_APPS and the
settings.py is ok.

Please if you have any guide or telling me what I am doing wrong it
will be much appreciated.

Thanks.

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



Re: Strange error while trying to access admin: rendering fails (latest SVN)

2009-08-26 Thread Ryan K

Thanks Karen you've been helping me out recently with debugging a few
things and have been a really great asset.

Cheers,
Ryan Kaskel

On Aug 26, 7:19 pm, Karen Tracey  wrote:
> On Wed, Aug 26, 2009 at 3:33 PM, Ryan K  wrote:
>
> > This is where it says the problem is in the template:
>
> > Template error
>
> > In template /usr/local/lib/python2.6/dist-packages/django/contrib/
> > admin/templates/admin/base.html, error at line 30
> > Caught an exception while rendering: unsupported operand type(s) for
> > +=: 'function' and 'list'
> > 20      
> > 21      
> > 22      
> > 23      {% block branding %}{% endblock %}
> > 24      
> > 25      {% if user.is_authenticated and user.is_staff %}
> > 26      
> > 27      {% trans 'Welcome,' %}
> > 28      {% firstof user.first_name user.username %}.
> > 29      {% block userlinks %}
> > 30      {% url django-admindocs-docroot as docsroot %}   <- ERROR HERE
>
> Double check your url patterns.  The {% url %} tag causes your entire url
> configuration to get processed, and any errors will get reported as being
> due to the {% url %} tag, even though that specific tag is blameless.  The
> problem is likely in something you recently added/changed in your url
> configuration.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: FF3 src error in django admin calendar

2009-08-26 Thread J


I'm getting the same problem. --Using tinymce and FF3.5.

If you find a good fix, I hope you share! Cheers!



Alastair Campbell wrote:
> Ok, I think I got to the bottom of this, it's a combination of TinyMCE
> and Firefox 3.5
>
> Unfortunately my Firebug expertise isn't that great, but with a few
> alert boxes, it is the IF statement in DateTimeShortcuts.js that isn't
> firing:
>
> var scripts = document.getElementsByTagName('script');
> for (var i=0; i   if (scripts[i].src.match(/DateTimeShortcuts/)) {
> var idx = scripts[i].src.indexOf('js/admin/DateTimeShortcuts');
> DateTimeShortcuts.admin_media_prefix = scripts[i].src.substring(0, idx);
> break;
>   }
> }
>
> Adding an alert(scripts[i].src) at the top of the FOR loop stops after
> the 'core.js' file, so that IF statement never fires.
>
> If I add a console.log at that point, the JavaScript runs, sometimes,
> but sometimes stops after core.js.
>
> TinyMCE is two files in the source code, but then it imports another
> 10 (ish) for the pluggins.
>
> It *seems* like Firefox gives up on the script loop when there are so
> many to go through.
>
> My solution has been to move the TinyMCE source files to after the
> admin JS, which works for me, but is somewhat annoying.
>
> I'll see if I can put a test case together, it might be worth adding a
> bug report somewhere, although I'm not sure if it's for TinyMCE or
> Firefox?!?
>
> Thanks,
>
> -Alastair
>
> >
>
>   


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



Re: Strange error while trying to access admin: rendering fails (latest SVN)

2009-08-26 Thread Karen Tracey
On Wed, Aug 26, 2009 at 3:33 PM, Ryan K  wrote:

>
> This is where it says the problem is in the template:
>
> Template error
>
> In template /usr/local/lib/python2.6/dist-packages/django/contrib/
> admin/templates/admin/base.html, error at line 30
> Caught an exception while rendering: unsupported operand type(s) for
> +=: 'function' and 'list'
> 20  
> 21  
> 22  
> 23  {% block branding %}{% endblock %}
> 24  
> 25  {% if user.is_authenticated and user.is_staff %}
> 26  
> 27  {% trans 'Welcome,' %}
> 28  {% firstof user.first_name user.username %}.
> 29  {% block userlinks %}
> 30  {% url django-admindocs-docroot as docsroot %}   <- ERROR HERE
>

Double check your url patterns.  The {% url %} tag causes your entire url
configuration to get processed, and any errors will get reported as being
due to the {% url %} tag, even though that specific tag is blameless.  The
problem is likely in something you recently added/changed in your url
configuration.

Karen

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



Re: Strange error while trying to access admin: rendering fails (latest SVN)

2009-08-26 Thread Ryan K

State in admin rendering process when error occurred:

/usr/local/lib/python2.6/dist-packages/django/template/debug.py in
render_node

  74. e.source = node.source
  75. raise
  76. except Exception, e:
  77. from sys import exc_info
  78. wrapped = TemplateSyntaxError(u'Caught an exception while
rendering: %s' % force_unicode(e, errors='replace'))
  79. wrapped.source = node.source
  80. wrapped.exc_info = exc_info()

  81. raise wrapped ...

  82. return result
  83.
  84. class DebugVariableNode(VariableNode):
  85. def render(self, context):
  86. try:
  87. output = force_unicode(self.filter_expression.resolve(context))

▼ Local vars
VariableValue
context
[{'block': ,
, , , ,
, , , ,
,  / '>, , , , ,
,  '>]>}, {'root_path': None, 'app_list': [{'app_url':
'auth/', 'models': [{'perms': {'add': True, 'change': True, 'delete':
True}, 'admin_url': 'auth/group/', 'name':
}, {'perms':
{'add': True, 'change': True, 'delete': True}, 'admin_url': 'auth/
user/', 'name': }], 'has_module_perms': True, 'name': 'Auth'}, {'app_url':
'sites/', 'models': [{'perms': {'add': True, 'change': True, 'delete':
True}, 'admin_url': 'sites/site/', 'name':
}],
'has_module_perms': True, 'name': 'Sites'}, {'app_url':
'staticpages/', 'models': [{'perms': {'add': True, 'change': True,
'delete': True}, 'admin_url': 'staticpages/link/', 'name': u'Links'},
{'perms': {'add': True, 'change': True, 'delete': True}, 'admin_url':
'staticpages/menu/', 'name': u'Menus'}, {'perms': {'add': True,
'change': True, 'delete': True}, 'admin_url': 'staticpages/
staticpage/', 'name': u'Static pages'}], 'has_module_perms': True,
'name': 'Staticpages'}], 'title': u'Site administration'},
{'MEDIA_URL': 'http://localhost/static/sccom'}, {'perms':
,
'messages': [], 'user': }, {}]
e
TypeError("unsupported operand type(s) for +=: 'function' and
'list'",)
exc_info

node

self
[, , , , ,
, , , ,
,  / '>, , , , ,
,  '>]
wrapped
TemplateSyntaxError(u"Caught an exception while rendering: unsupported
operand type(s) for +=: 'function' and 'list'",)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Executing a queryset with MySQL's SSCursor cursor class

2009-08-26 Thread Sam Tregar
Hello all.  I'm wondering how I can tell Django to use
MySQLdb.cursors.SSCursor instead of the default MySQLdb.cursors.Cursor.  The
critical difference here is that SSCursor uses mysql_use_result and streams
data from the server rather than loading it all into memory at once.
Anybody know if that's possible?  My searches of the docs and code haven't
turned up much yet.

Thanks,
-sam

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



makemessages clutters project locale files with strings from already translated apps

2009-08-26 Thread Alex Rades

Hi,
I have many applications in my project. I've carefully translated them
launching manage.py makemessages from within each application
directory, so that each app has its own locale/ directory with
translations.

When it comes to translating project-level strings, and I launch
makemessages from the project top directory, the project .po files are
cluttered with translation strings coming from apps which are already
translated and have their own locale directory.

Is there a way to avoid this?

Thanks

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



Re: Ajax TreeList with Django

2009-08-26 Thread Peter Herndon

On 08/26/2009 03:52 PM, Dirso wrote:
> I'd like to create a dynamic treelist (using Ajax, Django and
> Postgres). Did anyone know tutorial ou code piece that could do this
> magic?
>
>
Hi Dirso,

I've done something similar to what you are describing, using jQuery, 
the dynatree jQuery plugin, and some reasonable Django code.  The code 
is available at http://bitbucket.org/tpherndon/django-fedora/, and 
you'll specifically be interested in the djadora/views/browse.py and the 
djadora/templates/fedora/browse_dynatree.html and image_fragment.html files.

I implemented the code as part of a special-purpose web app for 
interfacing with a Java repository system, and the code is far from 
clean and pretty, but it should give you a decent example of something 
that is currently in production.

The way I approached it was to write a couple of views that are designed 
to handle the jQuery dynatree Ajax requests.  Dynatree does the work on 
building the tree in HTML, my views provide the data, and the models 
each have a "parent" attribute that allows the views to figure out how 
to select children for each tree level.

In retrospect, I'd do my best to reuse django-mptt, django-treebeard, or 
similar.  They aren't a direct fit for my use case, since I have 
different models that can contain each other, and from what I've seen 
they are geared to handle only a single model class pointing to itself, 
but I would follow their approach and steal code like crazy.  :)  Or, if 
I had just one kind of model, I'd just add enough Ajax views to power 
dynatree.

---Peter

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: template tag response None. but why?

2009-08-26 Thread MIL

Sorry :o)

My fault. I was testing on the wrong site :o) It works perfect with
this:

def render(self, context):
try:
context[self.varname] = Blog.objects.get(user=self.user)
except ObjectDoesNotExist:
return ""


Thanks alot for your help :o)

Have a nice night

On 26 Aug., 14:58, Daniel Roseman  wrote:
> On Aug 26, 1:51 pm, MIL  wrote:
>
> > Okay. Seems logic. But Im not sure what I should do.
>
> > So what would you do?
>
> > Thanks
>
> Add return "" at the end of your render() method.
> --
> DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Display user and date in change_list

2009-08-26 Thread Sandra Django
Hi, I want display in change_list view, user who added an object and date. I
did that:
-- models.py ---
class One(models.Model):
..
def user(self):
return self.user.username

def date(self):
return self.date

-- admin.py ---
class OneAdmin(admin.ModelAdmin):
list_display = ['name', 'user', 'date']

But both functions returns (None). Why I can do it?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: template tag response None. but why?

2009-08-26 Thread MIL

Hi again. I tried that. But it doesnt change anything.

Here is what I tried:

class BlogNode(Node):
def __init__(self, user, varname):
self.user, self.varname = user, varname

def render(self, context):
try:
context[self.varname] = Blog.objects.get(user=self.user)
except ObjectDoesNotExist:
return ""

and I tried this as well:

def render(self, context):
try:
context[self.varname] = Blog.objects.get(user=self.user)
except ObjectDoesNotExist:
context[self.varname] = None
return ""




On 26 Aug., 14:58, Daniel Roseman  wrote:
> On Aug 26, 1:51 pm, MIL  wrote:
>
> > Okay. Seems logic. But Im not sure what I should do.
>
> > So what would you do?
>
> > Thanks
>
> Add return "" at the end of your render() method.
> --
> DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



admin javascript not working

2009-08-26 Thread Joseph Brown
I'm having trouble getting the admin javascript to function in production
(debian/apache2).  I've tried creating a sybolic link in the django root
folder, and using a location Alias in apache, but the result is the same.
Admin css files load, images load, and you can view the js files, but they
do not function.

In particular, the calendar date and time images do not render on date/time
fields and my prepopulate fields don't render (this all works in
development)

settings.py:
ADMIN_MEDIA_PREFIX = '/media/'

apache2 default:
# tried this with and with out a symbolic link in the django site's root
#Alias /media
/usr/share/python-support/python-django/django/contrib/admin/media

SetHandler None


You can also *view* all the applicable js files .. they just don't do
anything:

http://.../admin/jsi18n/>">
http://.../media/js/core.js>">
http://.../media/js/admin/RelatedObjectLookups.js>">
http://.../media/js/urlify.js>">

http://.../media/js/calendar.js>">
http://.../media/js/admin/DateTimeShortcuts.js>">

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



admin js not executing

2009-08-26 Thread Joseph Brown
I'm having trouble getting the admin javascript to function in production
(debian/apache2).  I've tried creating a sybolic link in the django root
folder, and using a location Alias in apache, but the result is the same.
Admin css files load, images load, and you can view the js files, but they
do not function.

In particular, the calendar date and time images do not render on date/time
fields and my prepopulate fields don't render (this all works in
development)

settings.py:
ADMIN_MEDIA_PREFIX = '/media/'

apache2 default:
# tried this with and with out a symbolic link in the django site's root

#Alias /media
/usr/share/python-support/python-django/django/contrib/admin/media

SetHandler None



You can also *view* all the applicable js files .. they just don't do
anything:

http://testing.vori.us/admin/jsi18n/>">
http://testing.vori.us/media/js/core.js>">
http://testing.vori.us/media/js/admin/RelatedObjectLookups.js>">
http://testing.vori.us/media/js/urlify.js>">

http://testing.vori.us/media/js/calendar.js>">
http://testing.vori.us/media/js/admin/DateTimeShortcuts.js>">

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 DB tables for models based on object relations.

2009-08-26 Thread Javier Guerra

On Wed, Aug 26, 2009 at 2:20 PM, zayatzz wrote:
> Correct me, if im wrong, but as i understand that the
> more rows there is in a table, the slower aquiring stuff from it will
> be, right?

wrong

any RDBM worth its salt can go to tens or hundreds of millions before
you feel it.  granted, of course, that you use appropriate indexes.

Django will automatically add the most important indexes for you.

-- 
Javier

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Ajax TreeList with Django

2009-08-26 Thread Dirso

Hi,

I'd like to create a dynamic treelist (using Ajax, Django and
Postgres). Did anyone know tutorial ou code piece that could do this
magic?

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



Re: Strange error while trying to access admin: rendering fails (latest SVN)

2009-08-26 Thread Ryan K

This is where it says the problem is in the template:

Template error

In template /usr/local/lib/python2.6/dist-packages/django/contrib/
admin/templates/admin/base.html, error at line 30
Caught an exception while rendering: unsupported operand type(s) for
+=: 'function' and 'list'
20  
21  
22  
23  {% block branding %}{% endblock %}
24  
25  {% if user.is_authenticated and user.is_staff %}
26  
27  {% trans 'Welcome,' %}
28  {% firstof user.first_name user.username %}.
29  {% block userlinks %}
30  {% url django-admindocs-docroot as docsroot %}   <- ERROR HERE
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 models/ sqlalchemy

2009-08-26 Thread drakkan

You can:

1) redefine your sa models in django models.py
2) use sqlalchemy-migrate for database migration and initial data
population, I never used json for initial data with migrate

drakkan

On 26 Ago, 17:29, ajay  wrote:
> HI,
>     I have used sqlalchemy for database model creation instead django
> default ORM.
>     Now i need to use fixture to load the initial data as i run test
> cases.
>     This is error message "DeserializationError: Invalid model
> identifier:"
>     The models are not defined in models.py file as i am using
> alchemy .
>     Is there any way i can use fixture to load initial data in my
> database .
>
>     my structure of app look like this
>          models.py
>          views.py
>           alchemy.py     - database models are defined here .
>           tests.py
>
>    I am using json as serialized data.
>
> With Thanks
> Vijay
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Different DB tables for models based on object relations.

2009-08-26 Thread zayatzz

Hello

I'm just as big django newbie as im mysql (or any other sql, for that
matter) newbie. Correct me, if im wrong, but as i understand that the
more rows there is in a table, the slower aquiring stuff from it will
be, right? Since i have an idea, that (if its successful) will
eventually hold hundreds of thousands if not millions of rows of
similar information in one table. For that reason i think its better
to separate this info somehow and as i understand, it is possible to
create new database tables that hold only information related to
certain object - for example to hold only comments to one specific
article in one database table, comments of another article in another
and etc...

Can anyone give me an example of how to do it with django or at lest
point me towards where to find that kind of example. The problem is,
that as im not native english speaker nor very good with sql, i just
dont know what i should google for to find that kind of information.

Thanks!
Alan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Strange error while trying to access admin: rendering fails (latest SVN)

2009-08-26 Thread Ryan K

I am getting a very strange error and I can't tell if it is coming
from my code or Django's code. I have not modified the templates of
the admin interface at all. Below is the error. I am trying to access
http://localhost:8080/. This error still occurrs if I remove all apps
from the install apps list and only leave contrib apps.



TemplateSyntaxError at /admin/

Caught an exception while rendering: unsupported operand type(s) for
+=: 'function' and 'list'

Request Method: GET
Request URL:http://localhost:8000/admin/
Exception Type: TemplateSyntaxError
Exception Value:

Caught an exception while rendering: unsupported operand type(s) for
+=: 'function' and 'list'

Exception Location: /usr/local/lib/python2.6/dist-packages/django/
template/debug.py in render_node, line 81
Python Executable:  /usr/bin/python
Python Version: 2.6.2

-

Cheers,
Ryan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Google Group Listserv integration to Django Admin

2009-08-26 Thread Carl Feldhaus

Hey Guys, you think there is a way to integrate a ListServ from Google
Group into the admin of django?

I have a neighborhood website and we are working on the member
directory, paypal integration for dues but the only thing outside of
the admin is this Listserv and it would be amazing to get it
integrated so its all in one so I dont have to work on keeping two
section (website/listserv) up todate.

Thoughts or suggestions?

Carl

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 templates have lexical scope!?

2009-08-26 Thread David De La Harpe Golden

stevedegrace wrote:

> Variables you bind within the template itself don't seem to behave
> this way.
> 
> Instead they are scoped. If a variable is bound inside a block tag,
> the binding is only valid within that block. I didn't do enough
> experiments yet to tell you how it behaves with nested blocks.
> 

I rely on scoping for my templated menus -  I do the following in child
templates to mark a menu item current -

In projects_base.html.djt, say:

{% extends "base.html.djt" %}

{% block menubar0_projects %}
{% with 1 as current %}
{{ block.super }}
{% endwith %}
{% endblock %}

So,it's effectively like the content of the menubar0_projects block in
base.html.djt getting a variable "current" defined. This allows me to
keep all my menu definitions in one template, rather than just
overriding the block wholesale.

I'm a django newbie, maybe there was some other way to do it,
but it works fine.






--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Return custom view depending on user

2009-08-26 Thread James Bennett

On Wed, Aug 26, 2009 at 9:43 AM, Sandra Django wrote:
> I have a group, where all users that belongs to this groups only can access
> to a form, and I want that when anyone is logged, go directly to that form,
> not to Django view by default. How I can do it? Depending on the group,
> return that form.

Wrap the view in a decorator that does the redirect?


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: print PDF on windows

2009-08-26 Thread mettwoch

I'm now using Foxit Reader. Thanks for the tip. The following works
perfectly in the Django shell and prints the document in
attachment.file.path to the specified network printer:

p = Popen (['C:\\Program Files\\Foxit Software\\Foxit Reader\\Foxit
Reader.exe',
'/t',
attachment.file.path,
'SM03\\HPCOMPTOIR0'])

The same code works silently in a Apache / mod_wsgi context but does
not produce any result on the printer. Do You have any ideas?

Marc

On Aug 26, 1:46 am, Sam Lai  wrote:
> Use python to call a PDF reader via the command line -
>
> http://support.adobe.com/devsup/devsup.nsf/docs/52080.htm
>
> http://foxit.vo.llnwd.net/o28/pub/foxit/manual/enu/FoxitReader30_Manu...
> (see the Command Line section)
>
> Depending on the complexity of your PDFs, I'd recommend using Foxit
> instead; Adobe Reader on windows isn't the most stable especially when
> it comes to open many PDFs - you might have to manually manage
> instances to make sure it doesn't eat up all your memory. Foxit Reader
> however doesn't render all PDFs perfectly, or at least the same way
> that Adobe Reader does. YMMV though.
>
> 2009/8/26 mettwoch :
>
>
>
> > How do the Django people handle printing directly on Windows? I
> > remembered abouthttp://timgolden.me.uk/python/win32_how_do_i/print.html,
> > but unfortunately his method for PDFs only print on the default
> > printer. I need the server to produce the PDF, save it (works already)
> > and send it to a specific shared printer on the network. The printer
> > should be determined from a table that holds 'host' - 'printer' pairs
> > e.g. ('PC01', '\\PC01\PR01'). The host ('PC01') determined from the
> > http request allows to choose the right printer ('\\PC01\PR01') from
> > that table.
>
> > Printing should be executed directly when the user has submitted the
> > request. Any solution that pops up the document locally in a PDFReader
> > and where the user has to hit the print button is not viable.
>
> > Kindly Yours
> > Marc
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 for views

2009-08-26 Thread Daniel Roseman

On Aug 26, 4:14 pm, gentlestone  wrote:
> I'm looking for a support for viewing models in templates.
>
> Forms is a nice support but it is made for editing objects, not for
> viewing objects. I found some attemps on the internet, like using
> forms with ReadOnlyWidgets, but I thing it is not the way.
>
> Forms are great, because a template-designer can use the general
> as_table() and don't have to know too much about the model. And also
> the dependency between the model and templates are isolated via Forms.
> And also it is good when a template-designer can iterate through form
> fields or directly use fileds like form.theField attribute.
>
> Unfortunately there is no such support for viewing model instances in
> templates. Yes of course, there is a possibility use the "dot" like
> instance.theAttribute in the template, but this means strong template
> dependency on models and also the template designer can't use _meta
> informations like verbose names and so. Yes, I can make for my models
> some methods like constructTemplateDictionaryForXyView, feed the
> dictionary with model attributes and models opts, but what I am
> looking for are support classes like Form and ModelForm for
> constructing dictionares for HTML rendering from models metamodels.
>
> I am ready to write such support for myself, but it is a long task and
> propably i am thinking in wrong way, because nobody has written it yet.

You might want to look at django.contrib.databrowse - it sounds like
it does what you want. See:
http://docs.djangoproject.com/en/dev/ref/contrib/databrowse/
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 issue with tinymce and MEDIA_ROOT

2009-08-26 Thread Joost Cassee

Hi Wendy, sorry for the delay.


On 23 aug, 04:43, zignorp  wrote:

> Then in the admin.py file for films, which lives inside of mysite, I
> added the media subclass, which I was told to do by some other helpful
> person on the list, I used the absolute path, on my mac, which is the
> one that shows in the browser:

When you use the HTMLField model field you don't need any reference to
TinyMCE in your forms or views, apart from rendering the form media.
For example:

... {{ form.media }} ... 

The admin interface already does this automatically. Django should now
add the Javascript imports for TinyMCE.

> tiny_mce/tiny_mce.js HTTP/1.1" 404 2149
> [22/Aug/2009 19:24:25] "GET /Users/wendy/mycode/static_media/js/
> tiny_mce/textareas.js HTTP/1.1" 404 2152
> [22/Aug/2009 19:24:25] "GET /static_media/js/tiny_mce/tiny_mce.js HTTP/
> 1.1" 404 2092

It seems you have also added a reference to the django-tinymce view?
Anyway it is trying to load TinyMCE from three places. Ironically, all
three URLs point to the wrong location: error 404 means 'not found'.

I'm not sure how you have set-up serving static files. Maybe you have
forgotten to add something like this to your urls.py:

# Serve static files on development server
if settings.DEBUG:
urlpatterns += patterns('',
(r'^static/(?P.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
)

> and in firebug, it just tells me tinyMCE is not defined on the init
> call:

That would make sense.

> But I do see these urls in the browser:
> /Users/wendy/mycode/static_media/js/tiny_mce/textareas.js
> which just contains:
> tinyMCE.init({
>         mode : "textareas",
>         theme : "simple"
>
> });

Right, that's correct. That view only configures TinyMCE to convert
all textarea elements.

> I'm not quite sure why I'm seeing a 404 after these absolute urls when
> I can see them in the browser, and not sure how I can test the
> relative urls.

You can try these URL in your browser:
/Users/wendy/mycode/static_media/js/tiny_mce/textareas.js
/static_media/js/tiny_mce/tiny_mce.js

Good luck!


Regards,

Joost
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



django models/ sqlalchemy

2009-08-26 Thread ajay

HI,
I have used sqlalchemy for database model creation instead django
default ORM.
Now i need to use fixture to load the initial data as i run test
cases.
This is error message "DeserializationError: Invalid model
identifier:"
The models are not defined in models.py file as i am using
alchemy .
Is there any way i can use fixture to load initial data in my
database .

my structure of app look like this
 models.py
 views.py
  alchemy.py - database models are defined here .
  tests.py


   I am using json as serialized data.

With Thanks
Vijay
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 HTTP request processing?

2009-08-26 Thread John

Thanks but it seems that in this example (if I have understood
correctly) it loads the entire request into memory. I need to convert
stuff on the fly using streams on both input and output as both may be
huge. I have a number of stages of transformation and it wouldn't take
very many requests to bring the machine to a grinding halt if
everything is being done in memory at each stage.

I have decided to do it in java with jetty, servlets and embedding
jython (which bizarrely for large datasets seems to be more efficient,
standard c python perfomance plunges after certain in memory data
sizes - I believe its the GC strategy not scaling well from what I
have heard).

On 25 Aug, 21:41, Peter Bengtsson  wrote:
> Here's an example:http://www.djangosnippets.org/snippets/1322/
>
> On Aug 25, 5:43 pm, John  wrote:
>
> > > Isn't it just
> > > request.raw_post_data
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Forms for views

2009-08-26 Thread gentlestone

I'm looking for a support for viewing models in templates.

Forms is a nice support but it is made for editing objects, not for
viewing objects. I found some attemps on the internet, like using
forms with ReadOnlyWidgets, but I thing it is not the way.

Forms are great, because a template-designer can use the general
as_table() and don't have to know too much about the model. And also
the dependency between the model and templates are isolated via Forms.
And also it is good when a template-designer can iterate through form
fields or directly use fileds like form.theField attribute.

Unfortunately there is no such support for viewing model instances in
templates. Yes of course, there is a possibility use the "dot" like
instance.theAttribute in the template, but this means strong template
dependency on models and also the template designer can't use _meta
informations like verbose names and so. Yes, I can make for my models
some methods like constructTemplateDictionaryForXyView, feed the
dictionary with model attributes and models opts, but what I am
looking for are support classes like Form and ModelForm for
constructing dictionares for HTML rendering from models metamodels.

I am ready to write such support for myself, but it is a long task and
propably i am thinking in wrong way, because nobody has written it yet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Return custom view depending on user

2009-08-26 Thread Sandra Django
Hi friends, another doubt...
I have a group, where all users that belongs to this groups only can access
to a form, and I want that when anyone is logged, go directly to that form,
not to Django view by default. How I can do it? Depending on the group,
return that form.
Thanks for any help,
Sandra

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: json serialization error on arrays

2009-08-26 Thread John

When I have arrays of 100,000+ the performance of lists gets
unacceptable in standard c python. That's why arrays exist in python!

After doing research and testing, I have decided to rebuild the
project in java with embedded jython. For some bizarre reason jython
performance increases with large datasets in memory where standard c
python plunges (From what I hear its that the GC strategy doesn't
scale).

I also can't use django at having to read and convert everything in
memory etc is going to be too bad a hit. Shame, as I like django but
it won't do for this project as there are many assumptions that don't
fit my requirements - I would have to hack it to death to get what I
want and that is a waste of time.

Everything is going to have to be stream based (conversions happening
on the fly) and use efficient use of memory internally for arrays etc.
I now will be using jetty, servlets, jython as I can optimise
everything easily for huge data sets. There is a maximum permissible
time lag for each request.

On 25 Aug, 21:38, Peter Bengtsson  wrote:
> what's wrong with turning it into a list? If you gzip it it won't be
> that big.
>
> On Aug 25, 5:16 pm, John Baker  wrote:
>
> > I need to json serialize some very large objects which include large
> > arrays. How can I do this in django? The arrays will be very big and
> > heavily processed before so need to use efficient array storage.
>
> > Testing with arrays I get..
>
> > TypeError at /zeros/
>
> > array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]) is not JSON
> > serializable
>
> > What would you recommend I do to support arrays?
>
> > Thanks in advance,
> > John
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to cache django javascript message file ('/jsi18n/') with apache (production setup)

2009-08-26 Thread wtanaka.com

This is a wrapper function and some instructions for enabling caching
of the /jsi18n/ javascript string catalog: http://wtanaka.com/django/jsi18ncache

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 running the database shell through cmd lime

2009-08-26 Thread Arul

Thanks a lot Karen.

I did the same steps that you followed, it didnt work for me.
But when i tried in another system it works fine.
Probably there is some problem with my system settings.

Thanks,
Arul
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Newbie Django project, suggestions for code improvement?

2009-08-26 Thread Matt Conrad

I wrote a little concentration game in Django and put it up on Google
App Engine:

http://matt-scratch.appspot.com/

I'm sure there are some awkward places in the code where I could
leverage Django better.  If anyone is curious and would like to
comment or make suggestions, the source code (Django/SQLite version)
is here:

http://matt-scratch.appspot.com/downloads/ccsite-1-01.zip

If you download it, you'll want to visit /init_colors/ first thing
after running syncdb.  The game won't be playable until the colors are
initialized.  You'll also need to customize settings.py.

The part of the project that bugs me the most is the URL routing.  It
seems awkward to have a matching URL for each view.  I bet there is a
tidier way.  There may be other obvious Djangonic improvements I don't
see yet.

Any suggestions appreciated.

Matt

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 running the database shell through cmd lime

2009-08-26 Thread Karen Tracey
On Wed, Aug 26, 2009 at 9:11 AM, Arul  wrote:

>
> I tried with reopening the command prompt after setting the path via
> GUI and
> also I tried with setting the path in the active command prompt, but
> it didnt work.
> Anyway if i give "sqlite3" in the command prompt, it gives me the
> sqlite prompt.
>
>
I don't know what to tell you.  Adding the path to sqlite3 works for me:

D:\u\kmt\software\web\playground>sqlite3
'sqlite3' is not recognized as an internal or external command,
operable program or batch file.

D:\u\kmt\software\web\playground>python manage.py dbshell
'sqlite3' is not recognized as an internal or external command,
operable program or batch file.

D:\u\kmt\software\web\playground>dir \tmp\software\sqlite3.exe
 Volume in drive D has no label.
 Volume Serial Number is 2163-D1C1

 Directory of D:\tmp\software

09/22/2008  06:46a 491,908 sqlite3.exe
   1 File(s)491,908 bytes
   0 Dir(s)   1,382,174,720 bytes free

D:\u\kmt\software\web\playground>set path=d:\tmp\software;%path%

D:\u\kmt\software\web\playground>sqlite3
SQLite version 3.6.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .quit

D:\u\kmt\software\web\playground>python manage.py dbshell
SQLite version 3.6.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .quit

Karen

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



Re: Problem with running the database shell through cmd lime

2009-08-26 Thread Arul

On Aug 26, 5:08 pm, Karen Tracey  wrote:

> That's how to do it.  Note that changing the system path via the GUI does
> not affect already-open command prompts so you will need to open a new
> command prompt or manually do the path update in the command prompt you are
> using also.


I tried with reopening the command prompt after setting the path via
GUI and
also I tried with setting the path in the active command prompt, but
it didnt work.
Anyway if i give "sqlite3" in the command prompt, it gives me the
sqlite prompt.


Thanks,
Arul
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Admin search error (using auto complete FK widget)

2009-08-26 Thread maco

Jannis Liedel writes about a great widget for FK fields
http://jannisleidel.com/2008/11/autocomplete-form-widget-foreignkey-model-fields/

I manged to get it to work on one site, but not on others.

Widget uses admin search functionality through url:
/admin/app/model/search/?
q=foo_fields=my_field_label=my_app_name=my_model

However, on some sites using same code and on the same server (running
django 1.1 and python 2.5) I get error:

invalid literal for int() with base 10: 'search'
Exception Location: /Library/Python/2.5/site-packages/django/db/models/
fields/__init__.py in get_db_prep_value, line 361
Python Executable: /System/Library/Frameworks/Python.framework/
Versions/2.5/Resources/Python.app/Contents/MacOS/Python
Python Version: 2.5.1

I tried several different aps, models and fields and got same result.
I googled about the error and all could get was that django can't
search on date fields that have None as default value, but that is not
the case for me here.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Coltrane application not appearing on the admin index page

2009-08-26 Thread Daniel Roseman

On Aug 26, 12:11 pm, Gath  wrote:
> Guys,
>
> Am going through the practical django book and am trying the weblog
> application in Chapter 4, but when i go to test the application on my
> cms application (that i created from the same book, from Chapter 2 &
> 3) "coltrane" application does not appear on the admin index page as
> the book suggest.
>
> This is my INSTALLED_APPS in the settings.py in the cms application;
>
> INSTALLED_APPS = (
>     'django.contrib.auth',
>     'django.contrib.contenttypes',
>     'django.contrib.sessions',
>     'django.contrib.sites',
>     'django.contrib.admin',
>     'django.contrib.flatpages',
>     'cms.search',
>     'coltrane',
> )
>
> My admin.py file in the coltrane application looks like this;
>
> from django.contrib import admin
> from coltrane.models import Category
>
> class CategoryAdmin(admin.ModelAdmin):
>         pass
>
> admin.site.register(Category, CategoryAdmin)
>
> Please note when i run the syncdb, the tables are created properly.
>
> Am using Django 1.1
> Python 2.6
> Windows Vista.
>
> What am i missing out.
>
> Gath

Do you have edit/add privileges to the category model? If not, it
won't appear on the index.
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Adding tests to a patch

2009-08-26 Thread Russell Keith-Magee

On Wed, Aug 26, 2009 at 6:49 PM, Peter2108 wrote:
>
> I'm trying to help fix but #6138. I've done a patch for the code and a
> separate test.py module. But someone ('Alex') added a request to
> "Please put the tests in the same diff as the patch itself, it is
> possible to use svn add locally". I'm at a loss here I'm afraid. The
> only way I know to generate a single diff that included a patch to
> trunk/django/forms/forms.py  and to the trunk/tests/regressiontests/
> forms/forms.py is to set up subversion in the 'trunk' folder. But then
> can one apply the patch if one does not have all that stuff?

I'm not sure I understand the source of your confusion.

The Django install instructions indicate that if you want to use the
Django development code, you should have a checkout of the 'trunk'
director i.e.,:

svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk

In this example, django-trunk is a complete checkout of the Django
code, and it is the directory against which you should be generating
your diff.

> Also where should one place this test - in  trunk/tests/
> regressiontests/forms/forms.py or in  trunk/tests/regressiontests/
> forms/error_messages.py or in a separate module even?

Add the patch wherever seems appropriate. Look around for a similar
tests, and put your tests alongside those. If there really is nothing
similar, add a new test module.

However, don't get too hung up on exactly where to put the tests. If
the location you pick isn't ideal, it will get moved by the committer
when your patch is added to trunk. As a patch contributor, the most
important step is to write the test in the first place, and to put it
somewhere so that it can be executed to demonstrate the validity of
your patch.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: template tag response None. but why?

2009-08-26 Thread Daniel Roseman

On Aug 26, 1:51 pm, MIL  wrote:
> Okay. Seems logic. But Im not sure what I should do.
>
> So what would you do?
>
> Thanks

Add return "" at the end of your render() method.
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: template tag response None. but why?

2009-08-26 Thread MIL

Okay. Seems logic. But Im not sure what I should do.

So what would you do?

Thanks

On 26 Aug., 12:09, Daniel Roseman  wrote:
> On Aug 26, 12:44 am, MIL  wrote:
>
>
>
> > Hi guys :o)
>
> > Im attempting to create a template tag but I get a strange response.
> > it returns "None" where I put the {% if blog_detail %} tag
>
> > Here is my template tag
>
> > class BlogNode(Node):
> >         def __init__(self, user, varname):
> >                 self.user, self.varname = user, varname
>
> >         def render(self, context):
> >                 try:
> >                         context[self.varname] = 
> > Blog.objects.get(user=self.user)
> >                 except ObjectDoesNotExist:
> >                         context[self.varname] = False
>
> > @register.tag
> > def get_blog(parser, token):
> >         # {% get_blog for user_object as object_detail %}
> >         # {% if blog_detail %} etc...
> >         bits = token.contents.split()
> >         if len(bits) != 5:
> >                 raise TemplateSyntaxError, "get_blog tag takes exactly five
> > arguments"
> >         if bits[1] != 'for':
> >                 raise TemplateSyntaxError, "second argument to get_blog tag 
> > must be
> > 'for'"
> >         if bits[3] != 'as':
> >                 raise TemplateSyntaxError, "third argument to get_blog tag 
> > must be
> > 'as'"
> >         return BlogNode(bits[2], bits[4])
>
> > Why does it response with a "None" message?
>
> > Thanks :o)
>
> Your render() method should return something, even if it's a blank
> string. The default value returned by a function in Python is None, so
> the template is simply showing this (converted into a string, ie
> 'None').
> --
> DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Adding tests to a patch

2009-08-26 Thread Peter2108

Many thanks Karen. The key was "run svn diff from the top-level trunk
directory"
in the docs. Sorry, I should have re-read them!

Should be OK now,

Peter

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Adding tests to a patch

2009-08-26 Thread Karen Tracey
On Wed, Aug 26, 2009 at 6:49 AM, Peter2108  wrote:

>
> I'm trying to help fix but #6138. I've done a patch for the code and a
> separate test.py module. But someone ('Alex') added a request to
> "Please put the tests in the same diff as the patch itself, it is
> possible to use svn add locally". I'm at a loss here I'm afraid. The
> only way I know to generate a single diff that included a patch to
> trunk/django/forms/forms.py  and to the trunk/tests/regressiontests/
> forms/forms.py is to set up subversion in the 'trunk' folder. But then
> can one apply the patch if one does not have all that stuff?
>

I don't really understand what you are asking.  I don't know who the "one"
is in your last question nor what "all that stuff" is.

Yes, you are expected to generate diffs from the root of trunk, as requested
in the third bullet here:

http://docs.djangoproject.com/en/dev/internals/contributing/#patch-style

Anyone regularly contributing or using patches from trac will generally be
using an svn checkout of trunk, or a git (or some other DVCS) clone of the
same, so I don't understand what the problem is you are concerned with here?

A committer when considering the patch will expect to be able to apply it to
the root of the trunk.  If you don't generate diffs from the root, or post
multiple diffs to a ticket that need all be applied, then the committer has
to figure out which all pieces are supposed to go together and where to put
each one.  This is much more likely to result in errors than a single diff
generated from the root of the trunk, thus we request single diffs generated
from the root of the trunk.


>
> Also where should one place this test - in  trunk/tests/
> regressiontests/forms/forms.py or in  trunk/tests/regressiontests/
> forms/error_messages.py or in a separate module even?
>

Whichever seems like the best match.  Without looking at the ticket or
existing tests too closely, I'd guess the extending the existing
error_messages test would be fine.

Karen

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



Authentication integration with Netegrity SiteMinder?

2009-08-26 Thread Adam Stein

Using Django v1.1/mod_wgsi v2.5.

I'm forced to use CA's Netegrity SiteMinder to authenticate users.  I
couldn't find anything regardng integration with Django (so that Django
can provide authorization).  I have integrated Django authentication
with an LDAP server, but I need to use SiteMinder instead because of
corporate policy.

Figure I would ask to see if anybody has already done this before I try
to figure this out from scratch.  SiteMinder gives me the login name in
an environment variable which I can then tie into the Django user
system.
-- 
Adam Stein @ Xerox Corporation   Email: a...@eng.mc.xerox.com

Disclaimer: Any/All views expressed
here have been proven to be my own.  [http://www.csh.rit.edu/~adam/]


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 running the database shell through cmd lime

2009-08-26 Thread Karen Tracey
On Wed, Aug 26, 2009 at 5:47 AM, Arul  wrote:

>
> But i need to use it with the django using the "manage.pt dbshell"
> command.
> I tried adding the sqlite.exe path to the windows system path. It
> didnt work.
>

That's how to do it.  Note that changing the system path via the GUI does
not affect already-open command prompts so you will need to open a new
command prompt or manually do the path update in the command prompt you are
using also.

Karen

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



Re: annotate() type coercion

2009-08-26 Thread Georg Göttlich

Hello Karen,

thanx a lot for the information and sorry for being so unspecific.
Sounds like my problem. I'm using python 2.5 and sqlite3 (in my dev
environment). So I'll try to upgrade sqlite.

Cheers,
Georg

On 26 Aug., 14:05, Karen Tracey  wrote:
> 2009/8/26 Georg Göttlich 
>
>
>
> > Hello everybody,
>
> > I'm not sure if this is a bug in django or if it works as designed.
> > That's why I'm asking here first, before filing a bug.
>
> > When using annote() on a model, it's date values become unicode
> > values.
>
> > Is this normal behavior and if so, is there a way to prevent this?
>
> Sounds like:
>
> http://code.djangoproject.com/ticket/10031
>
> Though since you don't mention OS, DB, and Python level it is hard to be
> sure.  Windows with Python 2.5 and using sqlite is the only time I recall
> this being reported, though.  If that is what you are using then at a
> minimum you will want to update the level of sqlite you are using.  If not,
> details of exactly what you are running would help.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: annotate() type coercion

2009-08-26 Thread Karen Tracey
2009/8/26 Georg Göttlich 

>
> Hello everybody,
>
> I'm not sure if this is a bug in django or if it works as designed.
> That's why I'm asking here first, before filing a bug.
>
> When using annote() on a model, it's date values become unicode
> values.
>
> Is this normal behavior and if so, is there a way to prevent this?
>
>
Sounds like:

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

Though since you don't mention OS, DB, and Python level it is hard to be
sure.  Windows with Python 2.5 and using sqlite is the only time I recall
this being reported, though.  If that is what you are using then at a
minimum you will want to update the level of sqlite you are using.  If not,
details of exactly what you are running would help.

Karen

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



Problem with running the database shell through cmd lime

2009-08-26 Thread Arul

Hi all,

I am using the sqlite database for django application. I need to alter
the table and i tried to use "manage.py dbshell" command. It shows me
"Error: You appear not to have the 'sqlite3' program installed or on
your path."

I tried downloading the sqlite3.exe file and used "sqlite3 c:\project
\mydb.sqlite" command.
It opens an sqlite prompt and allows me to alter the table.

But i need to use it with the django using the "manage.pt dbshell"
command.
I tried adding the sqlite.exe path to the windows system path. It
didnt work.

Please let me know how to acheive this.

Thanks,
Arul

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: _() function in templates

2009-08-26 Thread balasundaram karthikeyan
hi
iam new to python and Django and i am very much intrested in woe\rking with
these framework than other ones.
i request you to give me some tips of programming in these framework and
some online resource so that i can become an effective prgrammer in these
framework...






with regards
balasundaram
blog at sharelinux.wordpress.com

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



Re: Django + Godaddy

2009-08-26 Thread Nanopino

i've actually have semi success in getting django to work on godaddy.
It displays the "Congratulations on your first Django-powered page."
You will have to be signed up for the linux shared hosting Deluxe or
higher plan in order for fastcgi to be enabled. I can show you how to
get it up and running but the only problem is that once it is up and
running you can't do anything with it because the pysqlite2 and python
bindings for mysql aren't installed making django useless. I'm trying
to see if godaddy tech support will "yum install python-sqlite2" but i
really doubt it. They keep trying to upsell me to a VPS. I've been at
them for 2 weeks now... :-/

On Aug 25, 10:02 am, Andrés Martín - martyn
 wrote:
> Hi django Users.
>
> I need to know if somebody has used Django on godaddy Host service ?
>
> If yes, is easy to configure ? what recomended to me in that case ?
>
> Thank you!
>
> Regards
> --
> Andrés Martín Ochoa;
> passport: andresmar...@linuxmail.org;
> Linux Registered User #436420;
> Asterisk User Number: 1000;
> PBX: (57) 1 327 8000;
> Ext: 3011

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Internationalization in commands (cron usage)

2009-08-26 Thread Tomáš Drenčák
Thank you

On Wed, Aug 26, 2009 at 11:43 AM, James Bennett wrote:

>
> On Wed, Aug 26, 2009 at 4:03 AM, Tomáš Drenčák wrote:
> > I'd like to send mass email from custom command which will be called
> > by cron. Problem is that each email could be in different language.
> > How can I change actual language so ugettext and template rendering
> > will return correct localized string?
> > When I don't change anything, internationalization uses default
> > langue.
>
> django.utils.translation.activate(), passing the language code you
> want to become the active translation (and its complement,
> django.utils.translation.deactivate(), which takes you back to the
> default).
>
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of
> correct."
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



annotate() type coercion

2009-08-26 Thread Georg Göttlich

Hello everybody,

I'm not sure if this is a bug in django or if it works as designed.
That's why I'm asking here first, before filing a bug.

When using annote() on a model, it's date values become unicode
values.

Is this normal behavior and if so, is there a way to prevent this?


Cheers,
Georg Göttlich
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: request.FILES empty... only with IE!

2009-08-26 Thread OnCEL


Ok thanks. I did it as a trick: i create the form hardcoded in html
that I  do not display thanks to css, I copy it to another place when
I need it with newDiv.innerHTML = staticDiv.innerHTML, and I browse
htmlDom elements of the copy to add dynamic properties. It all works
fine. THanks again.



On Aug 24, 1:11 pm, James Bennett  wrote:
> On Mon, Aug 24, 2009 at 5:07 AM, OnCEL wrote:
> > This is a form created dynamically in JS and it contains only a file
> > input and a submit button (also created dynamically).
> > The entire form creating code is:
>
> I would wonder whether security restrictions in the browser are
> causing this; I know that manipulating file inputs is off-limits in
> most browsers, and it may be that IE is also interfering with the
> ability to dynamically create them.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Coltrane application not appearing on the admin index page

2009-08-26 Thread Gath

Guys,

Am going through the practical django book and am trying the weblog
application in Chapter 4, but when i go to test the application on my
cms application (that i created from the same book, from Chapter 2 &
3) "coltrane" application does not appear on the admin index page as
the book suggest.

This is my INSTALLED_APPS in the settings.py in the cms application;

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.flatpages',
'cms.search',
'coltrane',
)

My admin.py file in the coltrane application looks like this;

from django.contrib import admin
from coltrane.models import Category

class CategoryAdmin(admin.ModelAdmin):
pass

admin.site.register(Category, CategoryAdmin)

Please note when i run the syncdb, the tables are created properly.

Am using Django 1.1
Python 2.6
Windows Vista.

What am i missing out.

Gath
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



_() function in templates

2009-08-26 Thread nabucosound

I recently discovered that in templates you can do

{{ _("string")|filter }}

so "string" is translated before being filtered.

This is useful for me until this ticket is being commited:

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

Anyone knows where in Django documentation is this _() use documented?
I can't find it...


Thanks!

H.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Adding tests to a patch

2009-08-26 Thread Peter2108

I'm trying to help fix but #6138. I've done a patch for the code and a
separate test.py module. But someone ('Alex') added a request to
"Please put the tests in the same diff as the patch itself, it is
possible to use svn add locally". I'm at a loss here I'm afraid. The
only way I know to generate a single diff that included a patch to
trunk/django/forms/forms.py  and to the trunk/tests/regressiontests/
forms/forms.py is to set up subversion in the 'trunk' folder. But then
can one apply the patch if one does not have all that stuff?

Also where should one place this test - in  trunk/tests/
regressiontests/forms/forms.py or in  trunk/tests/regressiontests/
forms/error_messages.py or in a separate module even?

I browsed arund the bug list but could not find anything helpful, some
had no tests, some had tests in a separate file, but I could not find
one as a model.  I am getting a bit discouraged at the moment.

Thanks for any help,

Peter


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: First time deploying Django project

2009-08-26 Thread Graham Dumpleton



On Aug 26, 8:38 pm, Hussein B  wrote:
> I changed it to the following:
>
> 
>         SetHandler python-program
>         PythonHandler django.core.handlers.modpython
>         SetEnv DJANGO_SETTINGS_MODULE SshConnector.settings
>         PythonPath "['/home/me/', '/home/me/SshConnector/'] +
> sys.path"
>         PythonDebug On

Now go read documentation about the django.root option required when
not mounting it at root of web site.

> 
>
> I tried this URLhttp://localservler/ssh/
> But I got this error:
>
>   File "/usr/lib/python2.4/site-packages/django/conf/__init__.py",
> line 75, in __init__
>     raise ImportError, "Could not import settings '%s' (Is it on
> sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
> e)
>
> ImportError: Could not import settings 'SshConnector.settings' (Is it
> on sys.path? Does it have syntax errors?): No module named
> SshConnector.settings

This can occur because Apache normally runs as a special user and that
user will need permissions to access the files in your home account.
The error can thus indicate it doesn't have that permission.

Graham

> On Aug 26, 1:24 pm, Graham Dumpleton 
> wrote:
>
>
>
> > On Aug 26, 7:51 pm, Kenneth Gonsalves  wrote:
>
> > > On Wednesday 26 Aug 2009 2:42:47 pm HB wrote:
>
> > > > Hey,
> > > > I'm trying to deploy my first Django application to Apache.
> > > > The project is located under:  /home/me/SshConnector/
> > > > Here is my configuration:
>
> > > > 
> > > >         Options Indexes FollowSymLinks MultiViews
> > > >         AllowOverride None
> > > >         Order allow,deny
> > > >         allow from all
> > > >         AddHandler mod_python .py
> > > >         PythonHandler mod_python.publisher
>
> > What Django installation instructions tell you to set PythonHandler to
> > mod_python.publisher? Read the Django documentation for deploying with
> > mod_python again.
>
> > > >         SetEnv DJANGO_SETTINGS_MODULE SshConnector.settings
> > > >         PythonPath "['/home/me/SshConnector/', '/var/www'] + sys.path"
>
> > > in the first place this wrong. It should be:
>
> > >  PythonPath "['/home/me/', '/var/www'] + sys.path"
>
> > No actually. The 'var/www' is likely totally unnecessary and if they
> > don't prefix project site everywhere as necessary in urls.py and in
> > imports, then you would actually want:
>
> >   PythonPath "['/home/me/', '/home/me/SshConnector/'] + sys.path"
>
> > Graham
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: First time deploying Django project

2009-08-26 Thread Hussein B

I changed it to the following:


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE SshConnector.settings
PythonPath "['/home/me/', '/home/me/SshConnector/'] +
sys.path"
PythonDebug On


I tried this URL
http://localservler/ssh/
But I got this error:

  File "/usr/lib/python2.4/site-packages/django/conf/__init__.py",
line 75, in __init__
raise ImportError, "Could not import settings '%s' (Is it on
sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
e)

ImportError: Could not import settings 'SshConnector.settings' (Is it
on sys.path? Does it have syntax errors?): No module named
SshConnector.settings



On Aug 26, 1:24 pm, Graham Dumpleton 
wrote:
> On Aug 26, 7:51 pm, Kenneth Gonsalves  wrote:
>
> > On Wednesday 26 Aug 2009 2:42:47 pm HB wrote:
>
> > > Hey,
> > > I'm trying to deploy my first Django application to Apache.
> > > The project is located under:  /home/me/SshConnector/
> > > Here is my configuration:
>
> > > 
> > >         Options Indexes FollowSymLinks MultiViews
> > >         AllowOverride None
> > >         Order allow,deny
> > >         allow from all
> > >         AddHandler mod_python .py
> > >         PythonHandler mod_python.publisher
>
> What Django installation instructions tell you to set PythonHandler to
> mod_python.publisher? Read the Django documentation for deploying with
> mod_python again.
>
> > >         SetEnv DJANGO_SETTINGS_MODULE SshConnector.settings
> > >         PythonPath "['/home/me/SshConnector/', '/var/www'] + sys.path"
>
> > in the first place this wrong. It should be:
>
> >  PythonPath "['/home/me/', '/var/www'] + sys.path"
>
> No actually. The 'var/www' is likely totally unnecessary and if they
> don't prefix project site everywhere as necessary in urls.py and in
> imports, then you would actually want:
>
>   PythonPath "['/home/me/', '/home/me/SshConnector/'] + sys.path"
>
> Graham
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: turn of CASCADE ON DELETE

2009-08-26 Thread gentlestone

hmm, I found the answers
1. use a pre_delete signal instead of overwrite the model's and
queryset's delete methods
2. use a specific exception subclass and catch it int the view
Am I correct?

On 26. Aug, 11:45 h., gentlestone  wrote:
> Because of Django CASCADE ON DELETE behavior I want to refuse deletion
> of the object with related objects. I overwrote my del method in the
> model:
>
>     def delete(self):
>         "Allow only if there are no related objects"
>         seen_objs = CollectedObjects()
>         self._collect_sub_objects(seen_objs)
>         if len(seen_objs.items()) > 1:
>             raise Exception("This instance has related objects!")
>         super(MyModel, self).delete()
>
> The manager's delete method does'nt call the object's delete method.
> So I have to rewrote the manager's delete method also.
>
> But this is not DRY.
>
> What is the correct solution?
> How can I propagate the  Exception("The signature has related
> objects!") to HTML? Because ugettext_lazy("The signature has related
> objects!") does'nt works.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: First time deploying Django project

2009-08-26 Thread Graham Dumpleton



On Aug 26, 7:51 pm, Kenneth Gonsalves  wrote:
> On Wednesday 26 Aug 2009 2:42:47 pm HB wrote:
>
> > Hey,
> > I'm trying to deploy my first Django application to Apache.
> > The project is located under:  /home/me/SshConnector/
> > Here is my configuration:
>
> > 
> >         Options Indexes FollowSymLinks MultiViews
> >         AllowOverride None
> >         Order allow,deny
> >         allow from all
> >         AddHandler mod_python .py
> >         PythonHandler mod_python.publisher

What Django installation instructions tell you to set PythonHandler to
mod_python.publisher? Read the Django documentation for deploying with
mod_python again.

> >         SetEnv DJANGO_SETTINGS_MODULE SshConnector.settings
> >         PythonPath "['/home/me/SshConnector/', '/var/www'] + sys.path"
>
> in the first place this wrong. It should be:
>
>  PythonPath "['/home/me/', '/var/www'] + sys.path"

No actually. The 'var/www' is likely totally unnecessary and if they
don't prefix project site everywhere as necessary in urls.py and in
imports, then you would actually want:

  PythonPath "['/home/me/', '/home/me/SshConnector/'] + sys.path"

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



Re: template tag response None. but why?

2009-08-26 Thread Daniel Roseman

On Aug 26, 12:44 am, MIL  wrote:
> Hi guys :o)
>
> Im attempting to create a template tag but I get a strange response.
> it returns "None" where I put the {% if blog_detail %} tag
>
> Here is my template tag
>
> class BlogNode(Node):
>         def __init__(self, user, varname):
>                 self.user, self.varname = user, varname
>
>         def render(self, context):
>                 try:
>                         context[self.varname] = 
> Blog.objects.get(user=self.user)
>                 except ObjectDoesNotExist:
>                         context[self.varname] = False
>
> @register.tag
> def get_blog(parser, token):
>         # {% get_blog for user_object as object_detail %}
>         # {% if blog_detail %} etc...
>         bits = token.contents.split()
>         if len(bits) != 5:
>                 raise TemplateSyntaxError, "get_blog tag takes exactly five
> arguments"
>         if bits[1] != 'for':
>                 raise TemplateSyntaxError, "second argument to get_blog tag 
> must be
> 'for'"
>         if bits[3] != 'as':
>                 raise TemplateSyntaxError, "third argument to get_blog tag 
> must be
> 'as'"
>         return BlogNode(bits[2], bits[4])
>
> Why does it response with a "None" message?
>
> Thanks :o)

Your render() method should return something, even if it's a blank
string. The default value returned by a function in Python is None, so
the template is simply showing this (converted into a string, ie
'None').
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: the parameters of the self-defined tags

2009-08-26 Thread Daniel Roseman

On Aug 26, 6:55 am, Apple  wrote:
> hi , now I want to pass a parameter named user (user is a instance of
> User) to the self_defined tags,could I do this ? I think the passed
> parameter are all strings , is there a way to get its real type ?
> thank you for your replying !

You can use the template.Variable() class to access the real variable
referenced the name you pass to the tag. See
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#passing-template-variables-to-the-tag
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Change my model names - consequences?

2009-08-26 Thread Daniel Roseman

On Aug 26, 9:35 am, adelaide_mike  wrote:
> After adding a model to my Django 1.0.2 app I would like to change the
> names of two models.  Will the syncdb take care of this for me?  I
> anticipate I will need to change the table names in PostgreSQL.
>
> Any caveats?  Any hints?  TIA
>
> Mike

No, syncdb won't do anything - or rather, it will recreate the models
from scratch with the new names, leaving the old ones still there.

The easiest thing to do would probably be to use the db_table option
in the models' Meta class, setting it to the old table names, then
everything will just work (although it might be a bit confusing if you
ever need to access the database manually).
http://docs.djangoproject.com/en/dev/ref/models/options/#db-table
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Internationalization in commands (cron usage)

2009-08-26 Thread James Bennett

On Wed, Aug 26, 2009 at 4:03 AM, Tomáš Drenčák wrote:
> I'd like to send mass email from custom command which will be called
> by cron. Problem is that each email could be in different language.
> How can I change actual language so ugettext and template rendering
> will return correct localized string?
> When I don't change anything, internationalization uses default
> langue.

django.utils.translation.activate(), passing the language code you
want to become the active translation (and its complement,
django.utils.translation.deactivate(), which takes you back to the
default).


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: First time deploying Django project

2009-08-26 Thread Kenneth Gonsalves

On Wednesday 26 Aug 2009 2:42:47 pm HB wrote:
> Hey,
> I'm trying to deploy my first Django application to Apache.
> The project is located under:  /home/me/SshConnector/
> Here is my configuration:
>
> 
> Options Indexes FollowSymLinks MultiViews
> AllowOverride None
> Order allow,deny
> allow from all
> AddHandler mod_python .py
> PythonHandler mod_python.publisher
> SetEnv DJANGO_SETTINGS_MODULE SshConnector.settings
> PythonPath "['/home/me/SshConnector/', '/var/www'] + sys.path"

in the first place this wrong. It should be:

 PythonPath "['/home/me/', '/var/www'] + sys.path"

-- 
regards
kg
http://lawgon.livejournal.com

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



turn of CASCADE ON DELETE

2009-08-26 Thread gentlestone

Because of Django CASCADE ON DELETE behavior I want to refuse deletion
of the object with related objects. I overwrote my del method in the
model:

def delete(self):
"Allow only if there are no related objects"
seen_objs = CollectedObjects()
self._collect_sub_objects(seen_objs)
if len(seen_objs.items()) > 1:
raise Exception("This instance has related objects!")
super(MyModel, self).delete()

The manager's delete method does'nt call the object's delete method.
So I have to rewrote the manager's delete method also.

But this is not DRY.

What is the correct solution?
How can I propagate the  Exception("The signature has related
objects!") to HTML? Because ugettext_lazy("The signature has related
objects!") does'nt works.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Internationalization in commands (cron usage)

2009-08-26 Thread Tomáš Drenčák
Hi,
I'd like to send mass email from custom command which will be called
by cron. Problem is that each email could be in different language.
How can I change actual language so ugettext and template rendering
will return correct localized string?
When I don't change anything, internationalization uses default
langue.

thanks,
  tomas

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: First time deploying Django project

2009-08-26 Thread Hussein B

The previous conf is python.conf under /etc/httpd/conf.d

On Aug 26, 12:12 pm, HB  wrote:
> Hey,
> I'm trying to deploy my first Django application to Apache.
> The project is located under:  /home/me/SshConnector/
> Here is my configuration:
>
> 
>         Options Indexes FollowSymLinks MultiViews
>         AllowOverride None
>         Order allow,deny
>         allow from all
>         AddHandler mod_python .py
>         PythonHandler mod_python.publisher
>         SetEnv DJANGO_SETTINGS_MODULE SshConnector.settings
>         PythonPath "['/home/me/SshConnector/', '/var/www'] + sys.path"
>         PythonDebug On
> 
>
> And restarted Apache.
>
> But I'm getting:
> The requested URL /html/search/ was not found on this server.
> Up typing:http://localserver/html/search/
>
> Any ideas what is going wrong?
> Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



First time deploying Django project

2009-08-26 Thread HB

Hey,
I'm trying to deploy my first Django application to Apache.
The project is located under:  /home/me/SshConnector/
Here is my configuration:


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
AddHandler mod_python .py
PythonHandler mod_python.publisher
SetEnv DJANGO_SETTINGS_MODULE SshConnector.settings
PythonPath "['/home/me/SshConnector/', '/var/www'] + sys.path"
PythonDebug On


And restarted Apache.

But I'm getting:
The requested URL /html/search/ was not found on this server.
Up typing:
http://localserver/html/search/

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



Change my model names - consequences?

2009-08-26 Thread adelaide_mike

After adding a model to my Django 1.0.2 app I would like to change the
names of two models.  Will the syncdb take care of this for me?  I
anticipate I will need to change the table names in PostgreSQL.

Any caveats?  Any hints?  TIA

Mike
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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/Django web programmer needed

2009-08-26 Thread Gabriel Gunderson
On Wed, Aug 26, 2009 at 2:10 AM, w y wrote:
> Otherwise just ignore this e-mail

I'm going to try.  If I/we can't, will you please take this off-list?

Thanks,
ALL

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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/Django web programmer needed

2009-08-26 Thread w y

Dear Sir, 

I got your e-mail as I prescribed this e-mail list. I am a Python/Django Web 
programmer. Since year 1995, I have been working in programming field with C, 
C++, Java, PHP, DHTML, Python, shell scripts and Django. 

For this opportunity, I have two quick questions. Is part-time ok? Is 
telecommuting ok? As I have a perm job now, I can not relocate. If you think 
part-timeand telecommuting are ok, then I will send my resume to you. Otherwise 
just ignore this e-mail.

Thanks, 

David 

--- On Mon, 8/24/09, Michael  wrote:

> From: Michael 
> Subject: Python/Django web programmer needed
> To: "Django users" 
> Date: Monday, August 24, 2009, 11:00 AM
> 
> I own a web based medical recertification company and we
> are looking
> for a Python/Django web programmer to do some work for
> us.  The site
> is written in Python using Django 1.0. We need to switch
> from using
> Paypal to Authorize.net and would like to add content to
> our site.  We
> are based in Greensboro, NC and would like to hire someone
> within the
> US.  Does anyone have any suggestions or have the
> experience needed to
> complete the job for us?
> 
> > 
> 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: Error in setting up psycopg2

2009-08-26 Thread Thomas Guettler



Simon Lee schrieb:
> Hi Thomas,
...

> 
> I did a search on the web but found only two links on similar error
> without any solution. Does anyone know what caused "Symbol not found:
> _PQbackendPID"?
> 

Try to to install a new version von psycopg2, since it seems to be broken.

Try to use psycopg2 without django.

  Thomas

-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Many-to-many column

2009-08-26 Thread Sven Richter
Thank you very much. I think i get the idea.


Greetings
Sven

On Tue, Aug 25, 2009 at 10:51 PM, Peter Bengtsson  wrote:

>
> I fear your only option is to write a recursive function which you
> feed with what you define to be "the end of the chain".
> You can collect all the entries in a mutable list. Some example,
> untested, code:
>
> def get_all_parents(list_, current):
>for entry in current.following_to.all():
>list_.append(entry)
>list_.extend(get_all_parents(list_, entry)
>return list_
>
> current = A
> parents = []
> get_all_parents(parents, current)
> print parents
>
> Excuse me if I didn't get it right but it should get you started.
>
> On Aug 25, 10:11 am, Sven Richter  wrote:
> > Hi,
> >
> > i implemented a many-to-many field in my model like:
> > class Entries(models.Model):
> >   following_to = models.ManyToManyField('self', blank=True, null=True)
> >
> > Now i can get all related Entries in a template with
> entry.following_to.all.
> > But i want to go deeper in relationships.
> >
> > Lets say i have 4 Entries A, B, C, D.
> > A is following_to to B and
> > B is following_to to C and
> > C is following_to to D.
> > A.following_to.all gives back B.
> >
> > But what i need is to follow until the end of the chain is reached.
> > I need something like:
> > A.following_to.give_all_related_entries which then returns:
> > B, C, D
> >
> > Do i have to write my own template tag for that or is it already
> implemented
> > in Django?
> > Or maybe there is a better approach to solve my issue?
> >
> > I couldnt find a similar question or answer in the docs.
> >
> > Greetings
> > Sven
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---