Re: How can i transmit an objects in list?

2012-06-14 Thread Àlex Pérez
Hello,


Are you sure?

I suppose that "childrens" is a custom manager, can you show us, the
implementation of that manager?

Only for performance "if len(category.childrens.all()):" -> "if
category.childrens.exist():"

But your problem, it's rare. Print the type of the firs element of the
result list:

list = BuildList(Categories.objects.filter(parent = None))
print type(list[0])

2012/6/14 Dominis 

> Hello.
> I need a bit help with my code.
> I write a function for menu building, which should create a list of
> objects, for designing it in html code.
> Code of function below:
>
>> def BuildList(categories):
>> list = []
>> for category in categories:
>> if len(category.childrens.all()):
>> list.append(category)
>> list.append(BuildList(category.childrens.all()))
>> else :
>> list.append(category)
>> return list
>>
>
> I call this function for a list of categories, like this:
>
>> list = BuildList(Categories.objects.filter(parent = None))
>>
> My function work right, but in list i get not an objects, my values have
> only name of a categories. I thought it happens couse in my Category model
> in __unicode__  function i place a 'return self.name', and when i call my
> categories in function - it return just name. :(
> What i should do for get full objects in my list? With full collection of
> parameters.
> I suppose this question is easy, but i just start to learn python and
> django.
> Thx for you time and answers.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/LwmJH2ZcRcwJ.
> 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.
>



-- 
Alex Perez
alex.pe...@bebabum.com

 *bebabum* be successful

c/ Còrsega 301-303, Àtic 2
08008 Barcelona
http://www.bebabum.com
http://www.facebook.com/bebabum
http://twitter.com/bebabum

This message is intended exclusively for its addressee and may contain
information that is confidential and protected by professional privilege.
If you are not the intended recipient you are hereby notified that any
dissemination, copy or disclosure of this communication is strictly
prohibited by law.

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si no es vd. el destinatario
indicado,
queda notificado que la utilización, divulgación y/o copia sin autorización
está prohibida en virtud de la legislación vigente.

Le informamos que los datos personales que facilite/ha facilitado pasarán a
formar parte de un fichero responsabilidad de bebabum, S.L. y que tiene
por finalidad gestionar las relaciones con usted.
Tiene derecho al acceso, rectificación cancelación y oposición en nuestra
oficina ubicada en c/ Còrsega 301-303, Àtic 2 de Barcelona o a la dirección
de e-mail l...@bebabum.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: How can i transmit an objects in list?

2012-06-14 Thread Dominis

>
> I suppose that "childrens" is a custom manager, can you show us, the 
> implementation of that manager?
>
Childrens it's just a related_items parameter for a field. 
This code from models.py

> class Categories(models.Model):
> name = models.CharField(max_length=50)
> path = models.SlugField(max_length=50)
> parent = models.ForeignKey('self', null=True, blank=True, *
> related_name='childrens'*)
> order = models.IntegerField(default=1)
> isShow = models.BooleanField(default=True)
>
 
By using category.childrens.all() i just check are child items exists...  
(any object have this category like 'parent')

Only for performance "if len(category.childrens.all()):" -> "if 
> category.childrens.exist():"
>
Thx, for advice.
 

> But your problem, it's rare. Print the type of the firs element of the 
> result list:
>
Type is a "class Category". So it's realy object... Now i understand so i 
wrong with identify my problem.

I want to build HTML through the custom tag, and i cant get access for 
fields parametrs in custom tag script. In begin i suppose the problem 
appear when i put objects in list. But type(list[0]) show thet in list i 
have still object. I check in my template by {{item.field}} - it is show me 
right data, so in template i sill can get access for fields of an object. 
But when in my template i call my template tag, in template_tag code i 
can't get access for fields... code is below.
In my template i do 

> {% load menu_builder %}
> {{ list|BuildMenu }}
>

In menu_builder.py i have this code:

> def BuildMenu(list):
> html = ''
> for item in list:
> print item.path
> return html 
>
it's isnt realy function - just check... but i get a exception 
'list' object has no attribute 'path'
Exception Location: ..\templatetags\menu_builder.py in BuildMenu, line 7

Can you help with it? Where i make a wrong?
 

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



Re: django 1.4 memory issues

2012-06-14 Thread francescortiz
You could create a bug report:

https://code.djangoproject.com/newticket

On Tuesday, June 12, 2012 4:59:08 PM UTC+2, Greg Donald wrote:
>
> Over the weekend I upgraded my project to Django 1.4.  After the 
> upgrade my Apache/mod_wsgi setup began running out of memory.  I 
> increased the memory capacity of my virtual servers, but that only 
> extended the time until they began to swap again.  I found a blog 
> article that suggested setting Apache's MaxRequestsPerChild to 
> something other than 0.  After setting it to 25, Apache seems to be 
> releasing memory again. 
>
> My question is, why did I have to do that?  The only thing that 
> changed is my Django version from 1.3 -> 1.4.  I have Debug=False in 
> settings.py, so I don't think I'm experiencing the SQL memory buildup 
> described on a couple of blogs.  I do have some long running scripts 
> that use Django outside of Apache, so I implemented db.reset_queries() 
> in those, but it had no noticeable effect.  They didn't appear to be 
> using any more memory than normal, but I figured it couldn't hurt. 
>
> So everything is running fine again, but something changed in Django 
> 1.4 that causes my same project code to leak memory.  I'd sure like to 
> figure it out. 
>
> Thanks. 
>
>
> -- 
> Greg Donald 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/QvpMw9Ra7AcJ.
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.



CSRF Issue

2012-06-14 Thread cmac0tt
I feel like an idiot here, I've worked my way around this multiple times 
but its just not working this time and as you can see ive thrown every 
method there is in the documentation at it.

(note that I am learning python and django right now on the fly) however 
here is my views, the form with the token, and my models (threw in the 
middleware settings from my settings.py and my urls just in case. Let me 
know if you need anything else. Remember, just learning here, and learning 
by converting a walkthrough presentation of building a wiki on pre 0.96 on 
1.4 so I've had to learn a lot of changes etc. Its helping, mind you, this 
one step is getting frustrating now after two nights of it.

http://dpaste.org/X1Xoh/

let me know if you have any ideas, and remember, I'm not big on the snake 
talk just yet.

Thanks.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/QzuXLWyW1lYJ.
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: Admin plugins

2012-06-14 Thread patrickk
what do you mean with "Grappelli and django-admin-tools are both still 
being developed"?
both apps have stable releases for quite a while (with grappelli, this is 
even true for a couple of years now).

best,
patrick


Am Donnerstag, 14. Juni 2012 00:33:00 UTC+2 schrieb Lachlan Musicman:
>
> Hola, 
>
> I just watched a video from last year about modifying the Django Admin 
> interface. I was wondering if people recommend any particular app? 
>
> Grappelli and django-admin-tools are both still being developed. Are 
> there any others and if you prefer one, why? 
>
> Am thinking especially in terms of handing over to no technical staff 
> to do basic admin. 
>
> cheers 
> L. 
>

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



Re: How can i transmit an objects in list?

2012-06-14 Thread huseyin yilmaz
You are probably getting this error because when you generate your list 
from categories. you are adding sub categories as list. so your list will 
be like following

[cat1,cat2,cat3,[subcat1,subcat2],[subcat3,subcat4]]

I think you want to use

list.extend(BuildList(category.childrens.all()))
so you will have a one flat list.


list.append(category) repeated twice itlookslike to me that you don't 
actualy need an if statement here.

def BuildList(categories):
list = []
for category in categories:
list.append(category)
list.extend(BuildList(category.childrens.all()))
return list

this method would run same queries.
,

You have a for template tag in django . You can use it instead of your 
custom filter.

Lastly please check this https://github.com/django-mptt/django-mptt

this is great for categories. this is good for keeping trees in relational 
databases. when you query sub trees, it will do exactly one query every 
time.
and there is a generic category app too if you need.

https://github.com/callowayproject/django-categories

I hope that helps.







On Thursday, June 14, 2012 9:44:50 AM UTC+3, Dominis wrote:
>
> Hello. 
> I need a bit help with my code.
> I write a function for menu building, which should create a list of 
> objects, for designing it in html code.
> Code of function below:
>
>> def BuildList(categories):
>> list = []
>> for category in categories:
>> if len(category.childrens.all()):
>> list.append(category)
>> list.append(BuildList(category.childrens.all()))
>> else :
>> list.append(category)
>> return list
>>
>  
> I call this function for a list of categories, like this:
>
>> list = BuildList(Categories.objects.filter(parent = None))
>>
> My function work right, but in list i get not an objects, my values have 
> only name of a categories. I thought it happens couse in my Category model 
> in __unicode__  function i place a 'return self.name', and when i call my 
> categories in function - it return just name. :(
> What i should do for get full objects in my list? With full collection of 
> parameters.
> I suppose this question is easy, but i just start to learn python and 
> django.
> Thx for you time and answers.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/dDbJWAC6Xo8J.
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: image in browser

2012-06-14 Thread Daniel Roseman
On Thursday, 14 June 2012 07:15:19 UTC+1, Satvir Kaur wrote:
>
> hello, 
>
> i wish to display the image into the browser through a template . I 
> used the following code to retrieve the image from Disk and send that 
> data to Html file 
>
> def my_image(request): 
> image_data = open("/home/toor/Desktop/certificate/logo.png", 
> "rb").read() 
> return render_to_response('myapp/bio.html', {'img':image_data}, 
> context_instance=RequestContext(request)) 
>
>
> Now, The image is not availble into the html file that is displaying 
> in browser, Tell me where  I m wrong. 
>
>
> -- 
> Satvir Kaur 
>


This is a strange thing to want to do. What are you doing with `img` in the 
template?
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/U6RaTow-dJQJ.
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: CSRF Issue

2012-06-14 Thread Daniel Roseman
On Thursday, 14 June 2012 08:46:24 UTC+1, cmac0tt wrote:
>
> I feel like an idiot here, I've worked my way around this multiple times 
> but its just not working this time and as you can see ive thrown every 
> method there is in the documentation at it.
>
> (note that I am learning python and django right now on the fly) however 
> here is my views, the form with the token, and my models (threw in the 
> middleware settings from my settings.py and my urls just in case. Let me 
> know if you need anything else. Remember, just learning here, and learning 
> by converting a walkthrough presentation of building a wiki on pre 0.96 on 
> 1.4 so I've had to learn a lot of changes etc. Its helping, mind you, this 
> one step is getting frustrating now after two nights of it.
>
> http://dpaste.org/X1Xoh/
>
> let me know if you have any ideas, and remember, I'm not big on the snake 
> talk just yet.
>
> Thanks.
>
>
>
You *do* seem to have thrown every method in.

Firstly, you don't need the @csrf_protect decorator, or all that stuff with 
c.update(csrf(request)) - the second especially as you're then not doing 
anything with `c`! The point of that is if you're not using a context 
processor, you should then pass `c` as the basis for the template context, 
because it already contains the csrf token. But you're just throwing it 
away.

So, remove those two things. Also, take out those cache_pages - you most 
*definitely* do not want to cache the edit or save pages. Now see if it's 
any better, and report back what happens.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/e2DRkVBojkgJ.
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: Dynamic Model Saving and Admin Activation

2012-06-14 Thread Daniel Roseman
On Wednesday, 13 June 2012 21:46:27 UTC+1, Karandeep Nagra wrote:
>
> So I've set up my Django site to create a dynamic model for every Server 
> that is created.  So at the creation of server Bender, the model 
> Bender_request is created.  But whenever I restart the built-in server, 
> Bender_request disappears from the admin page.  I checked my database and 
> there is no table for Bender_request even before I shut down the server.  
> Furthermore, even though Bender_requests shows up in the admin interface, 
> it can't be clicked on.  So it seems there is no database table being 
> created for Bender_requests.  My code is below.  Any clue on this situation?
>

Well, no, the code you've posted doesn't create any tables. What makes you 
think it would? And why would you expect a dynamic model to persist across 
restarts?

My "clue on this situation" is simply to not do this.
--
DR.

 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/tXqlVMo3Gb0J.
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.



[ANN]: FeinCMS v1.6.0

2012-06-14 Thread Matthias Kestenholz
Hello everyone

FeinCMS v1.6.0 has been released this noon and is available from
usual places.


What is FeinCMS anyway?
===

FeinCMS is one of the most advanced Content Management Systems built on top
of Django. FeinCMS not only includes a page module with many bundled content
types (plugins), a media library and up-to-date documentation but also the
tools to build your own CMS if our view of how a page CMS is supposed to
act like does not fit your requirements.

Website: http://www.feincms.org/

PyPI: http://pypi.python.org/pypi/FeinCMS/
Github: https://github.com/feincms/feincms/
Docs: http://feincms-django-cms.readthedocs.org/

Please report any issues you find in the issue tracker of github:
https://github.com/feincms/feincms/issues


This release would not have been possible without the contributions by the
community. Thanks for all the patches, bug reports and ideas which went into
this release.



=
FeinCMS 1.6 release notes
=

Welcome to FeinCMS 1.6!


Backwards-incompatible changes
==


Reversing application content URLs
--

The default value of ``FEINCMS_REVERSE_MONKEY_PATCH`` has been changed to
``False``. Support for monkey-patching the ``reverse()`` method to support
the old ``'urlconf/viewname'`` notation will be removed in the 1.7 release.


Improvements to the bundled file and image contents
---

* ``ImageContent``, ``FileContent`` and ``VideoContent`` now have pretty
  icons out-of-the-box.

* ``ImageContent`` now accepts optional ``FORMAT_CHOICES`` for use with
  FeinCMS' bundled thumbnailers, as well as ``caption`` and ``alt_text`` fields.

  .. note::

 If you are upgrading from an earlier version of FeinCMS, you'll have to
 add the new database columns yourself or use a migration tool like South
 to do it for you. Instructions for MySQL and the page module follow::

 ALTER TABLE page_page_imagecontent ADD COLUMN `alt_text`
varchar(255) NOT NULL;
 ALTER TABLE page_page_imagecontent ADD COLUMN `caption`
varchar(255) NOT NULL;

 If you want to use ``FORMAT_CHOICES``::

 ALTER TABLE page_page_imagecontent ADD COLUMN `format`
varchar(64) NOT NULL;

* ``FileContent`` now displays the size of the file in the default template,
  and uses ``span`` elements to allow styling of the title / size.


Removal of deprecated features
--

* Deprecated page manager methods have been removed. You should use
  ``Page.objects.for_request`` instead of the following manager methods:

  * ``Page.objects.page_for_path_or_404()``
  * ``Page.objects.for_request_or_404()``
  * ``Page.objects.best_match_for_request()``
  * ``Page.objects.from_request()``

* Deprecated page methods have been removed:

  * ``Page.active_children()``: Use ``Page.children.active()`` instead.
  * ``Page.active_children_in_navigation()``: Use
``Page.children.in_navigation()`` instead.
  * ``Page.get_siblings_and_self()``: You probably wanted
``self.parent.children.active()`` or
``self.get_siblings(include_self=True).active()`` anyway.

* The shortcuts ``Page.register_request_processors()`` and
  ``Page.register_response_processors()`` to register several request
or response
  processors at once have been removed in favor of their counterparts which
  only allow one processor at a time, but allow for replacing FeinCMS' included
  processors, ``require_path_active_request_processor`` and
  ``redirect_request_processor``.

* It is not possible anymore to access the request and response processors as
  methods of the ``Page`` class. The processors are all in
  ``feincms.module.page.processors`` now.

* The deprecated support for prefilled attributes has been removed. Use
  Django's own ``prefetch_related`` or ``feincms.utils.queryset_transform``
  instead.

* The deprecated ``feincms.views.base`` module has been removed. The code has
  been moved to ``feincms.views.legacy`` during the FeinCMS v1.5 cycle.


New deprecations


* The view decorator ``feincms.views.decorators.add_page_to_extra_context``
  has been deprecated as it was mostly used with function-based generic views,
  which have been deprecated in Django as well. Use Django's class-based generic
  views and the ``feincms.context_processors.add_page_if_missing`` context
  processor if you need similar functionality instead.

* The content type ``feincms.content.medialibrary.models.MediaFileContent`` has
  been deprecated since FeinCMS v1.4. The whole module has been deprecated now
  and will be replaced with the contents of ``feincms.content.medialibrary.v2``
  in FeinCMS v1.7. The ``v2`` module will stay around for another release or
  two so that code using ``v2`` will continue working with FeinCMS v1.8 (at
  least).

* The template tag ``feincms_navigation`` has been superseded by ``feincms_nav``
  which fixes 

Re: image in browser

2012-06-14 Thread Satvir Toor
> This is a strange thing to want to do. What are you doing with `img` in the
> template?
I am using image_data variable as a image source in the template(html file).


 What should i ??? Image is not displaying.



-- 
Satvir Kaur
satveerkaur.blogspot.in

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

2012-06-14 Thread cmac0tt
ok, so this is my view now. Maybe I'm not understanding and if so I 
apologize. We all start somewere right. I just dont know why I'm having 
trouble with it now when I had it working last time around with simply 
using C {} 


On Thursday, June 14, 2012 3:46:24 AM UTC-4, cmac0tt wrote:
>
> I feel like an idiot here, I've worked my way around this multiple times 
> but its just not working this time and as you can see ive thrown every 
> method there is in the documentation at it.
>
> (note that I am learning python and django right now on the fly) however 
> here is my views, the form with the token, and my models (threw in the 
> middleware settings from my settings.py and my urls just in case. Let me 
> know if you need anything else. Remember, just learning here, and learning 
> by converting a walkthrough presentation of building a wiki on pre 0.96 on 
> 1.4 so I've had to learn a lot of changes etc. Its helping, mind you, this 
> one step is getting frustrating now after two nights of it.
>
> http://dpaste.org/X1Xoh/
>
> let me know if you have any ideas, and remember, I'm not big on the snake 
> talk just yet.
>
> Thanks.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/WTk296rAce0J.
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: CSRF Issue

2012-06-14 Thread cmac0tt
ahem, so here is the view

from wikicamp.wiki.models import Page
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.shortcuts import redirect
from django import forms
import htmllib
from django.template import RequestContext, loader
from django.core.context_processors import csrf
# Create your views here.

def view_page(request, page_name):
c = {}
try:
page = Page.objects.get(pk=page_name)
except Page.DoesNotExist:
return render_to_response("create.html", 
{"page_name":page_name}
, context_instance=RequestContext(request))
content = page.content
#   content = request.GET['content']
return render_to_response("view.html", {"page_name":page_name, 
"content":content})
#, context_instance=RequestContext)



def edit_page(request, page_name):
c = {}
try:
page = Page.objects.get(pk=page_name)
content = page.content
except Page.DoesNotExist:
name = ""
#   content = request.GET['content']
content = ""
return  render_to_response("edit.html", {"page_name":page_name, 
"content":content})

def save_page(request, page_name):
c = {}
content = request.POST.get['content', 'this is the default']
try:
page = Page.objects.get(pk=page_name)
content = request.GET['content']
page.content = 'content'
except Page.DoesNotExist:
page = Page(name-page_name, content-content)
page.save()
return HttpResponseRedirect("/granite/" + "page_name" + "/")




On Thursday, June 14, 2012 3:46:24 AM UTC-4, cmac0tt wrote:
>
> I feel like an idiot here, I've worked my way around this multiple times 
> but its just not working this time and as you can see ive thrown every 
> method there is in the documentation at it.
>
> (note that I am learning python and django right now on the fly) however 
> here is my views, the form with the token, and my models (threw in the 
> middleware settings from my settings.py and my urls just in case. Let me 
> know if you need anything else. Remember, just learning here, and learning 
> by converting a walkthrough presentation of building a wiki on pre 0.96 on 
> 1.4 so I've had to learn a lot of changes etc. Its helping, mind you, this 
> one step is getting frustrating now after two nights of it.
>
> http://dpaste.org/X1Xoh/
>
> let me know if you have any ideas, and remember, I'm not big on the snake 
> talk just yet.
>
> Thanks.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/IGTVuRc1nqQJ.
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: image in browser

2012-06-14 Thread Daniel Roseman
On Thursday, 14 June 2012 09:51:00 UTC+1, Satvir Kaur wrote:
>
> > This is a strange thing to want to do. What are you doing with `img` in 
> the 
> > template? 
> I am using image_data variable as a image source in the template(html 
> file). 
>
>  
>  What should i ??? Image is not displaying. 
>

Normally in an HTML file you put the image path in the src attribute, not 
the binary data (you can use a data URI with base64 encoding, but you 
almost certainly don't want to do that). 
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/bPOH5SGCtHEJ.
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: CSRF Issue

2012-06-14 Thread Daniel Roseman
On Thursday, 14 June 2012 10:00:09 UTC+1, cmac0tt wrote:
>
> ahem, so here is the view
>
> from wikicamp.wiki.models import Page
> from django.shortcuts import render_to_response
> from django.http import HttpResponseRedirect
> from django.shortcuts import render
> from django.shortcuts import redirect
> from django import forms
> import htmllib
> from django.template import RequestContext, loader
> from django.core.context_processors import csrf
> # Create your views here.
>
> def view_page(request, page_name):
> c = {}
> try:
> page = Page.objects.get(pk=page_name)
> except Page.DoesNotExist:
> return render_to_response("create.html", 
> {"page_name":page_name}
> , context_instance=RequestContext(request))
> content = page.content
> #   content = request.GET['content']
> return render_to_response("view.html", {"page_name":page_name, 
> "content":content})
> #, context_instance=RequestContext)
>
>
>
> def edit_page(request, page_name):
> c = {}
> try:
> page = Page.objects.get(pk=page_name)
> content = page.content
> except Page.DoesNotExist:
> name = ""
> #   content = request.GET['content']
> content = ""
> return  render_to_response("edit.html", {"page_name":page_name, 
> "content":content})
>
> def save_page(request, page_name):
> c = {}
> content = request.POST.get['content', 'this is the default']
> try:
> page = Page.objects.get(pk=page_name)
> content = request.GET['content']
> page.content = 'content'
> except Page.DoesNotExist:
> page = Page(name-page_name, content-content)
> page.save()
> return HttpResponseRedirect("/granite/" + "page_name" + "/")
>


Better, but now you've got rid of the 
`context_instance=RequestContext(request)` stuff, which you *do* need. And 
you're still creating an empty `c` dict which is never referenced again - 
it won't cause any problems, but it's pointless. 
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ZTm-9l8tKvEJ.
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: image in browser

2012-06-14 Thread kooliah

Why don't you use staticfiles?

https://docs.djangoproject.com/en/dev/howto/static-files/

On 06/14/2012 08:15 AM, Satvir Toor wrote:

hello,

i wish to display the image into the browser through a template . I
used the following code to retrieve the image from Disk and send that
data to Html file

def my_image(request):
 image_data = open("/home/toor/Desktop/certificate/logo.png", "rb").read()
 return render_to_response('myapp/bio.html', {'img':image_data},
context_instance=RequestContext(request))


Now, The image is not availble into the html file that is displaying
in browser, Tell me where  I m wrong.


   


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

2012-06-14 Thread cmac0tt
fixed. thanks mate!

On Thursday, June 14, 2012 3:46:24 AM UTC-4, cmac0tt wrote:
>
> I feel like an idiot here, I've worked my way around this multiple times 
> but its just not working this time and as you can see ive thrown every 
> method there is in the documentation at it.
>
> (note that I am learning python and django right now on the fly) however 
> here is my views, the form with the token, and my models (threw in the 
> middleware settings from my settings.py and my urls just in case. Let me 
> know if you need anything else. Remember, just learning here, and learning 
> by converting a walkthrough presentation of building a wiki on pre 0.96 on 
> 1.4 so I've had to learn a lot of changes etc. Its helping, mind you, this 
> one step is getting frustrating now after two nights of it.
>
> http://dpaste.org/X1Xoh/
>
> let me know if you have any ideas, and remember, I'm not big on the snake 
> talk just yet.
>
> Thanks.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/vfaEv0Fop1wJ.
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: image in browser

2012-06-14 Thread Satvir Toor
On Thu, Jun 14, 2012 at 2:32 PM, Daniel Roseman  wrote:
> On Thursday, 14 June 2012 09:51:00 UTC+1, Satvir Kaur wrote:
>>
>> > This is a strange thing to want to do. What are you doing with `img` in
>> > the
>> > template?
>> I am using image_data variable as a image source in the template(html
>> file).
>>
>> 
>>  What should i ??? Image is not displaying.
>
>
> Normally in an HTML file you put the image path in the src attribute, not
> the binary data (you can use a data URI with base64 encoding, but you almost
> certainly don't want to do that).
Yes Sir,
when i put whole path of image in src attribute its not working.


-- 
Satvir Kaur
satveerkaur.blogspot.in

-- 
You received this message because you are subscribed to the Google 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 postgres data type "real" is represented in Django?

2012-06-14 Thread akaariai
On 12 kesä, 18:50, IgorS  wrote:
> Hi ALL!
>
> It seems that there is no class in Django models that represents 4-byte
> data type "real" in postgres. I looked into
> django\db\backends\postgresql_psycopg2\creation.py but could not find it
> there. The only choice seems to be FloatField, which represents "double
> precision" in postgres. But i would like to use "real" to minimize the
> index size? How can i do it?

It might be you will need to do a FloatField subclass - RealField,
which will return "REAL" as its database type from field.db_type(). It
has been a while since last dealing with custom fields so there might
be something more needed. Django's documentation should contain more
information.

 - Anssi

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



Re: django 1.4 memory issues

2012-06-14 Thread akaariai
On 12 kesä, 17:59, Greg Donald  wrote:
> Over the weekend I upgraded my project to Django 1.4.  After the
> upgrade my Apache/mod_wsgi setup began running out of memory.  I
> increased the memory capacity of my virtual servers, but that only
> extended the time until they began to swap again.  I found a blog
> article that suggested setting Apache's MaxRequestsPerChild to
> something other than 0.  After setting it to 25, Apache seems to be
> releasing memory again.
>
> My question is, why did I have to do that?  The only thing that
> changed is my Django version from 1.3 -> 1.4.  I have Debug=False in
> settings.py, so I don't think I'm experiencing the SQL memory buildup
> described on a couple of blogs.  I do have some long running scripts
> that use Django outside of Apache, so I implemented db.reset_queries()
> in those, but it had no noticeable effect.  They didn't appear to be
> using any more memory than normal, but I figured it couldn't hurt.
>
> So everything is running fine again, but something changed in Django
> 1.4 that causes my same project code to leak memory.  I'd sure like to
> figure it out.

I don't remember seeing memory leak issues reported for 1.3 -> 1.4
uprgades (which doesn't mean they do not exist).

It is very hard to say where the problem might be without further
details. I don't have much experience in memory leak debugging, but
this post for example looks promising:
http://www.lshift.net/blog/2008/11/14/tracing-python-memory-leaks

 - Anssi


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



field-null or not-null filter?

2012-06-14 Thread Bram de Jong
Hey guys,


I was wondering if there is a way of making a field null vs not-null filter
without coding it yourself?

I tried:

list_filter = (('field_which_is_foreign_key', BooleanFieldListFilter),)

In the end I wrote this little one:

class MyFieldFilter(SimpleListFilter):
title = _(' field_which_is_foreign_key ')
parameter_name = ' field_which_is_foreign_key _n'

def lookups(self, request, model_admin):
return (
('T', _('Null')),
('F', _('Not Null')),
)

def queryset(self, request, queryset):
if self.value() == 'T':
return queryset.filter( field_which_is_foreign_key=None)
if self.value() == 'F':
return queryset.exclude( field_which_is_foreign_key =None)


But that's not very generic, I might need this for more fields!
Any way to do it with a bool filter?


 - bram

-- 
http://www.samplesumo.com
http://www.freesound.org
http://www.smartelectronix.com
http://www.musicdsp.org

office: +32 (0) 9 335 59 25
mobile: +32 (0) 484 154 730

-- 
You received this message because you are subscribed to the Google 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: image in browser

2012-06-14 Thread kenneth gonsalves
On Thu, 2012-06-14 at 14:21 +0530, Satvir Toor wrote:
> > This is a strange thing to want to do. What are you doing with `img`
> in the
> > template?
> I am using image_data variable as a image source in the template(html
> file).
> 
> 
>  What should i ??? Image is not displaying.
> 
> 

from the questions you have been asking on the list it seems to me that
you are unfamiliar with web programming. I suggest that you take some
time out to learn the basics of web programming and also to understand
how django works. I suggest you do the tutorial in the official
documentation. Also you should learn at least the basics of javascript.
The problem you have been bringing up in the last week is not best
solved by generating an image on the server side and passing it to the
template. The problem is solved by generating the data server side,
passing this data to the template and using a js library to generate and
render the image on the page.
-- 
regards
Kenneth Gonsalves

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



'ascii' codec can't encode character u'\xe4'

2012-06-14 Thread kenneth gonsalves
hi,

I have an application which runs on a webfaction hosting. I also have
the same app running on my devel machine. The code in the two machines
are pulled from the same repo. Django versions are identical. Python
versions are identical. I try to upload a file called Lisäinfo
kummeille.pdf in the dev machine. No problem. When I try the same file
in webfaction, I get the above error. I have checked and find I can use
python to open and save a file of the same name from the python prompt
in the webfaction shell. In templates, admin and and generated pdfs,
these non ascii characters are handled perfectly. Has anyone got any
clues about this? The full traceback is given below:

Environment:


Request Method: POST
Request URL: http://kenyakids.info/admin/web/download/add/

Django Version: 1.4a1
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'django.contrib.staticfiles',
 'sorl.thumbnail',
 'south',
 'kenyakids.web',
 'modeltranslation',
 'rosetta')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File
"/home/kenyakids/webapps/django/lib/python2.7/django/core/handlers/base.py" in 
get_response
  111. response = callback(request,
*callback_args, **callback_kwargs)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/contrib/admin/options.py" 
in wrapper
  367. return self.admin_site.admin_view(view)(*args,
**kwargs)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/utils/decorators.py" in 
_wrapped_view
  91. response = view_func(request, *args, **kwargs)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/views/decorators/cache.py" 
in _wrapped_view_func
  88. response = view_func(request, *args, **kwargs)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/contrib/admin/sites.py" in 
inner
  192. return view(request, *args, **kwargs)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/utils/decorators.py" in 
_wrapper
  25. return bound_func(*args, **kwargs)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/utils/decorators.py" in 
_wrapped_view
  91. response = view_func(request, *args, **kwargs)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/utils/decorators.py" in 
bound_func
  21. return func(self, *args2, **kwargs2)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/db/transaction.py"
in inner
  209. return func(*args, **kwargs)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/contrib/admin/options.py" 
in add_view
  955. self.save_model(request, new_object, form, False)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/contrib/admin/options.py" 
in save_model
  709. obj.save()
File
"/home/kenyakids/webapps/django/lib/python2.7/django/db/models/base.py"
in save
  464. self.save_base(using=using, force_insert=force_insert,
force_update=force_update)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/db/models/base.py"
in save_base
  552. result = manager._insert([self], fields=fields,
return_id=update_pk, using=using, raw=raw)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/db/models/manager.py" in 
_insert
  203. return insert_query(self.model, objs, fields, **kwargs)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/db/models/query.py"
in insert_query
  1576. return
query.get_compiler(using=using).execute_sql(return_id)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/db/models/sql/compiler.py" 
in execute_sql
  909. for sql, params in self.as_sql():
File
"/home/kenyakids/webapps/django/lib/python2.7/django/db/models/sql/compiler.py" 
in as_sql
  872. for obj in self.query.objs
File
"/home/kenyakids/webapps/django/lib/python2.7/django/db/models/fields/files.py" 
in pre_save
  249. file.save(file.name, file, save=False)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/db/models/fields/files.py" 
in save
  86. self.name = self.storage.save(name, content)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/core/files/storage.py" in 
save
  44. name = self.get_available_name(name)
File
"/home/kenyakids/webapps/django/lib/python2.7/django/core/files/storage.py" in 
get_available_name
  70. while self.exists(name):
File
"/home/kenyakids/webapps/django/lib/python2.7/django/core/files/storage.py" in 
exists
  230. return os.path.exists(self.path(name))
File "/usr/local/lib/python2.7/genericpath.py" in exi

Re: How can i transmit an objects in list?

2012-06-14 Thread Dominis

>
> You are probably getting this error because when you generate your list 
> from categories. you are adding sub categories as list. so your list will 
> be like following 
>

> [cat1,cat2,cat3,[subcat1,subcat2],[subcat3,subcat4]]
>
Yes, mistake was here. Now i solve it with check "if type(item) is list:" 
Using one flat list can't help me, couse i need to build tree with few 
levels. 

Lastly please check this https://github.com/django-mptt/django-mptt
>
> this is great for categories. this is good for keeping trees in relational 
> databases. when you query sub trees, it will do exactly one query every 
> time.
> and there is a generic category app too if you need.
>
> https://github.com/callowayproject/django-categories
>
> I hope that helps.
>

Thx for advice. I will look over it. But i write my custom template for 
learning and understanding django+python. Couse using ready apps cant let 
me do it :)

All my questions are answered, so thanks for help!

God bless friendliness community :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/hcVaDr06AHoJ.
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.



list_display showing latest creation date of set?

2012-06-14 Thread Bram de Jong
Hi all,

I have:

class A(models.Model)
   created =

-- 
http://www.samplesumo.com
http://www.freesound.org
http://www.smartelectronix.com
http://www.musicdsp.org

office: +32 (0) 9 335 59 25
mobile: +32 (0) 484 154 730

-- 
You received this message because you are subscribed to the Google 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: image in browser

2012-06-14 Thread Ivan Ivanov
На Thu, 14 Jun 2012 11:45:19 +0530
Satvir Toor  написа:

> hello,
> 
> i wish to display the image into the browser through a template . I
> used the following code to retrieve the image from Disk and send that
> data to Html file
> 
> def my_image(request):
> image_data = open("/home/toor/Desktop/certificate/logo.png",
> "rb").read() return render_to_response('myapp/bio.html',
> {'img':image_data}, context_instance=RequestContext(request))
> 

Why don't you use static files?

> Now, The image is not availble into the html file that is displaying
> in browser, Tell me where  I m wrong.

You better show us the template too.

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



Stuck already on step one, django on windows

2012-06-14 Thread Daniel Patriarca
I just installed python, then mysql, then django on my windows 7 machine 
and I think it worked because I ran the import django comand from python 
and nothing barked at me.  I thought. yeah... time to hit the tutorial but 
the first thing it tells me to do is cd to a directory.  Is there a unix 
emulator that got installed on my windows machine or something?  I actually 
do some unix programming in ksh but this is my first time trying to program 
in a windows environment. Can someone help me get past step one in the 
tuturial!!!  

I rent space on a server run by hostmonster.com.  Would it be a better idea 
for me to learn how to do all this straight on my server instead of windows 
anyways?  I don't even know how to tell if the django stuff works within my 
hosting environment.

-dan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/IJqLi0kFog4J.
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: image in browser

2012-06-14 Thread Christian Jurk
Why would you do that this way? The usual way would be to put your 
images into the static files and serve it from there. However, you 
should be able to do it that way using base64 encoding of the binary data:


from base64 import b64encode

def my_image(request):
image_data = open("/home/toor/Desktop/certificate/logo.png", 
"rb").read()
return render_to_response('myapp/bio.html', {'img': 
b64encode(image_data)},

context_instance=RequestContext(request))

After that, you can output your image inside the template by using





On 06/14/2012 08:15 AM, Satvir Toor wrote:

hello,

i wish to display the image into the browser through a template . I
used the following code to retrieve the image from Disk and send that
data to Html file

def my_image(request):
 image_data = open("/home/toor/Desktop/certificate/logo.png", "rb").read()
 return render_to_response('myapp/bio.html', {'img':image_data},
context_instance=RequestContext(request))


Now, The image is not availble into the html file that is displaying
in browser, Tell me where  I m wrong.




--
You received this message because you are subscribed to the Google 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: image in browser

2012-06-14 Thread Ivan Ivanov
На Thu, 14 Jun 2012 14:21:00 +0530
Satvir Toor  написа:

> > This is a strange thing to want to do. What are you doing with
> > `img` in the template?
> I am using image_data variable as a image source in the template(html
> file).
> 
> 
>  What should i ??? Image is not displaying.

Use static files for that:
https://docs.djangoproject.com/en/dev/howto/static-files/

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



Accessing request.user in a ModelAdmin function

2012-06-14 Thread Paulo Almeida
Hi,

I would like to access the request.user in a ModelAdmin function, so I can 
filter the results of a query based on the logged in user. I have these 
models:

class Speaker(models.Model):
name = models.CharField(max_length=50)
endorsements = models.ManyToManyField(User,
   
 through="Endorsement")

class Endorsement(models.Model):
speaker = models.ForeignKey('Speaker')
user = models.ForeignKey(User)
endorsed = models.NullBooleanField()

class Meta:
unique_together = ("speaker", "user")

User comes from django.contrib.auth.models. In the ModelAdmin, I would like 
to have this:

class SpeakerAdmin(admin.ModelAdmin):
def is_endorsed(self, obj):

endorsement = Endorsement.objects.get(speaker=obj,
  
user=request.user)
return endorsement.endorsed

So then I could just add "is_endorsed" to the list_display variable to have 
the endorsement status for that user in the Speaker list, in the Admin 
site. Of course, this doesn't work because request isn't available in the 
is_endorsed function. I googled around and saw solutions for similar 
problems involving overrides of save_model, queryset or 
formfield_for_manytomany, but I couldn't adapt them to list_display, 
because I'm creating a function in the ModelAdmin, where I only know how to 
pass self and obj. Suggestions?

Thanks,
Paulo Almeida

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



Re: list_display showing latest creation date of set?

2012-06-14 Thread Bram de Jong
please ignore this email!

 - bram

On Thu, Jun 14, 2012 at 1:07 PM, Bram de Jong  wrote:
> Hi all,
>
> I have:
>
> class A(models.Model)
>    created =
>
> --
> http://www.samplesumo.com
> http://www.freesound.org
> http://www.smartelectronix.com
> http://www.musicdsp.org
>
> office: +32 (0) 9 335 59 25
> mobile: +32 (0) 484 154 730



-- 
http://www.samplesumo.com
http://www.freesound.org
http://www.smartelectronix.com
http://www.musicdsp.org

office: +32 (0) 9 335 59 25
mobile: +32 (0) 484 154 730

-- 
You received this message because you are subscribed to the Google 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: image in browser

2012-06-14 Thread Satvir Toor
> You better show us the template too.
Problem solved.
Image is displaying just putting the image into the localhost
directories(/var/www/logo.png)
and giving the src attribute as
http://localhost/logo.png"; `width="200" height="200"
alt="image is not available" align="right"/>


-- 
Satvir Kaur
satveerkaur.blogspot.in

-- 
You received this message because you are subscribed to the Google 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 in shared production server

2012-06-14 Thread Melvyn Sopacua
On 13-6-2012 10:28, ruma wrote:

> Now I want to deploy in the production. But  I do not have access to
> the httpd.

Use uwsgi deployment, start it up as your own user then remind the
people at the service that you're paying them and request a config
change to the webserver pointing the hostname to the uwsgi socket, and
aliases for /media/ and /static/. It helps if you provide them with a
copy and paste section.

In the meantime, you can keep developing using django's builtin
development server.
-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google 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: image in browser

2012-06-14 Thread Satvir Toor
On Thu, Jun 14, 2012 at 3:33 PM, kenneth gonsalves
 wrote:
> from the questions you have been asking on the list it seems to me that
> you are unfamiliar with web programming. I suggest that you take some
> time out to learn the basics of web programming and also to understand
> how django works. I suggest you do the tutorial in the official
> documentation. Also you should learn at least the basics of javascript.
> The problem you have been bringing up in the last week is not best
> solved by generating an image on the server side and passing it to the
> template. The problem is solved by generating the data server side,
> passing this data to the template and using a js library to generate and
> render the image on the page.
>
thnx Sir. I will do that.


-- 
Satvir Kaur
satveerkaur.blogspot.in

-- 
You received this message because you are subscribed to the Google 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: 'ascii' codec can't encode character u'\xe4'

2012-06-14 Thread bruno desthuilliers


On Thursday, June 14, 2012 12:35:40 PM UTC+2, lawgon wrote:
>
> hi, 
>
> I have an application which runs on a webfaction hosting.



How is it deployed exactly ? 
(sorry never used webfaction hosting for django - nor for anything else 
FWIW)
 

> I also have 
> the same app running on my devel machine. The code in the two machines 
> are pulled from the same repo. Django versions are identical. Python 
> versions are identical. I try to upload a file called Lisäinfo 
> kummeille.pdf in the dev machine. No problem. When I try the same file 
> in webfaction, I get the above error. I have checked and find I can use 
> python to open and save a file of the same name from the python prompt 
> in the webfaction shell. In templates, admin and and generated pdfs, 
> these non ascii characters are handled perfectly. Has anyone got any 
> clues about this?




Each time I had this problem, it happened that the server process was using 
Apache's default locale, and that Apache default's locale was "C", not the 
utf8 locale configured for users. Not much of a problem for me since I have 
admin access but that may not be the case with webfaction :-/

HTH

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/q1DkO6bIJyUJ.
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: Stuck already on step one, django on windows

2012-06-14 Thread Melvyn Sopacua
On 14-6-2012 9:24, Daniel Patriarca wrote:
> I just installed python, then mysql, then django on my windows 7 machine 
> and I think it worked because I ran the import django comand from python 
> and nothing barked at me.  I thought. yeah... time to hit the tutorial but 
> the first thing it tells me to do is cd to a directory.  Is there a unix 
> emulator that got installed on my windows machine or something?
a) cd works in the "windows shell"
b) http://cygwin.com/ where /bin/sh == bash
c) http://www.virtualbox.org/

c is your best option if you're able to reasonably replicate your
hosting environment.
-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google 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: Accessing request.user in a ModelAdmin function

2012-06-14 Thread Melvyn Sopacua
On 14-6-2012 13:04, Paulo Almeida wrote:

> So then I could just add "is_endorsed" to the list_display variable to have 
> the endorsement status for that user in the Speaker list, in the Admin 
> site. Of course, this doesn't work because request isn't available in the 
> is_endorsed function. I googled around and saw solutions for similar 
> problems involving overrides of save_model, queryset or 
> formfield_for_manytomany, but I couldn't adapt them to list_display, 
> because I'm creating a function in the ModelAdmin, where I only know how to 
> pass self and obj. Suggestions?

In 1.4 you have ModelAdmin.list_filter and can subclass
SimpleListFilter. These get passed the request and the documentation
provides a full example of what you're trying to do.

-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google 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: 'ascii' codec can't encode character u'\xe4'

2012-06-14 Thread kenneth gonsalves
On Thu, 2012-06-14 at 04:19 -0700, bruno desthuilliers wrote:
> > I have an application which runs on a webfaction hosting.
> 
> 
> 
> How is it deployed exactly ? 

apache + wsgi 
> (sorry never used webfaction hosting for django - nor for anything
> else 
> FWIW)

not my choice, client choice
>  
> 
> > I also have 
> > the same app running on my devel machine. The code in the two
> machines 
> > are pulled from the same repo. Django versions are identical.
> Python 
> > versions are identical. I try to upload a file called Lisäinfo 
> > kummeille.pdf in the dev machine. No problem. When I try the same
> file 
> > in webfaction, I get the above error. I have checked and find I can
> use 
> > python to open and save a file of the same name from the python
> prompt 
> > in the webfaction shell. In templates, admin and and generated
> pdfs, 
> > these non ascii characters are handled perfectly. Has anyone got
> any 
> > clues about this?
> 
> 
> 
> 
> Each time I had this problem, it happened that the server process was
> using 
> Apache's default locale, and that Apache default's locale was "C", not
> the 
> utf8 locale configured for users. Not much of a problem for me since I
> have 
> admin access but that may not be the case with webfaction :-/

I think that should be it - my dev server runs nginx (and on my own
server I have root and anyway do not use apache.

-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google 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: Accessing request.user in a ModelAdmin function

2012-06-14 Thread Paulo Almeida
Hi Melvyn,

I've only been reading the Django 1.2 docs, because it's what's immediately 
available in my Linux distribution, but that would be an excellent reason 
to upgrade, if I can get it to work. 

Thanks,
Paulo

On Thursday, June 14, 2012 12:33:34 PM UTC+1, Melvyn Sopacua wrote:
>
> On 14-6-2012 13:04, Paulo Almeida wrote: 
>
> > So then I could just add "is_endorsed" to the list_display variable to 
> have 
> > the endorsement status for that user in the Speaker list, in the Admin 
> > site. Of course, this doesn't work because request isn't available in 
> the 
> > is_endorsed function. I googled around and saw solutions for similar 
> > problems involving overrides of save_model, queryset or 
> > formfield_for_manytomany, but I couldn't adapt them to list_display, 
> > because I'm creating a function in the ModelAdmin, where I only know how 
> to 
> > pass self and obj. Suggestions? 
>
> In 1.4 you have ModelAdmin.list_filter and can subclass 
> SimpleListFilter. These get passed the request and the documentation 
> provides a full example of what you're trying to do. 
>
> -- 
> Melvyn Sopacua 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/VGhuIwcMj9sJ.
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: csrf protection and testing with tsung

2012-06-14 Thread ashutosh bijoor
Thanks for posting this was exactly what I needed :)

On Wednesday, 22 June 2011 14:22:52 UTC+5:30, Ivan Uemlianin wrote:
>
> Dear Malcom 
>
> Thanks very much for your help!  You were exactly right.  The 
> following config works (simplified for exposition). 
>
> Best wishes 
>
> Ivan 
>
>  
>
>  
>
>
>  
>
>  
>
>  
>content_type='application/x-www-form-urlencoded' method='POST'> 
>  
>
>  
>
>
> On Jun 21, 5:54 pm, Malcolm Box  wrote: 
> > On 21 June 2011 16:48, Ivan Uemlianin  wrote: 
> > 
> > > With tsung you record a site visit (called a session) --- log in, view 
> > > various pages, do a few things, log out --- and tsung will then hit 
> > > the site with lots of randomised versions of this session. 
> > 
> > > Many of the views are csrf protected, and the automated requests tsung 
> > > generates don't get through the protection.  For the moment I'm just 
> > > commenting out the csrf middleware in settings.py, but this is 
> > > obviously inconvenient. 
> > 
> > I think you'll need to do some work with dyn_variable to pull the csrf 
> > token out of the original form and re-inject it into the post you send 
> > back. As far as I understand it, all that the csrf protection is is an 
> > opaque value hidden in any form that needs to be present in the 
> > submitted version to be valid. That stops "loose" posts fromCSRF 
> > attacks working as they don't know the magic key. 
> > 
> > Malcolm

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/zr-NH0Kyka4J.
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.



Rss custom feed and add an item eleman

2012-06-14 Thread armagan
Hi,

I want to add an item element to my rss. I used below code

class CustomFeed(Atom1Feed):

def add_item_elements(self, handler, item):

super(CustomFeed, self).add_item_elements(handler, item)

handler.addQuickElement(u"city", item['city'])

And in my rss feed

def item_extra_kwargs(self, item):

return { 'city': item.city, } 

But I have an error

'City' object has no attribute 'replace'

Can you help me?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/N44N-mVZV10J.
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: Accessing request.user in a ModelAdmin function

2012-06-14 Thread Paulo Almeida
Hi again,

>From what I read in the 1.4 docs, the SimpleListFilter example is for 
list_filter and not list_display. To clarify what I wrote before, if a user 
endorses Speaker A and opposes Speaker B, I want the Speaker list in the 
admin site to show:

|Name | Is endorsed |
|A   | True|
|B   |  False |

Having a filter on "Is Endorsed" might be a nice addition, but the main 
goal is to have that table. Would there be a way to get the result of a 
SimpleListFilter into a callable that can be used in list_display? I didn't 
see that in the docs, and it's not obvious to me how to do it.

Thanks,
Paulo

On Thursday, June 14, 2012 1:09:58 PM UTC+1, Paulo Almeida wrote:
>
> Hi Melvyn,
>
> I've only been reading the Django 1.2 docs, because it's what's 
> immediately available in my Linux distribution, but that would be an 
> excellent reason to upgrade, if I can get it to work. 
>
> Thanks,
> Paulo
>
> On Thursday, June 14, 2012 12:33:34 PM UTC+1, Melvyn Sopacua wrote:
>>
>> On 14-6-2012 13:04, Paulo Almeida wrote: 
>>
>> > So then I could just add "is_endorsed" to the list_display variable to 
>> have 
>> > the endorsement status for that user in the Speaker list, in the Admin 
>> > site. Of course, this doesn't work because request isn't available in 
>> the 
>> > is_endorsed function. I googled around and saw solutions for similar 
>> > problems involving overrides of save_model, queryset or 
>> > formfield_for_manytomany, but I couldn't adapt them to list_display, 
>> > because I'm creating a function in the ModelAdmin, where I only know 
>> how to 
>> > pass self and obj. Suggestions? 
>>
>> In 1.4 you have ModelAdmin.list_filter and can subclass 
>> SimpleListFilter. These get passed the request and the documentation 
>> provides a full example of what you're trying to do. 
>>
>> -- 
>> Melvyn Sopacua 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/xXv1KzZUaYUJ.
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: Accessing request.user in a ModelAdmin function

2012-06-14 Thread Alireza Savand


On Thursday, June 14, 2012 3:04:54 PM UTC+4, Paulo Almeida wrote:
>
> Hi,
>
> I would like to access the request.user in a ModelAdmin function, so I can 
> filter the results of a query based on the logged in user. I have these 
> models:
>
> class Speaker(models.Model):
> name = models.CharField(max_length=50)
> endorsements = models.ManyToManyField(User,
>
>  through="Endorsement")
>
> class Endorsement(models.Model):
> speaker = models.ForeignKey('Speaker')
> user = models.ForeignKey(User)
> endorsed = models.NullBooleanField()
>
> class Meta:
> unique_together = ("speaker", "user")
>
> User comes from django.contrib.auth.models. In the ModelAdmin, I would 
> like to have this:
>
> class SpeakerAdmin(admin.ModelAdmin):
> def is_endorsed(self, obj):
> 
> endorsement = Endorsement.objects.get(speaker=obj,
>   
> user=request.user)
> return endorsement.endorsed
>
> So then I could just add "is_endorsed" to the list_display variable to 
> have the endorsement status for that user in the Speaker list, in the Admin 
> site. Of course, this doesn't work because request isn't available in the 
> is_endorsed function. I googled around and saw solutions for similar 
> problems involving overrides of save_model, queryset or 
> formfield_for_manytomany, but I couldn't adapt them to list_display, 
> because I'm creating a function in the ModelAdmin, where I only know how to 
> pass self and obj. Suggestions?
>
> Thanks,
> Paulo Almeida
>

I think you looking for this app
http://pypi.python.org/pypi/django-cuser/

Small piece of middleware to be able to access authentication data from
 everywhere in the django code.


Right ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/7zNoE-as3asJ.
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: Accessing request.user in a ModelAdmin function

2012-06-14 Thread Alireza Savand

And if it's just for logged-in user, you can
do like
https://gist.github.com/2930287
at the ModelAdmin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/mxxG2VwgMeMJ.
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: Accessing request.user in a ModelAdmin function

2012-06-14 Thread Paulo Almeida
Hi Alireza,

Yes, that did the trick!

Thank you,
Paulo

On Thursday, June 14, 2012 2:26:46 PM UTC+1, Alireza Savand wrote:
>
>
>
> On Thursday, June 14, 2012 3:04:54 PM UTC+4, Paulo Almeida wrote:
>>
>> Hi,
>>
>> I would like to access the request.user in a ModelAdmin function, so I 
>> can filter the results of a query based on the logged in user. I have these 
>> models:
>>
>> class Speaker(models.Model):
>> name = models.CharField(max_length=50)
>> endorsements = models.ManyToManyField(User,
>>
>>  through="Endorsement")
>>
>> class Endorsement(models.Model):
>> speaker = models.ForeignKey('Speaker')
>> user = models.ForeignKey(User)
>> endorsed = models.NullBooleanField()
>>
>> class Meta:
>> unique_together = ("speaker", "user")
>>
>> User comes from django.contrib.auth.models. In the ModelAdmin, I would 
>> like to have this:
>>
>> class SpeakerAdmin(admin.ModelAdmin):
>> def is_endorsed(self, obj):
>> 
>> endorsement = Endorsement.objects.get(speaker=obj,
>>   
>> user=request.user)
>> return endorsement.endorsed
>>
>> So then I could just add "is_endorsed" to the list_display variable to 
>> have the endorsement status for that user in the Speaker list, in the Admin 
>> site. Of course, this doesn't work because request isn't available in the 
>> is_endorsed function. I googled around and saw solutions for similar 
>> problems involving overrides of save_model, queryset or 
>> formfield_for_manytomany, but I couldn't adapt them to list_display, 
>> because I'm creating a function in the ModelAdmin, where I only know how to 
>> pass self and obj. Suggestions?
>>
>> Thanks,
>> Paulo Almeida
>>
>
> I think you looking for this app
> http://pypi.python.org/pypi/django-cuser/
>
> Small piece of middleware to be able to access authentication data from
>  everywhere in the django code.
>
>
> Right ?
>
>
On Thursday, June 14, 2012 2:26:46 PM UTC+1, Alireza Savand wrote:
>
>
>
> On Thursday, June 14, 2012 3:04:54 PM UTC+4, Paulo Almeida wrote:
>>
>> Hi,
>>
>> I would like to access the request.user in a ModelAdmin function, so I 
>> can filter the results of a query based on the logged in user. I have these 
>> models:
>>
>> class Speaker(models.Model):
>> name = models.CharField(max_length=50)
>> endorsements = models.ManyToManyField(User,
>>
>>  through="Endorsement")
>>
>> class Endorsement(models.Model):
>> speaker = models.ForeignKey('Speaker')
>> user = models.ForeignKey(User)
>> endorsed = models.NullBooleanField()
>>
>> class Meta:
>> unique_together = ("speaker", "user")
>>
>> User comes from django.contrib.auth.models. In the ModelAdmin, I would 
>> like to have this:
>>
>> class SpeakerAdmin(admin.ModelAdmin):
>> def is_endorsed(self, obj):
>> 
>> endorsement = Endorsement.objects.get(speaker=obj,
>>   
>> user=request.user)
>> return endorsement.endorsed
>>
>> So then I could just add "is_endorsed" to the list_display variable to 
>> have the endorsement status for that user in the Speaker list, in the Admin 
>> site. Of course, this doesn't work because request isn't available in the 
>> is_endorsed function. I googled around and saw solutions for similar 
>> problems involving overrides of save_model, queryset or 
>> formfield_for_manytomany, but I couldn't adapt them to list_display, 
>> because I'm creating a function in the ModelAdmin, where I only know how to 
>> pass self and obj. Suggestions?
>>
>> Thanks,
>> Paulo Almeida
>>
>
> I think you looking for this app
> http://pypi.python.org/pypi/django-cuser/
>
> Small piece of middleware to be able to access authentication data from
>  everywhere in the django code.
>
>
> Right ?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/yJUcQhE-278J.
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 I use Django, Virtualenv and Buildout together

2012-06-14 Thread Andrew Bialecki
Hey everyone,

I wrote a quick blog post on how I use Django with virtualenv and Buildout. 
Hope it's helpful: 
http://www.sophomoredev.com/2012/06/how-i-use-django-virtualenv-and-buildout-together/.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/MAMghPMDvlEJ.
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.



RSS Reader

2012-06-14 Thread armagan
Hi,

I wrote a rss custom feed class and I add an item element with 
'handler.addQuickElement(u"city", item['city'])' this function. It's ok I 
can see the city tags in xml but mozilla's rss reader can't read my city 
tags. What can I do to fix the problem?

Thank you for your advice.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/2nZxegeafg0J.
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: Stuck already on step one, django on windows

2012-06-14 Thread Daniel Roseman
On Thursday, 14 June 2012 08:24:41 UTC+1, Daniel Patriarca wrote:
>
> I just installed python, then mysql, then django on my windows 7 machine 
> and I think it worked because I ran the import django comand from python 
> and nothing barked at me.  I thought. yeah... time to hit the tutorial but 
> the first thing it tells me to do is cd to a directory.  Is there a unix 
> emulator that got installed on my windows machine or something?  I actually 
> do some unix programming in ksh but this is my first time trying to program 
> in a windows environment. Can someone help me get past step one in the 
> tuturial!!!  
>
> I rent space on a server run by hostmonster.com.  Would it be a better 
> idea for me to learn how to do all this straight on my server instead of 
> windows anyways?  I don't even know how to tell if the django stuff works 
> within my hosting environment.
>
> -dan
>

No need for Unix or cygwin. cd works perfectly well in Windows, as does 
Django generally. What specific problem are you having?
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/gI48VrC6K2EJ.
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: 'ascii' codec can't encode character u'\xe4'

2012-06-14 Thread bruno desthuilliers


On Thursday, June 14, 2012 1:58:28 PM UTC+2, lawgon wrote:
>
> On Thu, 2012-06-14 at 04:19 -0700, bruno desthuilliers wrote: 
> > > I have an application which runs on a webfaction hosting. 
> > 
> > 
> > 
> > How is it deployed exactly ? 
>
> apache + wsgi 
>


Ok, so that's the same setup we use... Are you/they using the 
WSGIDaemonProcess and WSGIProcessGroup directives ? (I bet they do if it's 
shared hosting and they know what's good for them). But anyway: I did not 
test the damn thing thoroughly but IIRC the problem appeared whether 
running daemon or embedded mode - the django process env is stil inherited 
from the Apache process. Using os.setenv in the .wsgi script is _supposed_ 
to cure the problem but our experience (here again I did not have time to 
really explore the problem :-/) is that it often doesn't work (can't even 
tell if it ever worked at all), so we alway end up editing apache conf - 
which _is_ a know working solution.

Your best bet here is to first try the os.setenv trick, and if it doesn't 
solve the problem contact webfaction and see what you / they can do.

HTH (and please report the solution)

 

> > (sorry never used webfaction hosting for django - nor for anything 
> > else 
> > FWIW) 
>
> not my choice, client choice 
> >   
> > 
> > > I also have 
> > > the same app running on my devel machine. The code in the two 
> > machines 
> > > are pulled from the same repo. Django versions are identical. 
> > Python 
> > > versions are identical. I try to upload a file called Lisäinfo 
> > > kummeille.pdf in the dev machine. No problem. When I try the same 
> > file 
> > > in webfaction, I get the above error. I have checked and find I can 
> > use 
> > > python to open and save a file of the same name from the python 
> > prompt 
> > > in the webfaction shell. In templates, admin and and generated 
> > pdfs, 
> > > these non ascii characters are handled perfectly. Has anyone got 
> > any 
> > > clues about this? 
> > 
> > 
> > 
> > 
> > Each time I had this problem, it happened that the server process was 
> > using 
> > Apache's default locale, and that Apache default's locale was "C", not 
> > the 
> > utf8 locale configured for users. Not much of a problem for me since I 
> > have 
> > admin access but that may not be the case with webfaction :-/ 
>
> I think that should be it - my dev server runs nginx (and on my own 
> server I have root and anyway do not use apache. 
>
> -- 
> regards 
> Kenneth Gonsalves 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Plu2MEPmJ40J.
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 I use Django, Virtualenv and Buildout together

2012-06-14 Thread Daniel Roseman
On Thursday, 14 June 2012 14:53:11 UTC+1, Andrew Bialecki wrote:
>
> Hey everyone,
>
> I wrote a quick blog post on how I use Django with virtualenv and 
> Buildout. Hope it's helpful: 
> http://www.sophomoredev.com/2012/06/how-i-use-django-virtualenv-and-buildout-together/
> .
>

Nice article. If you're writing about Django you should add your blog to 
the Django community aggregator:
https://www.djangoproject.com/community/
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Be3Aq2O0l1EJ.
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: 'ascii' codec can't encode character u'\xe4'

2012-06-14 Thread Paulo Almeida
Hi,

Have you tried using SetEnv directives in .htaccess to change the locale? 
I'm not sure how that would interact with wsgi, but maybe something like 
this:

http://drumcoder.co.uk/blog/2010/nov/12/apache-environment-variables-and-mod_wsgi/

Of course you'd have to do it in .htaccess instead of Virtual Hosts.

Paulo

On Thursday, June 14, 2012 11:35:40 AM UTC+1, lawgon wrote:
>
> hi, 
>
> I have an application which runs on a webfaction hosting. I also have 
> the same app running on my devel machine. The code in the two machines 
> are pulled from the same repo. Django versions are identical. Python 
> versions are identical. I try to upload a file called Lisäinfo 
> kummeille.pdf in the dev machine. No problem. When I try the same file 
> in webfaction, I get the above error. I have checked and find I can use 
> python to open and save a file of the same name from the python prompt 
> in the webfaction shell. In templates, admin and and generated pdfs, 
> these non ascii characters are handled perfectly. Has anyone got any 
> clues about this? The full traceback is given below: 
>
> Environment: 
>
>
> Request Method: POST 
> Request URL: http://kenyakids.info/admin/web/download/add/ 
>
> Django Version: 1.4a1 
> Python Version: 2.7.3 
> Installed Applications: 
> ('django.contrib.auth', 
>  'django.contrib.contenttypes', 
>  'django.contrib.sessions', 
>  'django.contrib.sites', 
>  'django.contrib.admin', 
>  'django.contrib.staticfiles', 
>  'sorl.thumbnail', 
>  'south', 
>  'kenyakids.web', 
>  'modeltranslation', 
>  'rosetta') 
> Installed Middleware: 
> ('django.middleware.common.CommonMiddleware', 
>  'django.contrib.sessions.middleware.SessionMiddleware', 
>  'django.middleware.locale.LocaleMiddleware', 
>  'django.contrib.auth.middleware.AuthenticationMiddleware', 
>  'django.middleware.doc.XViewMiddleware', 
>  'django.contrib.messages.middleware.MessageMiddleware') 
>
>
> Traceback: 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/core/handlers/base.py" 
> in get_response 
>   111. response = callback(request, 
> *callback_args, **callback_kwargs) 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/contrib/admin/options.py"
>  
> in wrapper 
>   367. return self.admin_site.admin_view(view)(*args, 
> **kwargs) 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/utils/decorators.py" 
> in _wrapped_view 
>   91. response = view_func(request, *args, **kwargs) 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/views/decorators/cache.py"
>  
> in _wrapped_view_func 
>   88. response = view_func(request, *args, **kwargs) 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/contrib/admin/sites.py" 
> in inner 
>   192. return view(request, *args, **kwargs) 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/utils/decorators.py" 
> in _wrapper 
>   25. return bound_func(*args, **kwargs) 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/utils/decorators.py" 
> in _wrapped_view 
>   91. response = view_func(request, *args, **kwargs) 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/utils/decorators.py" 
> in bound_func 
>   21. return func(self, *args2, **kwargs2) 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/db/transaction.py" 
> in inner 
>   209. return func(*args, **kwargs) 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/contrib/admin/options.py"
>  
> in add_view 
>   955. self.save_model(request, new_object, form, False) 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/contrib/admin/options.py"
>  
> in save_model 
>   709. obj.save() 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/db/models/base.py" 
> in save 
>   464. self.save_base(using=using, force_insert=force_insert, 
> force_update=force_update) 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/db/models/base.py" 
> in save_base 
>   552. result = manager._insert([self], fields=fields, 
> return_id=update_pk, using=using, raw=raw) 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/db/models/manager.py" 
> in _insert 
>   203. return insert_query(self.model, objs, fields, **kwargs) 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/db/models/query.py" 
> in insert_query 
>   1576. return 
> query.get_compiler(using=using).execute_sql(return_id) 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/db/models/sql/compiler.py"
>  
> in execute_sql 
>   909. for sql, params in self.as_sql(): 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/db/models/sql/compiler.py"
>  
> in as_sql 
>   872. for obj in self.query.objs 
> File 
> "/home/kenyakids/webapps/django/lib/python2.7/django/db/mod

Re: Stuck already on step one, django on windows

2012-06-14 Thread Gerald Klein
If I understand you correctly it just asking you to enter a directory via
cli, although you may not have ksh,bash or whatever windows still uses a
filesystem. run "cmd" from the start menu run prompt. Then navigate to the
directory they are instructing, some simple commands are duplicated between
both worlds 'cd' being one of them, they are getting you located
in relation to the python environment that you need to access.

On Thu, Jun 14, 2012 at 2:24 AM, Daniel Patriarca  wrote:

> I just installed python, then mysql, then django on my windows 7 machine
> and I think it worked because I ran the import django comand from python
> and nothing barked at me.  I thought. yeah... time to hit the tutorial but
> the first thing it tells me to do is cd to a directory.  Is there a unix
> emulator that got installed on my windows machine or something?  I actually
> do some unix programming in ksh but this is my first time trying to program
> in a windows environment. Can someone help me get past step one in the
> tuturial!!!
>
> I rent space on a server run by hostmonster.com.  Would it be a better
> idea for me to learn how to do all this straight on my server instead of
> windows anyways?  I don't even know how to tell if the django stuff works
> within my hosting environment.
>
> -dan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/IJqLi0kFog4J.
> 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.
>



-- 

Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

j...@zognet.com

708-599-0352


Arch Awesome, Ranger & Vim the coding triple threat.

Linux registered user #548580

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

2012-06-14 Thread creecode
Hello armagan,

A quick guess.  Mozilla's RSS reader doesn't understand your  tag and 
so passes over it and doesn't display it?  If the  tag isn't part of 
the RSS specification  then a 
"standard" reader isn't going to do anything with your tag.  You would need 
either a custom reader or one with an extension.

On Thursday, June 14, 2012 7:44:59 AM UTC-7, armagan wrote:
>
>
> I wrote a rss custom feed class and I add an item element with 
> 'handler.addQuickElement(u"city", item['city'])' this function. It's ok I 
> can see the city tags in xml but mozilla's rss reader can't read my city 
> tags. What can I do to fix the problem?
>

Toodle-looo.
creecode 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/BglqzxjcNYAJ.
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.



from future url -- argh

2012-06-14 Thread JeffH
django 1.4

topapp
  urls.py
...
url(r'^shows/', include('shows.urls')),
  template
base.html
... {% url shows.views.customers %}

shows
  urls.py
..
url(r'^customers/$', 'shows.views.customers')

The above works just fine -- everything is happy except for the deprecation 
warning in debug mode.

So I modify base.html  and add {% load url from future %}  to the top, and 
then put single quotes around the argument {% url 'shows.views.customers' 
%} and django goes Boom!  
"django.core.urlresolvers.NoReverseMatch -- NoReverseMatch: Reverse for '' 
with arguments '()' and keyword arguments '{}' not found."

I've become dizzy trying the different methods specified in the docs 
including setting a name= attr in the shows/urls.py 
url(r'^customers/$', 'shows.views.customers', name='fido')
{% url 'fido' %}

and I get the same message.  Other variations tried:
{% url 'shows_views.customers' %}  - same error

If someone can help me out,I'd appreciate it.

Best,

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/x4uqjgipT9YJ.
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: Admin plugins

2012-06-14 Thread Lachlan Musicman
On Thu, Jun 14, 2012 at 1:20 AM, patrickk  wrote:
> what do you mean with "Grappelli and django-admin-tools are both still being
> developed"?
> both apps have stable releases for quite a while (with grappelli, this is
> even true for a couple of years now).

I was looking for confirmation that they were *actively* developed and
not just getting poked occasionally - I was also looking to see if
there were any others that had flown beneath the radar.

I'd check the commit logs but my connection is too slow to load github

I'll grab both and check them out


cheers
L.

>
> best,
> patrick
>
>
> Am Donnerstag, 14. Juni 2012 00:33:00 UTC+2 schrieb Lachlan Musicman:
>>
>> Hola,
>>
>> I just watched a video from last year about modifying the Django Admin
>> interface. I was wondering if people recommend any particular app?
>>
>> Grappelli and django-admin-tools are both still being developed. Are
>> there any others and if you prefer one, why?
>>
>> Am thinking especially in terms of handing over to no technical staff
>> to do basic admin.
>>
>> cheers
>> L.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/b3P6Y8Lcd9MJ.
> 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.

-- 
You received this message because you are subscribed to the Google 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: 'ascii' codec can't encode character u'\xe4'

2012-06-14 Thread Hendrik Speidel
Hi,

as an alternative you can provide your own Storage implementation like
outlined here:

http://source.mihelac.org/2011/02/6/rename-uploaded-files-ascii-character-set-django/

Note: you may also need to override get_available_name to get it working
if i remember correctly.

hendrik


On 06/14/2012 05:38 PM, Paulo Almeida wrote:
> Hi,
> 
> Have you tried using SetEnv directives in .htaccess to change the
> locale? I'm not sure how that would interact with wsgi, but maybe
> something like this:
> 
> http://drumcoder.co.uk/blog/2010/nov/12/apache-environment-variables-and-mod_wsgi/
> 
> Of course you'd have to do it in .htaccess instead of Virtual Hosts.
> 
> Paulo
> 
> On Thursday, June 14, 2012 11:35:40 AM UTC+1, lawgon wrote:
> 
> hi,
> 
> I have an application which runs on a webfaction hosting. I also have
> the same app running on my devel machine. The code in the two machines
> are pulled from the same repo. Django versions are identical. Python
> versions are identical. I try to upload a file called Lisäinfo
> kummeille.pdf in the dev machine. No problem. When I try the same file
> in webfaction, I get the above error. I have checked and find I can use
> python to open and save a file of the same name from the python prompt
> in the webfaction shell. In templates, admin and and generated pdfs,
> these non ascii characters are handled perfectly. Has anyone got any
> clues about this? The full traceback is given below:
> 
> Environment:
> 
> 
> Request Method: POST
> Request URL: http://kenyakids.info/admin/web/download/add/
> 
> 
> Django Version: 1.4a1
> Python Version: 2.7.3
> Installed Applications:
> ('django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.admin',
>  'django.contrib.staticfiles',
>  'sorl.thumbnail',
>  'south',
>  'kenyakids.web',
>  'modeltranslation',
>  'rosetta')
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.locale.LocaleMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.middleware.doc.XViewMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware')
> 
> 
> Traceback:
> File
> 
> "/home/kenyakids/webapps/django/lib/python2.7/django/core/handlers/base.py"
> in get_response
>   111. response = callback(request,
> *callback_args, **callback_kwargs)
> File
> 
> "/home/kenyakids/webapps/django/lib/python2.7/django/contrib/admin/options.py"
> in wrapper
>   367. return self.admin_site.admin_view(view)(*args,
> **kwargs)
> File
> "/home/kenyakids/webapps/django/lib/python2.7/django/utils/decorators.py"
> in _wrapped_view
>   91. response = view_func(request, *args,
> **kwargs)
> File
> 
> "/home/kenyakids/webapps/django/lib/python2.7/django/views/decorators/cache.py"
> in _wrapped_view_func
>   88. response = view_func(request, *args, **kwargs)
> File
> 
> "/home/kenyakids/webapps/django/lib/python2.7/django/contrib/admin/sites.py"
> in inner
>   192. return view(request, *args, **kwargs)
> File
> "/home/kenyakids/webapps/django/lib/python2.7/django/utils/decorators.py"
> in _wrapper
>   25. return bound_func(*args, **kwargs)
> File
> "/home/kenyakids/webapps/django/lib/python2.7/django/utils/decorators.py"
> in _wrapped_view
>   91. response = view_func(request, *args,
> **kwargs)
> File
> "/home/kenyakids/webapps/django/lib/python2.7/django/utils/decorators.py"
> in bound_func
>   21. return func(self, *args2, **kwargs2)
> File
> "/home/kenyakids/webapps/django/lib/python2.7/django/db/transaction.py"
> in inner
>   209. return func(*args, **kwargs)
> File
> 
> "/home/kenyakids/webapps/django/lib/python2.7/django/contrib/admin/options.py"
> in add_view
>   955. self.save_model(request, new_object, form,
> False)
> File
> 
> "/home/kenyakids/webapps/django/lib/python2.7/django/contrib/admin/options.py"
> in save_model
>   709. obj.save()
> File
> "/home/kenyakids/webapps/django/lib/python2.7/django/db/models/base.py"
> in save
>   464. self.save_base(using=using, force_insert=force_insert,
> force_update=force_update)
> File
> "/home/kenyakids/webapps/django/lib/python2.7/django/db/models/base.py"
> in save_base
>   552. result = manager._insert([self], fields=fields,
> return_id=update_pk, using=using, raw=raw)
> File
> "/home/kenyaki

Re: from future url -- argh

2012-06-14 Thread Andre Terra
I was having the same problem, but with the development version (that is,
1.4+, or soon to be 1.5).

Just remove the {% load url from future %} because the future is NOW! :O

The old {% url %} tag has apparently been deprecated, but I can't find any
notes on this change after 2 mins of googling.

Let me know how it goes.


Cheers,
AT

On Thu, Jun 14, 2012 at 4:00 PM, JeffH  wrote:

> django 1.4
>
> topapp
>   urls.py
> ...
> url(r'^shows/', include('shows.urls')),
>   template
> base.html
> ... {% url shows.views.customers %}
>
> shows
>   urls.py
> ..
> url(r'^customers/$', 'shows.views.customers')
>
> The above works just fine -- everything is happy except for the
> deprecation warning in debug mode.
>
> So I modify base.html  and add {% load url from future %}  to the top, and
> then put single quotes around the argument {% url 'shows.views.customers'
> %} and django goes Boom!
> "django.core.urlresolvers.NoReverseMatch -- NoReverseMatch: Reverse for
> '' with arguments '()' and keyword arguments '{}' not found."
>
> I've become dizzy trying the different methods specified in the docs
> including setting a name= attr in the shows/urls.py
> url(r'^customers/$', 'shows.views.customers', name='fido')
> {% url 'fido' %}
>
> and I get the same message.  Other variations tried:
> {% url 'shows_views.customers' %}  - same error
>
> If someone can help me out,I'd appreciate it.
>
> Best,
>
> Jeff
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/x4uqjgipT9YJ.
> 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.
>

-- 
You received this message because you are subscribed to the Google 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: from future url -- argh

2012-06-14 Thread Andre Terra
Ah, here it is:

https://docs.djangoproject.com/en/dev/internals/deprecation/#id2


Cheers,
AT

On Thu, Jun 14, 2012 at 8:54 PM, Andre Terra  wrote:

> I was having the same problem, but with the development version (that is,
> 1.4+, or soon to be 1.5).
>
> Just remove the {% load url from future %} because the future is NOW! :O
>
> The old {% url %} tag has apparently been deprecated, but I can't find any
> notes on this change after 2 mins of googling.
>
> Let me know how it goes.
>
>
> Cheers,
> AT
>
>
> On Thu, Jun 14, 2012 at 4:00 PM, JeffH  wrote:
>
>> django 1.4
>>
>> topapp
>>   urls.py
>> ...
>> url(r'^shows/', include('shows.urls')),
>>   template
>> base.html
>> ... {% url shows.views.customers %}
>>
>> shows
>>   urls.py
>> ..
>> url(r'^customers/$', 'shows.views.customers')
>>
>> The above works just fine -- everything is happy except for the
>> deprecation warning in debug mode.
>>
>> So I modify base.html  and add {% load url from future %}  to the top,
>> and then put single quotes around the argument {% url
>> 'shows.views.customers' %} and django goes Boom!
>> "django.core.urlresolvers.NoReverseMatch -- NoReverseMatch: Reverse for
>> '' with arguments '()' and keyword arguments '{}' not found."
>>
>> I've become dizzy trying the different methods specified in the docs
>> including setting a name= attr in the shows/urls.py
>> url(r'^customers/$', 'shows.views.customers', name='fido')
>> {% url 'fido' %}
>>
>> and I get the same message.  Other variations tried:
>> {% url 'shows_views.customers' %}  - same error
>>
>> If someone can help me out,I'd appreciate it.
>>
>> Best,
>>
>> Jeff
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/x4uqjgipT9YJ.
>> 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.
>>
>
>

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



trailing slash defeats get_absolute_url

2012-06-14 Thread Mike Dewhirst
My urls are working without a trailing slash but not with one. Django 
version 1.5, Python 2.7.


settings.APPEND_SLASH = True (but there is no difference if it is False)

Here is the working part ...

http://127.0.0.1:8000/item/search

When this search retrieves a list of xitems the urls to display them are 
correct like this ...


http://127.0.0.1:8000/item/xitem/3

... and displays nicely.

Here is the failing one ...

http://127.0.0.1:8000/item/search/

When this search with a trailing slash retrieves the same list the hrefs 
are incorrect because they include the 'search/' fragment like this ...


http://127.0.0.1:8000/item/search/xitem/3

Here is my urls.py which sits in the item directory ...

urlpatterns = patterns('item.views',
url(r'^search', 'search'),
url(r'^xitem/(?P\d+)/$', 'display'),
)

get_absolute_url in the xitem model is ...

def get_absolute_url(self):
return 'xitem/%s' % self.id

Any guidance will be appreciated. I have studied 
https://docs.djangoproject.com/en/dev/topics/http/urls/ and experimented 
with @models.permalink without success.


Thanks

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.



I need a programmer Python Django

2012-06-14 Thread javierlima13
I need a quote for a app Im building using Python on Django framework. 

thx

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



Re: I need a programmer Python Django

2012-06-14 Thread Frankline
It would be best if you listed the requirements or at the very least what
the app is all about.

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



Re: list of year form

2012-06-14 Thread subtitle indo
Sorry for late response.
Thanks kenneth and oscar, it really helps!

On Tue, Jun 5, 2012 at 1:05 PM, Oscar Mederos  wrote:

> On Monday, June 4, 2012, 11:04:58 PM, you wrote:
>
> > Hi All,
> > I want to create list of year select form.
> > I know that i can generate the value using html.
> > Is there a way to generate the value using forms API.
>
> > For example, i want to generate select field that display year from
> 1970-2011.
>
> > Thanks
>
> What about using the 'SelectDateWidget' widget from
> 'django.forms.extras.widgets'? You could so something like:
>
> You can pass a list of years to the constructor. Something like:
>
> from django.forms.extras.widgets import SelectDateWidget
> class MyForm(forms.Form):
>...
>date = forms.DateField(widget=SelectDateWidget(years=range(1970,
> datetime.today().year)))
>...
>
>
> Take a look at the source code of the widget. For example, some time
> ago I created my own SelectDateWidget to override the 'none_value' it
> places by default (---).
>
> --
> Oscar Mederos
> omede...@gmail.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.
>
>

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



Re: I need a programmer Python Django

2012-06-14 Thread Carlos Daniel Ruvalcaba Valenzuela
I work with a freelancer group with a focus on django/python clients,
we can send you a quote if you can tell us more about this project.

Drop me an email to either:

clsdan...@gmail.com
clsdan...@blackchairsoft.com

Regards,
Carlos Ruvalcaba
Blackchair Software

-- 
You received this message because you are subscribed to the Google 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: 'ascii' codec can't encode character u'\xe4'

2012-06-14 Thread kenneth gonsalves
On Thu, 2012-06-14 at 23:46 +0200, Hendrik Speidel wrote:
> as an alternative you can provide your own Storage implementation like
> outlined here:
> 
> http://source.mihelac.org/2011/02/6/rename-uploaded-files-ascii-character-set-django/
> 
> 

I have told the client to use only ascii for the time being - but that
is not a solution - for example assume that the same files are
accessed/uploaded by other applications. 
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google 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: 'ascii' codec can't encode character u'\xe4'

2012-06-14 Thread Xavier Ordoquy
Hi there,

I have faced this kind of error a couple of times when the local wasn't 
correctly set on the system.
Within the python interpreter it was  C (ie ascii) where it should have been 
UTF8.
Up to now, all have been resolved by correctly setting the locals system wide 
and within the web server (see apache setenv as mentioned in earlier post).

Regards,
Xavier Ordoquy,
Linovia.

Le 15 juin 2012 à 07:36, kenneth gonsalves a écrit :

> On Thu, 2012-06-14 at 23:46 +0200, Hendrik Speidel wrote:
>> as an alternative you can provide your own Storage implementation like
>> outlined here:
>> 
>> http://source.mihelac.org/2011/02/6/rename-uploaded-files-ascii-character-set-django/
>> 
>> 
> 
> I have told the client to use only ascii for the time being - but that
> is not a solution - for example assume that the same files are
> accessed/uploaded by other applications. 
> -- 
> regards
> Kenneth Gonsalves
> 
> -- 
> You received this message because you are subscribed to the Google 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.
> 

-- 
You received this message because you are subscribed to the Google 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: 'ascii' codec can't encode character u'\xe4' [solved]

2012-06-14 Thread kenneth gonsalves
On Thu, 2012-06-14 at 08:26 -0700, bruno desthuilliers wrote:
> > apache + wsgi 
> >
> 
> 
> Ok, so that's the same setup we use... Are you/they using the 
> WSGIDaemonProcess and WSGIProcessGroup directives ? (I bet they do if
> it's 
> shared hosting and they know what's good for them).

yes
>  But anyway: I did not 
> test the damn thing thoroughly but IIRC the problem appeared whether 
> running daemon or embedded mode - the django process env is stil
> inherited 
> from the Apache process. Using os.setenv in the .wsgi script is
> _supposed_ 
> to cure the problem but our experience (here again I did not have time
> to 
> really explore the problem :-/) is that it often doesn't work (can't
> even 
> tell if it ever worked at all), so we alway end up editing apache conf
> - 
> which _is_ a know working solution.

they give users a small snippet of httpd.conf which we can edit - I put
this line:

SetEnv Locale UTF8

and it is working. Thanks for the hints, I now remember that I had
solved this problem long ago, but it is so long since I have used
apache, that i had forgotten 
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google 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 I use Django, Virtualenv and Buildout together

2012-06-14 Thread Benedict Verheyen
On 14/06/2012 15:53, Andrew Bialecki wrote:
> Hey everyone,
> 
> I wrote a quick blog post on how I use Django with virtualenv and Buildout. 
> Hope it's helpful:
> http://www.sophomoredev.com/2012/06/how-i-use-django-virtualenv-and-buildout-together/.
> 

Nice article.
However, I do concur with some of the comments made on your blog.
I use pip, virtualenv and fabric so I don't see the advantage of buildout.
It looks complex to me but that's because I haven't really looked into it.
It seems like it's meant to make your application installable as a python 
package?
Or does that make distributing reusable apps easier?

Also, I separate my virtualenv from the source code. In my opinion, it's a much 
more clearer
approach but to each his own. It's nice to have several ways of doing things :)

Regards,
Benedict


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