Still a bug with OR lookups?

2008-05-29 Thread Julien

Hi,

A while ago I stumbled on a bug with OR lookups, but Malcolm had
apparently fixed it in the queryset-refactor branch [1]. However I've
just got a similar issue. Is that still a bug or am I mis-using it?

Here's my model:

class Contact(models.Model):
requesting_user = models.ForeignKey(User,
related_name='contacts_has_requested')
requested_user = models.ForeignKey(User,
related_name='contacts_was_requested')
is_blocked = models.BooleanField(default=False)

Now the test code:

q1 = Q(contacts_was_requested__is_blocked=False,
contacts_was_requested__requesting_user=self)
p1=User.objects.filter(q1)
=> returns: QuerySet: []

q2 = Q(contacts_has_requested__is_blocked=False,
contacts_has_requested__requested_user=self)
p2=User.objects.filter(q2)
=> returns: QuerySet: []

p3=User.objects.filter(q1 | q2)
=> returns: QuerySet: []

Shouldn't the '|' sign do a union of the two intermediary querysets?

Am I missing something?

Thanks a lot,

Julien

[1]
http://groups.google.com/group/django-users/browse_thread/thread/a4679cb9a42c6ba1/1e76718aa0097628?lnk=gst&q=julien+q+malcolm+bug#1e76718aa0097628
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to get child model' name from parent obj in Multi-table inheritance

2008-05-29 Thread [EMAIL PROTECTED]

Guess and test using try; except; statements.  Alternatively, you
could add a type field to Person() and overide the save fields on Man
and Woman to set the type field correctly.

On May 30, 1:38 am, "Davide.D" <[EMAIL PROTECTED]> wrote:
> Simplify the question:
>
> I got a "person", and how to know the "person" is a "man" or a
> "woman" ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Problem State/City Relations

2008-05-29 Thread mimito

I have a form that has two fields (ModelChoiceField)

1. State
2. City

City and State from Spain.

How do to display only the cities of the state selected?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to get child model' name from parent obj in Multi-table inheritance

2008-05-29 Thread Davide.D

Simplify the question:

I got a "person", and how to know the "person" is a "man" or a
"woman" ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to get child model' name from parent obj in Multi-table inheritance

2008-05-29 Thread Davide.D


Multi-table inheritance



model example
===
class Person(models.Model):
name = models.CharField(maxlength=10)
height = models.SmallInteger()


class Man(Person):
job = models.CharField(maxlength=20)


class Woman(Person):
makeup = models.CharField(maxlength=20)


view
===

person_obj = get_object_or_404(Person, pk=person_id)

How to get child model's name from person_obj?

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



Re: Help with request encoding (again)

2008-05-29 Thread Karen Tracey
On Thu, May 29, 2008 at 11:52 PM, John M <[EMAIL PROTECTED]> wrote:

>
> Well, I thought it was working, but alas, now it's not, let me give
> you the latest...
>
> GET /announce/?uploaded=0&compact=1&numwant=80&info_hash=%EF%BF%BDm%EF
> %BF%BDmfD%D8%9A%EF%BF%BD%EF%BF%BD%C7%86%EF%BF%BD8%EF%BF
> %BD&event=started&downloaded=0&key=yoolrpcyku&corrupt=0&peer_id=-
> TR1210-exbira35le7h&port=51413&left=0
>
> In the code:
>
>print "Debug"
>print "query string " + parse_qs(request.META['QUERY_STRING'])
> ['info_hash'][0]
>hash = parse_qs(request.META['QUERY_STRING'])['info_hash']
> [0].encode('hex')
> assert False
>
> The output from the print statements:
> Debug
> query string parseqs�m�mfDؚ��dž�8�
>
> LOCAL Variables
> c
> {'addr': '127.0.0.1', 'peer_id': u'-TR1210-exbira35le7h', 'port':
> 51413}
> hash
> 'efbfbd6defbfbd6d6644d89aefbfbdefbfbdc786efbfbd38efbfbd'
>
>
> and the debug screen snippit
>
> QUERY_STRING
> 'uploaded=0&compact=1&numwant=80&info_hash=%EF%BF%BDm%EF%BF%BDmfD%D8%9A
> %EF%BF%BD%EF%BF%BD%C7%86%EF%BF%BD8%EF%BF
> %BD&event=started&downloaded=0&key=yoolrpcyku&corrupt=0&peer_id=-
> TR1210-exbira35le7h&port=51413&left=0'
>
> Any help would be great!
>
>
What's wrong with the hash it is calculating?  Lining up the %-encoded query
string with the hash produced it looks like everything is correct:

http://dpaste.com/53697/

What is the 'correct' result supposed to be?  Perhaps I misunderstood
exactly how you need to interpret info_hash?

Karen

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



Re: Help with request encoding (again)

2008-05-29 Thread John M

Well, I thought it was working, but alas, now it's not, let me give
you the latest...

GET /announce/?uploaded=0&compact=1&numwant=80&info_hash=%EF%BF%BDm%EF
%BF%BDmfD%D8%9A%EF%BF%BD%EF%BF%BD%C7%86%EF%BF%BD8%EF%BF
%BD&event=started&downloaded=0&key=yoolrpcyku&corrupt=0&peer_id=-
TR1210-exbira35le7h&port=51413&left=0

In the code:

print "Debug"
print "query string " + parse_qs(request.META['QUERY_STRING'])
['info_hash'][0]
hash = parse_qs(request.META['QUERY_STRING'])['info_hash']
[0].encode('hex')
assert False

The output from the print statements:
Debug
query string parseqs�m�mfDؚ��dž�8�

LOCAL Variables
c
{'addr': '127.0.0.1', 'peer_id': u'-TR1210-exbira35le7h', 'port':
51413}
hash
'efbfbd6defbfbd6d6644d89aefbfbdefbfbdc786efbfbd38efbfbd'


and the debug screen snippit

QUERY_STRING
'uploaded=0&compact=1&numwant=80&info_hash=%EF%BF%BDm%EF%BF%BDmfD%D8%9A
%EF%BF%BD%EF%BF%BD%C7%86%EF%BF%BD8%EF%BF
%BD&event=started&downloaded=0&key=yoolrpcyku&corrupt=0&peer_id=-
TR1210-exbira35le7h&port=51413&left=0'

Any help would be great!

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



Re: Help with request encoding (again)

2008-05-29 Thread John M



On May 29, 9:00 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Thu, May 29, 2008 at 10:16 AM, John M <[EMAIL PROTECTED]> wrote:
>
> > Karen,
>
> > Thanks for the response, but I'm unable to unquote the strings as
> > django does it automatically for me when I get the GET list entries.
>
> Oh right, sigh, Django has already helpfully done the un-qoting and
> converted to unicode for the request.GET dictionary.  So, I'd go back to the
> raw query string (accessible as request.META['QUERY_STRING']) and use
> Python's cgi.parse_qs to do the parsing/unquoting but not the unicode step
> -- instead do the hex encoding on what parse_qs returns:
>
> from cgi import parse_qs
> hash = parse_qs(request.META['QUERY_STRING'])['info_hash'][0].encode('hex')
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



hi

2008-05-29 Thread a7lahm
 للحصول على وزن مثالي في يوم واحد ادخل هنا

http://www.antya7la.com/vb/t26066.html
خبر مؤسف ومؤلم اتمنى الدخووول
http://www.antya7la.com/vb/t26168.html

 اختاري لون الصبغ اللي اناسبح ( السايت عجيب) للنساء فقط
http://www.antya7la.com/vb/t26211.html

السلسلة الوثائقية الشيقة Walking with Dinosaurs كاملة 6 حلقات ومترجمه

http://www.antya7la.com/vb/t26210.html

اغتصبوها وجروها بدراجاتهم مسافة 500 متر ... صور

http://www.antya7la.com/vb/t26207.html

صور للتحول الخطير لقبر الشيخ زايد

http://www.antya7la.com/vb/t26202.html

العثور على جنين في إحدى مدارس الرياض ..

http://www.antya7la.com/vb/t26201.html

حصلت على البكالوريوس وعمرها 10 سنوات والدكتوراة وعمرها 14 عاماً

http://www.antya7la.com/vb/t26183.html

شاب ينام في البيوت المهجورة بالرياض والكوابيس تلاحقه..

http://www.antya7la.com/vb/t26200.html

ابتهالات للشيخ نصر الدين طوبار
http://www.antya7la.com/vb/t26166.html

 نبذة عن حياة الشيخ علي الطنطاوي

http://www.antya7la.com/vb/t22188.html

حكم التكبير وذكر والصلاة على النبي في المنتديات..(ارجو
التثبيت )للاهمية

http://www.antya7la.com/vb/t25842.html

جزار مصري أراد حرق »قلب« القتيل والتخلص من دين 1300 دينار
http://www.antya7la.com/vb/t26189.html

قام بوضع العصا في مؤخرته وتصويره بهاتف محمول!!
http://www.antya7la.com/vb/t26187.html

صور وسائط مجموعة

http://www.antya7la.com/vb/t25923.html

كانت ممددة وعاريه والشيطان اغراني

http://www.antya7la.com/vb/t25230.html

برنامج Sothink من أقوى برامج تفكيك الفلاش
http://www.antya7la.com/vb/t1419.html

اردني يقتل ابنة عمه امام القاضي ورجال الأمن لرفضها الزواج منه

http://www.antya7la.com/vb/t26188.html

انتشار صور الجوال يغذي جرائم الشرف بكردستان العراق

http://www.antya7la.com/vb/t26185.html

الرئيس الغامبي يهدد بقطع رؤوس كل مثليي الجنس
http://www.antya7la.com/vb/t26182.html

العريس الثرى دعا زوجته للجنس الجماعى فخلعته
http://www.antya7la.com/vb/t26177.html

زوج اكتشف بالصدفة خيانة زوجته له بعد 15 سنة زواج

http://www.antya7la.com/vb/t26169.html


كيف تكونين صديقة دائمة لزوجك؟
http://www.antya7la.com/vb/t25690.html

ملابس نوم مريحة للحامل

http://www.antya7la.com/vb/t26165.html

تعلم طريقة عمل بنر اعلاني بالفوتو شوب سهل جدا

http://www.antya7la.com/vb/t25843.html
ملابس مواليد
http://www.antya7la.com/vb/t26160.html

خطورة حبس البكــاء!!

http://www.antya7la.com/vb/t26033.html

هدية المولود

http://www.antya7la.com/vb/t26156.html

ملابس شيك للحوامل

http://www.antya7la.com/vb/t26155.html

بجايم للحوامل من La Senza2008

http://www.antya7la.com/vb/t26154.html

صور لمفارش البيبي وكيلونات تجنن

http://www.antya7la.com/vb/t26153.html

مايووهات اطفال

http://www.antya7la.com/vb/t26152.html

اطقم نوم للعرووس

http://www.antya7la.com/vb/t26151.html

حذاء العروس

http://www.antya7la.com/vb/t26150.html

فساتين زفاف من محل الزهور

http://www.antya7la.com/vb/t26149.html

افكار رائعه لتزين وترتيب جهازالعروسه

http://www.antya7la.com/vb/t26148.html

صور ابطال مسلسل سنوات الضياع


http://www.antya7la.com/vb/t22715.html

آكــرٌٍهٍَكَ .. لكَـنْيَ آجـــدًٍكَ جًْــزٍُءآ منْــيَ.,!!

http://www.antya7la.com/vb/t25956.html
عيش بقلب .. وابتسم بقلب .. وسامح بقلب
http://www.antya7la.com/vb/t25961.html

هـــل تبكي عندما يموت من جرحكـ يوماً ما ؟؟؟
http://www.antya7la.com/vb/t26032.html

طفلة عمرها 12 عاما ومبدعة

http://www.antya7la.com/vb/t2014.html

الرجل الذي تحول لشجره ... مع الصور.!!
http://www.antya7la.com/vb/t25856.html

الفرق بين كلمة (الله ) وكلمة ( اللة ) أمر خطييير جداً ...

http://www.antya7la.com/vb/t24746.html

رفقاً بالعيون

http://www.antya7la.com/vb/t24752.html



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



Re: WebFaction memories

2008-05-29 Thread Eric Abrahamsen

A single django app running under mod_python seems to use about  
20-30MB of memory no matter what, but I think that number holds pretty  
steady unless you're really getting a lot of traffic (and memcached  
will save your life no matter what). I'm running several small- to  
medium-sized sites on Webfaction, and my setup is Apache compiled with  
the worker MPM, and the sites running under virtual hosts with  
mod_wsgi. The big saving is in the worker MPM, which will keep your  
memory usage down as long as your traffic's low.

Eric

On May 30, 2008, at 4:31 AM, Pigletto wrote:

>
>> Someone have some experiences to compile scipy and dependances on  
>> WebFaction
>> hosting ?
> For me, the biggest problem at Webfaction (but not only there) is
> limited memory size. But if you have so small traffic then 85 MB of
> memory should be enough, especially if you set up your django with
> mod_wsgi - see threads about mod_wsgi at this list ( in periods of
> inactivity your memory may be freed by mod_wsgi daemon) or at
> webfaction forum.
>
> If you want to compile additional modules at webfaction, this should
> work. I haven't tried scipy, but I've compiled mod_python, apache, mc,
> psycopg2, mod_auth_tkt and few other things and this always worked. If
> you have problem then I'm sure that Webfaction support will help you.
>
> --
> Maciej Wisniowski
> http://moto-notes.com
> >


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



Re: Sorl Thumbnail, automatically create in admin

2008-05-29 Thread Andrew Myers

On May 29, 11:29 am, "Josh.MIPS" <[EMAIL PROTECTED]> wrote:
> Does anyone know a way to force Sorl to create
> the thumbnails as soon as an object is saved in the admin interface,
> rather than waiting until a thumbnail is needed in a template?

You could override the model's save() method to have it create (and
immediately discard) a sorl.main.thumbnail.DjangoThumbnail instance,
which would generate the thumbnail image.

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



Re: time and attendance management system

2008-05-29 Thread Graham Dumpleton

No, step 2.5 is needed.

Ask on Django list why you can't get it working, especially where you
couldn't be bothered to read the instructions properly. ;-)

On May 30, 3:23 am, "Guillaume Lederrey"
<[EMAIL PROTECTED]> wrote:
> I'm afraid you missed step 7 :
>
> 7) profit !
>
> 2008/5/29 Tim Chase <[EMAIL PROTECTED]>:
>
>
>
>
>
> >> hi...related to the same problem i also have to designe
> >> forms,reports and tables for ma data base ...will plz guide me
>
> > It's a fairly trivial process so I will guide you:
>
> > 1) get a server (I recommend Debian GNU/Linux)
> > 2) install the following:
>
> >   Python
> >   Django
> >   a web-server such as Apache/lighttpd
> >   a web-server interface:  mod_python/mod_wsgi/fastcgi/etc
> >   a database (PostgreSQL, MySQL or sqlite are popular choices)
>
> > 3) do lots of hard work:
> >   - design your application, data-structures, and tests
> >   - implement your design
>
> > 4) deploy your design
>
> > 5) fix bugs
>
> > 6) repeat steps 3-6 until your code is perfect
>
> > I leave step #3 as an exercise to the reader.  If you get stuck
> > on particular issues, this list and the comp.lang.python mailing
> > list are helpful places to get specific help.  However, as
> > friendly as both places are, neither will be a replacement for
> > doing the hard work yourself.
>
> > -tim
>
> --
> Jabber : [EMAIL PROTECTED]
> Skype : Guillaume.Lederrey
> Projects :
> *http://rwanda.ledcom.ch/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: order_by foreign key problem

2008-05-29 Thread Johannes Dollinger

Wah, nevermind ..

Am 30.05.2008 um 01:27 schrieb Johannes Dollinger:

>
>> Should this work??
>>
>>   results = Gear.objects.select_related().order_by 
>> (generic_info__hits)
>
> Quotes are missing:
>
> Gear.objects.select_related().order_by('generic_info__hits')
>
>
>
>
>
> >



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



Re: local import or not for django apps?

2008-05-29 Thread Gregor Müllegger

I also think that apps should live in somewhere in your python path.
But if you can use Python 2.5 for your django projects you could also
write imports in the following style.

from . import spam

This imports the module "spam" from the folder the sourcefile lives
in.
It's much cooler than just doing a "import spam" because you can also
call
a file "django.py" or "sys.py" in your app without collidating with
the standard library
and athors thirdparty packages.

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



Re: order_by foreign key problem

2008-05-29 Thread Johannes Dollinger

> Should this work??
>
>   results = Gear.objects.select_related().order_by(generic_info__hits)

Quotes are missing:

Gear.objects.select_related().order_by('generic_info__hits')





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



Re: i18n issues.

2008-05-29 Thread Ramiro Morales

Jack,

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

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

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

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

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

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

   and here:

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

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

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

Regards,

--
 Ramiro Morales

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



Modelform FileField

2008-05-29 Thread Bruce Dockeray

  I have a modelform bound to a table. One of the fields in the table is 
a FileField. I able to upload  files using the modelform and this works 
well.

  Once i have uploaded a file if i look at the database record using the 
modelform the FileField continues to display as a file upload widget and 
consequently the path&name of the file don't show. This is frustrating 
as i would like to be able to see this.  I wondered whether i could 
introduce a custom field onto the modelform and then set the value of 
the custom field to be the stored string value of the FileField ... but 
i can't work out how to set the value of the custom field !

Any ideas suggestions welcome ..

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



Re: order_by foreign key problem

2008-05-29 Thread Richard Dahl
I am not sure what is going on, however I wonder if it has something to do
with the OneToOne relationship, I do not use onetoone myself but notice in
the following from the db-api documentation:

Note that the select_related() QuerySet method recursively prepopulates the
cache of all one-to-many relationships ahead of time.

Try to do it without the select_related to see if you can get the query to
execute.  I know this will mean an additional hit on the db to access the
related model, but I can't think of anything else.

hth,

-richard



On 5/29/08, robstar <[EMAIL PROTECTED]> wrote:
>
>
> Oops, I had the ' ' in there somewhere in all my different iterations
> of trying to make this work .. so the query works, but I can't access
> the object in the template, or from the shell for that matter.   Does
> something change by doing this type of query?
>
> On the shell:
>
> >>> gear = Gear.objects.select_related().order_by('-generic_info__hits')
> >>> print gear
>
> Traceback (most recent call last):
> File "", line 1, in ?
> File "/usr/lib/python2.3/site-packages/django/db/models/query.py",
> line 108, in __repr__
>return repr(self._get_data())
> File "/usr/lib/python2.3/site-packages/django/db/models/query.py",
> line 483, in _get_data
>self._result_cache = list(self.iterator())
> File "/usr/lib/python2.3/site-packages/django/db/models/query.py",
> line 189, in iterator
>cursor.execute("SELECT " + (self._distinct and "DISTINCT " or "")
> + ",".join(select) + sql, params)
> File "/usr/lib/python2.3/site-packages/django/db/backends/util.py",
> line 18, in execute
>return self.cursor.execute(sql, params)
> File "/usr/lib/python2.3/site-packages/MySQLdb/cursors.py", line
> 163, in execute
>self.errorhandler(self, exc, value)
> File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line
> 35, in defaulterrorhandler
>raise errorclass, errorvalue
> OperationalError: (1054, "Unknown column
> 'itemengine_gear.generic_info__hits' in 'order clause'")
>
>    The template chokes the same way trying to access the object...
> I shouldn't have to change my code?
>
> rob
>
> On May 29, 4:16 pm, "Richard Dahl" <[EMAIL PROTECTED]> wrote:
> > http://www.djangoproject.com/documentation/db-api/
> > contains the info you want.  Try this:
> > Gear.objects.select_related().order_by('generic_info__hits')
> >
> > you could also set the order_by in the Meta of Item to hits and then you
> > could just do:
> > Gear.objects.select_related().order_by('generic_info')
> >
> > hth,
> > -richard
> >
> > On 5/29/08, robstar <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > Hey guys,
> >
> > > I read through some of the threads here, but still can't get this
> > > simple scenario to work..
> >
> > > DB name: gcdb
> >
> > > class Item(models.Model):
> > >   hits= models.IntegerField(default=0)
> >
> > > class Gear(models.Model):
> > > generic_info= models.OneToOneField(Item)
> >
> > > Should this work??
> >
> > > results = Gear.objects.select_related().order_by(generic_info__hits)
> >
> > > I also tried putting the db name in there like I saw in some old
> > > examples:
> >
> > > results =
> > > Gear.objects.select_related().order_by(gcdb_generic_info__hits)
> >
> > > Both result in the field not being found..  Any ideas???  thanks!
> >
> > > rob
> >
>

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



Re: order_by foreign key problem

2008-05-29 Thread robstar

Oops, I had the ' ' in there somewhere in all my different iterations
of trying to make this work .. so the query works, but I can't access
the object in the template, or from the shell for that matter.   Does
something change by doing this type of query?

On the shell:

>>> gear = Gear.objects.select_related().order_by('-generic_info__hits')
>>> print gear

Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py",
line 108, in __repr__
return repr(self._get_data())
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py",
line 483, in _get_data
self._result_cache = list(self.iterator())
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py",
line 189, in iterator
cursor.execute("SELECT " + (self._distinct and "DISTINCT " or "")
+ ",".join(select) + sql, params)
  File "/usr/lib/python2.3/site-packages/django/db/backends/util.py",
line 18, in execute
return self.cursor.execute(sql, params)
  File "/usr/lib/python2.3/site-packages/MySQLdb/cursors.py", line
163, in execute
self.errorhandler(self, exc, value)
  File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line
35, in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1054, "Unknown column
'itemengine_gear.generic_info__hits' in 'order clause'")

   The template chokes the same way trying to access the object...
I shouldn't have to change my code?

rob

On May 29, 4:16 pm, "Richard Dahl" <[EMAIL PROTECTED]> wrote:
> http://www.djangoproject.com/documentation/db-api/
> contains the info you want.  Try this:
> Gear.objects.select_related().order_by('generic_info__hits')
>
> you could also set the order_by in the Meta of Item to hits and then you
> could just do:
> Gear.objects.select_related().order_by('generic_info')
>
> hth,
> -richard
>
> On 5/29/08, robstar <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hey guys,
>
> > I read through some of the threads here, but still can't get this
> > simple scenario to work..
>
> > DB name: gcdb
>
> > class Item(models.Model):
> >   hits= models.IntegerField(default=0)
>
> > class Gear(models.Model):
> > generic_info= models.OneToOneField(Item)
>
> > Should this work??
>
> > results = Gear.objects.select_related().order_by(generic_info__hits)
>
> > I also tried putting the db name in there like I saw in some old
> > examples:
>
> > results =
> > Gear.objects.select_related().order_by(gcdb_generic_info__hits)
>
> > Both result in the field not being found..  Any ideas???  thanks!
>
> > rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: order_by foreign key problem

2008-05-29 Thread robstar

Oops, I had the ' ' in there somewhere in all my different iterations
of trying to make this work .. so the query works, but I can't access
the object in the template, or from the shell for that matter.   Does
something change by doing this type of query?

On the shell:

>>> gear = Gear.objects.select_related().order_by('-generic_info__hits')
>>> print gear
Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py",
line 108, in __repr__
return repr(self._get_data())
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py",
line 483, in _get_data
self._result_cache = list(self.iterator())
  File "/usr/lib/python2.3/site-packages/django/db/models/query.py",
line 189, in iterator
cursor.execute("SELECT " + (self._distinct and "DISTINCT " or "")
+ ",".join(select) + sql, params)
  File "/usr/lib/python2.3/site-packages/django/db/backends/util.py",
line 18, in execute
return self.cursor.execute(sql, params)
  File "/usr/lib/python2.3/site-packages/MySQLdb/cursors.py", line
163, in execute
self.errorhandler(self, exc, value)
  File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line
35, in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1054, "Unknown column
'itemengine_knives.generic_info__hits' in 'order clause'")


   The template chokes the same way trying to access the object...
I shouldn't have to change my code?

rob





On May 29, 4:16 pm, "Richard Dahl" <[EMAIL PROTECTED]> wrote:
> http://www.djangoproject.com/documentation/db-api/
> contains the info you want.  Try this:
> Gear.objects.select_related().order_by('generic_info__hits')
>
> you could also set the order_by in the Meta of Item to hits and then you
> could just do:
> Gear.objects.select_related().order_by('generic_info')
>
> hth,
> -richard
>
> On 5/29/08, robstar <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hey guys,
>
> > I read through some of the threads here, but still can't get this
> > simple scenario to work..
>
> > DB name: gcdb
>
> > class Item(models.Model):
> >   hits= models.IntegerField(default=0)
>
> > class Gear(models.Model):
> > generic_info= models.OneToOneField(Item)
>
> > Should this work??
>
> > results = Gear.objects.select_related().order_by(generic_info__hits)
>
> > I also tried putting the db name in there like I saw in some old
> > examples:
>
> > results =
> > Gear.objects.select_related().order_by(gcdb_generic_info__hits)
>
> > Both result in the field not being found..  Any ideas???  thanks!
>
> > rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Creating a request object + middleware benefits

2008-05-29 Thread Peter

I'm looking for a quick and simple way to create a request object - as
it would be received by a specific view - for some very basic
testing.  Additionally, I want this object to have all the added
attributes from the middleware modules e.g. request.user.

I tried this:

(1)
I looked at django.http.HttpRequest.  Easy to construct, but (based on
what I saw in django.core.handlers.base.py) it requires manually
looping through the middleware.  Also, it requires special work of
managing cookies to perform a login.

(2)
I looked at the test code - django.test.client.Client - which makes
building a request much easier and handles the login.  However, I'm
not running django's test runner and I do not plan on using it for
this case - which means I lose the "black magic" that pulls context
variables - so when I get a response, I cannot grab the HttpRequest
object - just the dict that gets stored as response.request.  Is there
a reason why the HttpRequest object isn't added?

I performed a little hack around this by modifying the test Client
code to add the request as an attribute to the response before it is
returned.

django/test/client.py L38
request = WSGIRequest(environ)
response = self.get_response(request)
response.d_request = request # modified line

This works with the two shortcomings (1) I had to hack the source code
to get the value and (2) I'd prefer if I could grab this object
*without actually making the request*, which may modify my underlying
database.

Does anyone know a solution to this (apart from extending BaseHandler,
rewriting the get_response method, and then performing some more
modifications to a new class that would extends test.Client --
hopefully I'm missing something more obvious here...)?  Any help would
be greatly appreciated.

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



Re: Some strange "cache" behavior

2008-05-29 Thread Fabien

Hello

>> I've tried with never_cache, but it doesn't work. The strange thing is
>> that today, I've added a new blog post, which was immediately visible
>> from the post list and post details. But some hours later it
>> disappears until I restart Apache. I really don't understand where the
>> problem can be.
>
> I also have this issue, especially with generic views.  I use lighttpd
> and fastcgi.
>
> I've tried using lambda to grab my querysets, but that doesn't work.

I've resolved my problem and a an Apache instability problem by
switching to mod_wsgi from mod_python. One day with no problems after
the need to restart apache every hours with mod_python.

-- 
Fabien SCHWOB

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



Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-29 Thread Johannes Dollinger

You could use a filter:

@register.filter(name='concat')
def concat(value, arg):
return "%s%s" % (value, arg)

and then {% include dir|concat:"/tag.html" %}.


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



local import or not for django apps?

2008-05-29 Thread Milan Andric

http://code.google.com/p/django-survey/issues/detail?id=9&can=1

Anyone happen to have a strong opinion on this?  Should django
applications use local imports or package based imports?  Sorry if
this has been mulled over a million times.

pasting conversation here:

Comment 2 by doug.napoleone, Today (90 minutes ago)

NOTE: The convention is moving to local imports over package named
imports for
reusable apps. For instance one client of django-survey has all their
3rd party apps
under 'externals' and imports those apps as externals.survey.models

This means that they have to edit our imports to use the prefix
'externals.'
In general when doing package development in python, local imports are
preferred over
absolute as you do not have control over what 'absolute' actually is.

Comment 3 by mandric, Today (76 minutes ago)

no shit ... news to me.  When I went to the python conference in
Chicago this year,
all I heard was that local imports are evil.  But I guess it all
depends.

I also thought one of the basic tenants of app development is that the
app should
always sit on the python path.  I wonder what ubernostrum's take is on
this because
releases (django-registration, django-profiles) use package based
imports.  And those
apps have been around for a long time, he is also a core maintainer
and gets paid to
work on Django from the what I know.

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



Re: WebFaction memories

2008-05-29 Thread Pigletto

> Someone have some experiences to compile scipy and dependances on WebFaction
> hosting ?
For me, the biggest problem at Webfaction (but not only there) is
limited memory size. But if you have so small traffic then 85 MB of
memory should be enough, especially if you set up your django with
mod_wsgi - see threads about mod_wsgi at this list ( in periods of
inactivity your memory may be freed by mod_wsgi daemon) or at
webfaction forum.

If you want to compile additional modules at webfaction, this should
work. I haven't tried scipy, but I've compiled mod_python, apache, mc,
psycopg2, mod_auth_tkt and few other things and this always worked. If
you have problem then I'm sure that Webfaction support will help you.

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



Re: order_by foreign key problem

2008-05-29 Thread Richard Dahl
http://www.djangoproject.com/documentation/db-api/
contains the info you want.  Try this:
Gear.objects.select_related().order_by('generic_info__hits')

you could also set the order_by in the Meta of Item to hits and then you
could just do:
Gear.objects.select_related().order_by('generic_info')


hth,
-richard


On 5/29/08, robstar <[EMAIL PROTECTED]> wrote:
>
>
> Hey guys,
>
> I read through some of the threads here, but still can't get this
> simple scenario to work..
>
> DB name: gcdb
>
> class Item(models.Model):
>   hits= models.IntegerField(default=0)
>
> class Gear(models.Model):
> generic_info= models.OneToOneField(Item)
>
>
> Should this work??
>
> results = Gear.objects.select_related().order_by(generic_info__hits)
>
> I also tried putting the db name in there like I saw in some old
> examples:
>
> results =
> Gear.objects.select_related().order_by(gcdb_generic_info__hits)
>
>
> Both result in the field not being found..  Any ideas???  thanks!
>
> rob
>
> >
>

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



Re: ModelChoiceField, Cascading Selections

2008-05-29 Thread Richard Dahl
Two options I can think of quickly:
1. in the __init__ of the form, see if a value has been passed in for the
League and School and only if there is none, create the queryset as
described.
2. Do not use a model form to create the initial form, just use a simple
template and the javascript you have to accept the entries, and then upon
submit pass it to the form without the default none()'s for validation.

A third option is (using javascript) ask the user what school they go
to/went to/would like to go to or whatever and then after verification that
it is a valid choice, fill out the League and State for them.  The way you
have described sounds a bit overly complex from a usability point of view.
But I obviously do not understand your detailed requirements.
HTH,
-richard



On 5/29/08, Adi <[EMAIL PROTECTED]> wrote:
>
>
> I have a form that has three fields
> 1. State
> 2. League
> 3. School
>
> The model for League has a foreign Key into the model for State
> The model for School has a foreign Key into the model for League
>
> The user is supposed to chose the state first (which is USStateField),
> then the list of League is supposed to get populated. The use is
> supposed to choose the League which is supposed to populate the
> choices of School for the user to select. The user finally is supposed
> to select school.
>
> The three fields are as follows:
> state = USStateField(required=True,widget=USStateSelect)
>league = forms.ModelChoiceField(queryset=League.objects.none(),
> empty_label="Please select state first", cache_choices=True,
> required=False, label="League")
>school = forms.ModelChoiceField(queryset=School.objects.none(),
> empty_label="Please select league first", cache_choices=True,
> required=False, label="School")
>
> I have the JS implemented that populates the fields dynamically based
> on user selection and that is working fine.
>
> My questions are as follows:
> 1. If I select the three fields, and submit the form, I get back an
> error saying "Select a valid choice. That choice is not one of the
> available choices." for both the League and School fields. So,
> basically the values are not sticking to the form. I guess this is
> because my queryset specifies League.objects.none(). How do I make the
> values bind to the fields without having to resort to changing the
> queryset to  League.objects.all(). I don't want to do this cos the
> League data is huge.
>
> 2. Since the fields don't bind to the values, when the form get
> redisplayed, the values are not redisplayed.
>
> I am struggling with the ModelChoiceField in general as well.
>
> >
>

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



ModelChoiceField, Cascading Selections

2008-05-29 Thread Adi

I have a form that has three fields
1. State
2. League
3. School

The model for League has a foreign Key into the model for State
The model for School has a foreign Key into the model for League

The user is supposed to chose the state first (which is USStateField),
then the list of League is supposed to get populated. The use is
supposed to choose the League which is supposed to populate the
choices of School for the user to select. The user finally is supposed
to select school.

The three fields are as follows:
state = USStateField(required=True,widget=USStateSelect)
league = forms.ModelChoiceField(queryset=League.objects.none(),
empty_label="Please select state first", cache_choices=True,
required=False, label="League")
school = forms.ModelChoiceField(queryset=School.objects.none(),
empty_label="Please select league first", cache_choices=True,
required=False, label="School")

I have the JS implemented that populates the fields dynamically based
on user selection and that is working fine.

My questions are as follows:
1. If I select the three fields, and submit the form, I get back an
error saying "Select a valid choice. That choice is not one of the
available choices." for both the League and School fields. So,
basically the values are not sticking to the form. I guess this is
because my queryset specifies League.objects.none(). How do I make the
values bind to the fields without having to resort to changing the
queryset to  League.objects.all(). I don't want to do this cos the
League data is huge.

2. Since the fields don't bind to the values, when the form get
redisplayed, the values are not redisplayed.

I am struggling with the ModelChoiceField in general as well.

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



Re: Error while importing URLconf '{{ project_name }}.urls'...

2008-05-29 Thread Karen Tracey
On Thu, May 29, 2008 at 2:23 PM, nib <[EMAIL PROTECTED]> wrote:

> OK, I put ROOT_URLCONF = {{ project_name }}.urls back in the c:
> \python25\Lib\site-packages\django\conf\project_template\settings.py
> file.


Er...this is the settings file you've been editing?  This one is not
intended to be edited, you should edit the one created by djang-admin.py
startproject.

I then create a new package - jrl.


How and where did you create a new package?  You should have some completely
independent directory tree where you are going to put your code, like
c:\django_projects.  Not intermingled with stuff in c:\python25 or
c:\django.  Then, from a command prompt where you are in c:\django_projects:

django-admin.py startproject jrl

will create a subdirectory jrl of c:\django_projects and populate it with
files including settings.py, manage.py, etc.  That's the settings.py you
want to be editing.

I then tried to access the admin site and I got a DATABASE_ENGINE not
> set error.
> I set the DATABASE_ENGINE to 'SQLite3' and then I ran the 'python
> manage.py syncdb' command with no success.  I had to move the SQLite3
> files from c:\django\db\backends to C:\Python25\Lib\site-packages
> \django\db\backends.  I then re-ran the 'python manage.py syncdb'
> command and now I can access the Admin page.
>

The fact that you had some django code under
c:\Python25\Lib\site-packages\django but not all of it is puzzling and
indicates a problem with your installation.  You should not have had to do
any manual moving like that, and I'd be a little concerned there was other
stuff missing.  How, exactly, did you originally get the django code into
site-packages?  If you used setup.py I hope you are using a fairly recent
SVN checkout of Django because there were some problems with that script on
Windows, but I think they were all fixed a few months ago (and the problems
never manifested as missing code bits, so actually I'm very confused how you
system got into this state even if you are using an old release).

 Karen

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



Re: Django and Comma-Formatting Numbers

2008-05-29 Thread James Bennett

On Thu, May 29, 2008 at 1:15 PM, David <[EMAIL PROTECTED]> wrote:
> I had need of commas in floating-point numbers, and slightly modified
> humanize.py with a floatcomma function:
>
> def floatcomma(value):
>"""
>Converts a float to a string containing commas every three digits.
>For example, 3000.65 becomes '3,000.65' and -45000.00 becomes
> '-45,000.00'.
>"""

Of course, keep in mind that this has internationalization issues;
there are places where the number "three thousand point six five" is
written "3000,65" or even "3.000,65".


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

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



Re: Help with request encoding (again)

2008-05-29 Thread John M

Well, either way, thank you so much for helping me on this.

The more I dive into the framework and more so, Python, the more I
know i've made the right choice.

John

On May 29, 11:15 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Thu, May 29, 2008 at 1:16 PM, John M <[EMAIL PROTECTED]> wrote:
> > Ill give that a try, but seems like I'm working against the framework
> > doesn't it?
>
> Nah, working against the framework would be rooting around in undocumented
> internal data structures to get the data you are looking for.
> HttpRequest.META['QUERY_STRING'] is documented 
> (http://www.djangoproject.com/documentation/request_response/#attributes) and
> the rest is just standard Python library code.
>
> > I could swear I was able to set the encoding, GET the fields I wanted
> > and then do it another way, but I need to move on in my coding, I hope
> > this works.
>
> There may be some way to un-do the unicodification but it isn't obvious to
> me.  Fact is you don't want this query parameter turned into unicode, you
> want he hex representation of what's essentially a  byte string, represented
> in the url as a mix of ASCII and percent-encoded octets.  For that I think
> it is more straightforward to start with the raw query string vs. attempting
> to reverse what the framework did in constructing the request.GET
> dictionary.  But that's just my opinion, of course.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error while importing URLconf '{{ project_name }}.urls'...

2008-05-29 Thread nib

OK, I put ROOT_URLCONF = {{ project_name }}.urls back in the c:
\python25\Lib\site-packages\django\conf\project_template\settings.py
file.
I then create a new package - jrl.
I then tried to access the admin site and I got a DATABASE_ENGINE not
set error.
I set the DATABASE_ENGINE to 'SQLite3' and then I ran the 'python
manage.py syncdb' command with no success.  I had to move the SQLite3
files from c:\django\db\backends to C:\Python25\Lib\site-packages
\django\db\backends.  I then re-ran the 'python manage.py syncdb'
command and now I can access the Admin page.

Thank you for your time.

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



Re: I cannot get Django to process files.

2008-05-29 Thread Eric

Wow. That fixed it. Thank you!  I didn't realize I was so close. I
obviously have a bit to learn about Django (and Apache). This should
help get me started.


On May 29, 10:56 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Thu, May 29, 2008 at 1:40 PM, Eric <[EMAIL PROTECTED]> wrote:
>
> > I simply cannot get this to work. I am attempting to run Python/Django
> > on Apache/Windows. When I run the mpinfo it shows the mod_python
> > service is available, but i cannot even view the most simple example
> > shown in the online book (current_datetime view).  I am using the
> > basic installation (ie my project is in the 'mysite' directory of my
> > wwwroot (c:/websites/ericlezotte/mysite/) and my simple view is in the
> > 'mysite/views.py' file.  When I browse this view to test it at 'http://
> >www.ericlezotte.com/time/'I get a 404 error.  ANY help with this
> > would be greatly appreciated.  Below is my Apache config code for this
> > site is:
>
> > 
> >   ServerNamewww.ericlezotte.com
> >   DocumentRoot "C:/Websites/ericlezotte/"
> >   UserDir "C:/Websites/ericlezotte/"
> >   ServerAlias ericlezotte.com *.ericlezotte.com
>
> >   
> > SetHandler python-program
> > PythonHandler django.core.handlers.modpython
> > SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > PythonDebug On
> > PythonPath "['c:/websites/ericlezotte'] + sys.path"
> >   
>
> > 
>
> Via  you've told Apache to direct URLs that start with
> "/mysite/" to your Django code. Buthttp://www.ericlezotte.com/time/doesn't
> start with "/mysite/", it starts with "/time/", so it doesn't get directed
> to your code.  Either change the Location to "/" so everything gets routed
> to Django (you can override subtrees for media, etc. with subsequent
>  blocks), or include "/mysite/" at the beginning of your urls.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django and Comma-Formatting Numbers

2008-05-29 Thread David

I had need of commas in floating-point numbers, and slightly modified
humanize.py with a floatcomma function:

def floatcomma(value):
"""
Converts a float to a string containing commas every three digits.
For example, 3000.65 becomes '3,000.65' and -45000.00 becomes
'-45,000.00'.
"""
orig = force_unicode(value)
intpart, dec = orig.split(".")
intpart = intcomma(intpart)
return ".".join([intpart, dec])
floatcomma.is_safe = True
register.filter(floatcomma)


On May 28, 8:30 pm, Greg Taylor <[EMAIL PROTECTED]> wrote:
> Bingo, I could've sworn I remembered doing it somehow or another.
>
> Thanks a lot,
> Greg
>
> On May 28, 7:42 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
> wrote:
>
> > On Thu, May 29, 2008 at 7:26 AM, Greg Taylor <[EMAIL PROTECTED]> wrote:
>
> > > I was wondering if there was any facility within Django that makes
> > > formatting numbers with commas or periods in templates possible from
> > > template-land. I know you can use locale.format() on the Python side,
> > > but was hoping there was some tag/filter feature I missed that would
> > > allow me to do this without writing my own.
>
> > Sounds like you want the facilities provided by humaninze:
>
> >http://www.djangoproject.com/documentation/add_ons/#humanize
>
> > Yours,
> > Russ Magee %-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Help with request encoding (again)

2008-05-29 Thread Karen Tracey
On Thu, May 29, 2008 at 1:16 PM, John M <[EMAIL PROTECTED]> wrote:

> Ill give that a try, but seems like I'm working against the framework
> doesn't it?
>

Nah, working against the framework would be rooting around in undocumented
internal data structures to get the data you are looking for.
HttpRequest.META['QUERY_STRING'] is documented (
http://www.djangoproject.com/documentation/request_response/#attributes) and
the rest is just standard Python library code.


> I could swear I was able to set the encoding, GET the fields I wanted
> and then do it another way, but I need to move on in my coding, I hope
> this works.
>

There may be some way to un-do the unicodification but it isn't obvious to
me.  Fact is you don't want this query parameter turned into unicode, you
want he hex representation of what's essentially a  byte string, represented
in the url as a mix of ASCII and percent-encoded octets.  For that I think
it is more straightforward to start with the raw query string vs. attempting
to reverse what the framework did in constructing the request.GET
dictionary.  But that's just my opinion, of course.

Karen

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



order_by foreign key problem

2008-05-29 Thread robstar

Hey guys,

I read through some of the threads here, but still can't get this
simple scenario to work..

DB name: gcdb

class Item(models.Model):
   hits= models.IntegerField(default=0)

class Gear(models.Model):
  generic_info= models.OneToOneField(Item)


Should this work??

  results = Gear.objects.select_related().order_by(generic_info__hits)

I also tried putting the db name in there like I saw in some old
examples:

  results =
Gear.objects.select_related().order_by(gcdb_generic_info__hits)


Both result in the field not being found..  Any ideas???  thanks!

rob

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



Re: I cannot get Django to process files.

2008-05-29 Thread Karen Tracey
On Thu, May 29, 2008 at 1:40 PM, Eric <[EMAIL PROTECTED]> wrote:

>
> I simply cannot get this to work. I am attempting to run Python/Django
> on Apache/Windows. When I run the mpinfo it shows the mod_python
> service is available, but i cannot even view the most simple example
> shown in the online book (current_datetime view).  I am using the
> basic installation (ie my project is in the 'mysite' directory of my
> wwwroot (c:/websites/ericlezotte/mysite/) and my simple view is in the
> 'mysite/views.py' file.  When I browse this view to test it at 'http://
> www.ericlezotte.com/time/' I get a 404 error.  ANY help with this
> would be greatly appreciated.  Below is my Apache config code for this
> site is:
>
> 
>   ServerName www.ericlezotte.com
>   DocumentRoot "C:/Websites/ericlezotte/"
>   UserDir "C:/Websites/ericlezotte/"
>   ServerAlias ericlezotte.com *.ericlezotte.com
>
>   
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> PythonDebug On
> PythonPath "['c:/websites/ericlezotte'] + sys.path"
>   
>
> 
>

Via  you've told Apache to direct URLs that start with
"/mysite/" to your Django code. But http://www.ericlezotte.com/time/ doesn't
start with "/mysite/", it starts with "/time/", so it doesn't get directed
to your code.  Either change the Location to "/" so everything gets routed
to Django (you can override subtrees for media, etc. with subsequent
 blocks), or include "/mysite/" at the beginning of your urls.

Karen

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



i18n issues.

2008-05-29 Thread Jack M.

Hello, all.  Forgive me as I'm still fairly new to django, but I'm
having some issues getting i18n running, and I can't seem to find any
help in the online docs.

I've read chapter 18 (i18n) of djangobook.com, and chapter 10 relating
to RequestContext.  I've also read the docs on djangoproject.com for
the same subjects.

Basic problem description:  No matter what language I select, I get
English output.

My setup:
  OSX.5.3
  manually compiled gettext from source because xgettext was missing
from OSX.
  django from svn revision 7565 (did an update this morning).
  brand new project just for testing this functionality.
  mysql database (ran manage.py syncdb after getting the middle ware
setup).

What I've written:
  url r'^i18n/$' mapped to:  include('django.conf.urls.i18n') per
djangobook.com and djangoproject.com
  url r'^lang/' mapped to dolang from my views, which displays the
example code from djangobook.com on how to switch languages.  Changed
method="get" to POST so that it'll actually work.
  url r'^$' to hello_world from my views, which displays a template
say_hello.html with a simple string as output and a link to /lang/.

Hurtles I've already crossed:
  Made sure to use RequestContext in every (or both, whatever :)
request.
  Used make-message.py -l sp to generate the Spanish language files.
  Translated the two tokens (views.py:10, and templates/say_hello.html:
7) in the locale/sp/LC_MESSAGES_django.po file.
  Used compile-messages.py to compile the language into the django.mo
file.
  Ensured that the cookie is being set in my browser for the session,
and that the language is being saved to the session.
  Ensured that the language is in fact being saved to
request.LANGUAGE_CODE.
  Tried simply printing the string and bypassing the templates all
together.  Always outputs English.
  Pounded head into wall multiple times.

Any help is greatly appreciated.  I'm really excited about pitching
django to upper management and ridding myself of the perl hell I've
been tossed into.  ^_^

Below is the code, I'll leave out obvious things like import
statements.

-- views.py --
def dolang(request):
return render_to_response('dolang.html', {},
context_instance=RequestContext(request))

def hello_world(request):
string = _("Hello %(lang)s world!") % {'lang':
request.LANGUAGE_CODE}
print request.session['django_language']
print string
return render_to_response('say_hello.html', {'string': string},
context_instance=RequestContext(request))
-- / views.py --

-- urls.py --
urlpatterns = patterns('',
(r'^i18n/', include('django.conf.urls.i18n')),
(r'^lang/', dolang),
(r'^$', hello_world),
)
-- / urls.py --

-- templates/say_hello.html --
{% load i18n %}



{{ string }}

{% trans "Choose a language" %}


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



Re: get_or_create() error on synchronous calls from multiple instances

2008-05-29 Thread Karen Tracey
On Thu, May 29, 2008 at 1:39 PM, Brent Noorda <[EMAIL PROTECTED]>
wrote:

> The get_or_create() or convenience method is doing this behavior:
>
> 1)   try:
> 2)  return self.get(), False
> 3)   except self.model.DoesNotExist:
> 4)  . . .
> 5)  obj = self.model(...)
> 6)  obj.save()
> 7)  return obj, True
>
> But what if (on a heavy system with many clients) the record that did not
> exist at line 2 does exist by line 6 (i.e., in between the execution of
> these statements, some other database user has caused that record to come
> into existence)?  In that case there will now be either two records that
> contain the data (if there are not unique fields), or an exception will be
> thrown (if there are unique fields).
>
> To handle the case of unique fields, which will throw an exception, I think
> the code should be changed to something like this:
>
> 1)   try:
> 2)  return self.get(), False
> 3)   except self.model.DoesNotExist:
> 4)  . . .
> 5)  obj = self.model(...)
>  try:
> 6) obj.save()
>  except:
>return self.get(...), False
> 7)  return obj, True
>
> Does that seem like a correct solution? or am I misunderstanding this
> new-to-me world of django/sql/python?
>

This has already been implemented, see:

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

(You might want to upgrade to a more recent level.)

Karen

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



Re: WebFaction memories

2008-05-29 Thread didier rano
Thanks a lot.

WebFaction seems to be a valuable django hosting.

Someone have some experiences to compile scipy and dependances on WebFaction
hosting ?


2008/5/29, Ray Cote <[EMAIL PROTECTED]>:
>
> At 12:38 PM -0400 5/29/08, didier rano wrote:
>
>> Hi all,
>>
>> I am trying to evaluate to migrate from Site5 hosting to WebFaction. I
>> have some problems with Site5 to compile some third-parties tools like scipy
>> (subversion) and dependances.
>>
>> But I don't have ideas about memories size with WebFaction. In shared
>> hosting, it is possible to use from 86 Mb to 256 Mb memories (without apache
>> process and database process). Then, these memories are dedicated to python
>> processes and others processes.
>>
>> I don't have ideas if 86 Mb is enough for a small web site (between 10 to
>> 50 users by day). Does someone use WebFaction with Django ? Which is the
>> memory print of Django in this case ?
>>
>> Thanks
>> Didier Rano
>>
>
> Hi Didier:
> I don't have my immediate WebFaction numbers to hand, but I do know I'm
> running one small Django web site on their Shared 1 hosting (probably 4-5
> times the number of visitors you are estimating) and I'm running a number of
> Django web sites on WebFaction's Shared 2 hosting (hundreds to thousands of
> visits per day).
>
> The biggest tricks with WebFaction and memory are:
> a: Don't run for long periods of time in Django Debug mode.
> b: The Apache 'restart' command they provide you is actually a reload
> command and will not reduce your memory footprint. If you've been running in
> Debug mode, you'll want to switch out and then do a stop followed by a
> start. Then your memory will be nicely reduced.
>
> Hope this helps.
> --Ray
>
> --
>
> Raymond Cote
> Appropriate Solutions, Inc.
> PO Box 458 ~ Peterborough, NH 03458-0458
> Phone: 603.924.6079 ~ Fax: 603.924.8668
> rgacote(at)AppropriateSolutions.com
> www.AppropriateSolutions.com 
>



-- 
Didier Rano
[EMAIL PROTECTED]
http://www.jaxtr.com/didierrano

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



I cannot get Django to process files.

2008-05-29 Thread Eric

I simply cannot get this to work. I am attempting to run Python/Django
on Apache/Windows. When I run the mpinfo it shows the mod_python
service is available, but i cannot even view the most simple example
shown in the online book (current_datetime view).  I am using the
basic installation (ie my project is in the 'mysite' directory of my
wwwroot (c:/websites/ericlezotte/mysite/) and my simple view is in the
'mysite/views.py' file.  When I browse this view to test it at 'http://
www.ericlezotte.com/time/' I get a 404 error.  ANY help with this
would be greatly appreciated.  Below is my Apache config code for this
site is:


   ServerName www.ericlezotte.com
   DocumentRoot "C:/Websites/ericlezotte/"
   UserDir "C:/Websites/ericlezotte/"
   ServerAlias ericlezotte.com *.ericlezotte.com

   
 SetHandler python-program
 PythonHandler django.core.handlers.modpython
 SetEnv DJANGO_SETTINGS_MODULE mysite.settings
 PythonDebug On
 PythonPath "['c:/websites/ericlezotte'] + sys.path"
   


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



get_or_create() error on synchronous calls from multiple instances

2008-05-29 Thread Brent Noorda
The get_or_create() or convenience method is doing this behavior:

1)   try:
2)  return self.get(), False
3)   except self.model.DoesNotExist:
4)  . . .
5)  obj = self.model(...)
6)  obj.save()
7)  return obj, True

But what if (on a heavy system with many clients) the record that did not
exist at line 2 does exist by line 6 (i.e., in between the execution of
these statements, some other database user has caused that record to come
into existence)?  In that case there will now be either two records that
contain the data (if there are not unique fields), or an exception will be
thrown (if there are unique fields).

To handle the case of unique fields, which will throw an exception, I think
the code should be changed to something like this:

1)   try:
2)  return self.get(), False
3)   except self.model.DoesNotExist:
4)  . . .
5)  obj = self.model(...)
 try:
6) obj.save()
 except:
   return self.get(...), False
7)  return obj, True

Does that seem like a correct solution? or am I misunderstanding this
new-to-me world of django/sql/python?

If this is a potential problem (although admittedly rare) should I be
concerned that the django code as a whole typically is not written to handle
these worst cases?

-- 

Salad dressings on us all,
Brent

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



Re: WebFaction memories

2008-05-29 Thread Ray Cote

At 12:38 PM -0400 5/29/08, didier rano wrote:
>Hi all,
>
>I am trying to evaluate to migrate from Site5 hosting to WebFaction. 
>I have some problems with Site5 to compile some third-parties tools 
>like scipy (subversion) and dependances.
>
>But I don't have ideas about memories size with WebFaction. In 
>shared hosting, it is possible to use from 86 Mb to 256 Mb memories 
>(without apache process and database process). Then, these memories 
>are dedicated to python processes and others processes.
>
>I don't have ideas if 86 Mb is enough for a small web site (between 
>10 to 50 users by day). Does someone use WebFaction with Django ? 
>Which is the memory print of Django in this case ?
>
>Thanks
>Didier Rano

Hi Didier:
I don't have my immediate WebFaction numbers to hand, but I do know 
I'm running one small Django web site on their Shared 1 hosting 
(probably 4-5 times the number of visitors you are estimating) and 
I'm running a number of Django web sites on WebFaction's Shared 2 
hosting (hundreds to thousands of visits per day).

The biggest tricks with WebFaction and memory are:
a: Don't run for long periods of time in Django Debug mode.
b: The Apache 'restart' command they provide you is actually a reload 
command and will not reduce your memory footprint. If you've been 
running in Debug mode, you'll want to switch out and then do a stop 
followed by a start. Then your memory will be nicely reduced.

Hope this helps.
--Ray

-- 

Raymond Cote
Appropriate Solutions, Inc.
PO Box 458 ~ Peterborough, NH 03458-0458
Phone: 603.924.6079 ~ Fax: 603.924.8668
rgacote(at)AppropriateSolutions.com
www.AppropriateSolutions.com

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



Re: Getting mod_python working

2008-05-29 Thread Jeff Gentry


Hi there ...

In case anyone comes across this in the future, I solved the
problem.  libpq wasn't getting picked up by the process, all's well now.



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



Re: time and attendance management system

2008-05-29 Thread Guillaume Lederrey

I'm afraid you missed step 7 :

7) profit !

2008/5/29 Tim Chase <[EMAIL PROTECTED]>:
>
>> hi...related to the same problem i also have to designe
>> forms,reports and tables for ma data base ...will plz guide me
>
> It's a fairly trivial process so I will guide you:
>
> 1) get a server (I recommend Debian GNU/Linux)
> 2) install the following:
>
>   Python
>   Django
>   a web-server such as Apache/lighttpd
>   a web-server interface:  mod_python/mod_wsgi/fastcgi/etc
>   a database (PostgreSQL, MySQL or sqlite are popular choices)
>
> 3) do lots of hard work:
>   - design your application, data-structures, and tests
>   - implement your design
>
> 4) deploy your design
>
> 5) fix bugs
>
> 6) repeat steps 3-6 until your code is perfect
>
> I leave step #3 as an exercise to the reader.  If you get stuck
> on particular issues, this list and the comp.lang.python mailing
> list are helpful places to get specific help.  However, as
> friendly as both places are, neither will be a replacement for
> doing the hard work yourself.
>
> -tim
>
>
>
>
>
>
> >
>



-- 
Jabber : [EMAIL PROTECTED]
Skype : Guillaume.Lederrey
Projects :
* http://rwanda.ledcom.ch/

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



Re: Help with request encoding (again)

2008-05-29 Thread John M

Ill give that a try, but seems like I'm working against the framework
doesn't it?

I could swear I was able to set the encoding, GET the fields I wanted
and then do it another way, but I need to move on in my coding, I hope
this works.

J

On May 29, 9:00 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Thu, May 29, 2008 at 10:16 AM, John M <[EMAIL PROTECTED]> wrote:
>
> > Karen,
>
> > Thanks for the response, but I'm unable to unquote the strings as
> > django does it automatically for me when I get the GET list entries.
>
> Oh right, sigh, Django has already helpfully done the un-qoting and
> converted to unicode for the request.GET dictionary.  So, I'd go back to the
> raw query string (accessible as request.META['QUERY_STRING']) and use
> Python's cgi.parse_qs to do the parsing/unquoting but not the unicode step
> -- instead do the hex encoding on what parse_qs returns:
>
> from cgi import parse_qs
> hash = parse_qs(request.META['QUERY_STRING'])['info_hash'][0].encode('hex')
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: put columns in rows

2008-05-29 Thread Tim Chase

>> Hope this helps,
>>
>> -tim
>>
>> [1]
>> http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-filters
> 
> I have two questions.
> 
> 1) I cannot find where must I write the register of the filter

Details on creating your own filters are at the 
writing-custom-template-filters link I gave above.  There's some 
additional information above that particular link as well if 
you've never created a template tag/filter before.  It's 
remarkably easy...just don't forget to load the tag/filter 
library in your template.

> 2) I have a structure like this:
> (caption1, caption2, caption3, caption4)
> (a,b,c,d)
> 
> I want to print it like:
> 
> Caption1A
> Caption2B
> Caption3C
> Caption4D
> 
> How can I do that? It seems a bit different than your, because you don't have 
> captions...

well, I did what was requested...I'll have to check my DWIM 
functionality. ;-)

If you want to just combine them, you can use python's zip() command:

   captions = ["Cap1", "Cap2", "Cap3"]
   data = ['A', 'B', 'C', 'D']
   pairs = zip(captions, data)
   # pass "pairs" to your template

then in your template you can use

   {% for caption, datum in pairs %}

 {{ caption }}
 {{ datum }}

   {% endfor %}

or, if you're not using trunk you may have to use a single 
variable like

   {% for pair in pairs %}

 {{ pair.0 }}
 {{ pair.1 }}

   {% endfor %}

While it would be possible to make a "zip" tag that would do this 
for you, IMHO, it really belongs in the view as it asserts an 
association between two data-sets (and thus is not presentational 
which would be a criterion for template tags in my book).

-tim






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



WebFaction memories

2008-05-29 Thread didier rano
Hi all,

I am trying to evaluate to migrate from Site5 hosting to WebFaction. I have
some problems with Site5 to compile some third-parties tools like scipy
(subversion) and dependances.

But I don't have ideas about memories size with WebFaction. In shared
hosting, it is possible to use from 86 Mb to 256 Mb memories (without apache
process and database process). Then, these memories are dedicated to python
processes and others processes.

I don't have ideas if 86 Mb is enough for a small web site (between 10 to 50
users by day). Does someone use WebFaction with Django ? Which is the memory
print of Django in this case ?

Thanks
Didier Rano

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



Re: Error while importing URLconf '{{ project_name }}.urls'...

2008-05-29 Thread Karen Tracey
On Thu, May 29, 2008 at 11:15 AM, nib <[EMAIL PROTECTED]> wrote:

>
> it is ROOT_URLCONF = 'csp.urls'  in the settings.py file.  Caps locks
> must have been on when I typed those 3 letters.
>

And is your directory lowercase 'csp' as well?  Case matters.

I'm confused how your settings file had: ROOT_URLCONF = {{ project_name
}}.urls

That's what is in the template settings file used to generate your
project-specific setttings.py.  The django-admin.py startproject processing
should have replaced that '{{}}' string with the real project name.  The
fact that it didn't implies something went awry, but I have no idea what or
why.  But something doesn't seem quite right with your setup.

Karen

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



Re: Just getting started

2008-05-29 Thread jfinke

Interesting ideas guys.  Thanks for the insight!  The google gears
idea sounds interesting... But, like you said, you are pretty much
dropping django.  I don't know how big of a deal that is?  What type
of customization on the back end needs to take place to take the
advantage of GG.

Richard, this is essentially to do Certification & Accreditation for
government agencies (for now).  So information security documentation,
assessments, and testing.  Unfortunately, I do not have the luxery of
not allowing offline work.  I have been to multiple places where I had
zero network access.

So, we are talking a couple hundred different security controls in 17
different control families.  Plus, when you add the testing, you can
get to 1200 different tests.  And that is just for one "system".

Right now the process really breaks when someone decides we need to
change something somewhere and I have to ensure that the change is
reflected in 3-4 documents.  Even worse, is when it is a common
control between multiple systems (say a bunch of systems that sit in
one datacenter).  If I say, wait they upgraded the UPSs in the dc last
month.  Now, all documentation needs to refect that change.  It is a
huge PITA.  I could literally have to paste in a paragraph into 20
different documents which may have different formatting needs, tables,
fonts, etc.

So, right now I am thinking about just the documentation.  But,
assessment grows naturally out of that.  Then testing can grow out of
that as well.

Thanks again for the help!
I just need to start small for now.  I have a CS degree, but I have
never really been a professional programmer.  So, a lot of it is just
getting back into the swing of things.

On May 29, 10:15 am, "Richard Dahl" <[EMAIL PROTECTED]> wrote:
> I have been working on an app that enables the completion of IT security
> assessments.  A version of it that I used 2 years ago did allow remote
> completion of the assessments and I faced this same problem.  I was not
> comfortable using the django development server locally (primarily because
> of the stern warnings in the documentation not to use it in a production
> setting) but it may work fine in your situation. The way I tackled it was
> to create an export of the questions from the DB into CSV format and then
> created an excel spreadsheet with a macro that "prettified' it. I am not
> saying this is the best way to do this, I have since decided that I
> will simply not allow 'offline' assessments (something I have the privelage
> of), but it may be one way to quickly solve this problem.  The biggest
> downside is the lack of data entry validation and control of the format, you
> have to trust your remote users very much.  The one advantage was that it
> was easy and quick, and allowed me to focus on the server-side reporting
> mechanisms, which were ultimately far more important to my users.
>
> I did spend a bit of time thinking about how to accomplish this with a
> 'local' version of the app, and I would agree with Eric's comments.
> Recently the idea of using Google Gears has piqued my interest, but I have
> not adequatley researched it to recommend its viability.  The biggest
> downside is of course, you're not using django on the local app then.
> -richard
>
> On 5/29/08, Eric Wertman <[EMAIL PROTECTED]> wrote:
>
>
>
> > This is an interesting and I think pretty common problem.  There are a
> > lot of potential solutions, depending.  Personally, I would design the
> > field app separately, and define a strict export format for it.  This
> > way, you can feed it back in later when you can in just about any way
> > you choose (via the application itself, or through a queue, or
> > whatever), and later if you want to change the field app, you don't
> > have to touch your data store.
>
> > So I think my answer is yes, you are probably going to want to write
> > an import/export program separately.  This will also allow you to pick
> > and choose what information can go into the field, versus what
> > information stays at home base, which may or may not be handy from a
> > security standpoint, depending on your data.
>
> > > Here is my architectural issue.  I would like to keep a centralize
> > > system.  All the data is stored on a server back at HQ.  However, alot
> > > of the work is done in the field on notebooks.  These notebooks more
> > > than likely do not have access to the server back in HQ.  So, they
> > > would need to run a version of the application locally.  This could be
> > > done through the test webserver and sqlite or if need be apache +
> > > postgresql/mysql/whatever.
>
> > > The problem then becomes is there any easy to sync the notebook
> > > information back with HQ when the notebooks come home or VPN in or
> > > whatever?  Do I need to write a program to export it out and then
> > > import it back in?  Or are there already existing features that handle
> > > something like disconnected clients?
--~--~-~--~~~--

Re: Help with request encoding (again)

2008-05-29 Thread Karen Tracey
On Thu, May 29, 2008 at 10:16 AM, John M <[EMAIL PROTECTED]> wrote:

>
> Karen,
>
> Thanks for the response, but I'm unable to unquote the strings as
> django does it automatically for me when I get the GET list entries.
>

Oh right, sigh, Django has already helpfully done the un-qoting and
converted to unicode for the request.GET dictionary.  So, I'd go back to the
raw query string (accessible as request.META['QUERY_STRING']) and use
Python's cgi.parse_qs to do the parsing/unquoting but not the unicode step
-- instead do the hex encoding on what parse_qs returns:

from cgi import parse_qs
hash = parse_qs(request.META['QUERY_STRING'])['info_hash'][0].encode('hex')

Karen

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



Sex video!

2008-05-29 Thread IamSEXY

http://rozrywka.yeba.pl/show.php?id=1945
http://rozrywka.yeba.pl/show.php?id=2081
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Sorl Thumbnail, automatically create in admin

2008-05-29 Thread Josh.MIPS

I am working on integrating django with a legacy PHP application.
Saving images, and thumbnails through the admin interface is an
essential part of the project I am working on.  Sorl-thumbnail (as I
understand) only creates thumbnails once they are called from within a
template, but because of the way I am using Sorl the thumbnails would
never be used in a django template, they would only be used in the
legacy application.  Does anyone know a way to force Sorl to create
the thumbnails as soon as an object is saved in the admin interface,
rather than waiting until a thumbnail is needed in a template?  Thanks
so much!
~Josh
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error while importing URLconf '{{ project_name }}.urls'...

2008-05-29 Thread nib

it is ROOT_URLCONF = 'csp.urls'  in the settings.py file.  Caps locks
must have been on when I typed those 3 letters.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Just getting started

2008-05-29 Thread Richard Dahl
I have been working on an app that enables the completion of IT security
assessments.  A version of it that I used 2 years ago did allow remote
completion of the assessments and I faced this same problem.  I was not
comfortable using the django development server locally (primarily because
of the stern warnings in the documentation not to use it in a production
setting) but it may work fine in your situation. The way I tackled it was
to create an export of the questions from the DB into CSV format and then
created an excel spreadsheet with a macro that "prettified' it. I am not
saying this is the best way to do this, I have since decided that I
will simply not allow 'offline' assessments (something I have the privelage
of), but it may be one way to quickly solve this problem.  The biggest
downside is the lack of data entry validation and control of the format, you
have to trust your remote users very much.  The one advantage was that it
was easy and quick, and allowed me to focus on the server-side reporting
mechanisms, which were ultimately far more important to my users.

I did spend a bit of time thinking about how to accomplish this with a
'local' version of the app, and I would agree with Eric's comments.
Recently the idea of using Google Gears has piqued my interest, but I have
not adequatley researched it to recommend its viability.  The biggest
downside is of course, you're not using django on the local app then.
-richard



On 5/29/08, Eric Wertman <[EMAIL PROTECTED]> wrote:
>
>
> This is an interesting and I think pretty common problem.  There are a
> lot of potential solutions, depending.  Personally, I would design the
> field app separately, and define a strict export format for it.  This
> way, you can feed it back in later when you can in just about any way
> you choose (via the application itself, or through a queue, or
> whatever), and later if you want to change the field app, you don't
> have to touch your data store.
>
> So I think my answer is yes, you are probably going to want to write
> an import/export program separately.  This will also allow you to pick
> and choose what information can go into the field, versus what
> information stays at home base, which may or may not be handy from a
> security standpoint, depending on your data.
>
> > Here is my architectural issue.  I would like to keep a centralize
> > system.  All the data is stored on a server back at HQ.  However, alot
> > of the work is done in the field on notebooks.  These notebooks more
> > than likely do not have access to the server back in HQ.  So, they
> > would need to run a version of the application locally.  This could be
> > done through the test webserver and sqlite or if need be apache +
> > postgresql/mysql/whatever.
> >
> > The problem then becomes is there any easy to sync the notebook
> > information back with HQ when the notebooks come home or VPN in or
> > whatever?  Do I need to write a program to export it out and then
> > import it back in?  Or are there already existing features that handle
> > something like disconnected clients?
>
> >
>

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



Re: Error while importing URLconf '{{ project_name }}.urls'...

2008-05-29 Thread Marco Buttu

On Thu, 2008-05-29 at 06:56 -0700, nib wrote:

> As you can see there is not reference to {{ project_name }}.urls in
> this file, there is a reference in settings.py, I changed it to:
> ROOT_URLCONF = 'CSP.urls'
> 
> but now I get the same error as above but with this reference:
> Error while importing URLconf 'csp.urls': No module named csp.urls

Why in the ROOT_URLCONF ``CSP'' is uppercase and in the error message it
is lowercase?

-- 
Marco Buttu


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



Re: Just getting started

2008-05-29 Thread Eric Wertman

This is an interesting and I think pretty common problem.  There are a
lot of potential solutions, depending.  Personally, I would design the
field app separately, and define a strict export format for it.  This
way, you can feed it back in later when you can in just about any way
you choose (via the application itself, or through a queue, or
whatever), and later if you want to change the field app, you don't
have to touch your data store.

So I think my answer is yes, you are probably going to want to write
an import/export program separately.  This will also allow you to pick
and choose what information can go into the field, versus what
information stays at home base, which may or may not be handy from a
security standpoint, depending on your data.

> Here is my architectural issue.  I would like to keep a centralize
> system.  All the data is stored on a server back at HQ.  However, alot
> of the work is done in the field on notebooks.  These notebooks more
> than likely do not have access to the server back in HQ.  So, they
> would need to run a version of the application locally.  This could be
> done through the test webserver and sqlite or if need be apache +
> postgresql/mysql/whatever.
>
> The problem then becomes is there any easy to sync the notebook
> information back with HQ when the notebooks come home or VPN in or
> whatever?  Do I need to write a program to export it out and then
> import it back in?  Or are there already existing features that handle
> something like disconnected clients?

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



Re: Help with request encoding (again)

2008-05-29 Thread John M

Karen,

Thanks for the response, but I'm unable to unquote the strings as
django does it automatically for me when I get the GET list entries.

I've tried to run it from django, insert an assert false and give you
the answer

Here's the URL that was entered:
http://127.0.0.1:8000/announce/?info_hash=%EByXm%C5%7EmfD%D8%9A%91%D4%F7%C7%86%C7%D18%A7&peer_id=-TR1210-1q4q9aomcne9&port=51413&uploaded=0&downloaded=0&corrupt=0&left=0&compact=1&numwant=80&key=jda2jjrygr&event=started

Here's the URL handler
def view_announce(request):
#   request.encoding = "iso-8859-1"
request.encoding = "latin-1"

#client information
c = {}

try:
#if the client explicitly specifies its preferred IP address, 
then
#use that.  Else just take the address.
c['addr'] = request.GET.get('ip', None) or
request.META['REMOTE_ADDR']
c['port'] = int(request.GET['port'])
c['peer_id'] = request.GET['peer_id']

# JFM, hack arond unicode issues with info_hash in django
hash = request.GET['info_hash'].encode('iso8859-1')

except KeyError:
#if any of these is not defined, then it makes little sense to
proceed.
return _fail("""One of the following is missing: IP, Port, 
Peer_ID
or info_hash""")

print "Got all keys..."
print "hash " + hash

assert False

Here's the dump from Assert false:
Request information

GET
VariableValue
uploaded
u'0'
compact
u'1'
numwant
u'80'
info_hash
u'\xebyXm\xc5~mfD\xd8\x9a\x91\xd4\xf7\xc7\x86\xc7\xd18\xa7'
event
u'started'
downloaded
u'0'
key
u'jda2jjrygr'
corrupt
u'0'
peer_id
u'-TR1210-1q4q9aomcne9'
port
u'51413'
left
u'0'
POST
No POST data
COOKIES
VariableValue
sessionid
'f356ef76d6c20c3be39aec3d29ff023a'
META
VariableValue
Apple_PubSub_Socket_Render
'/tmp/launch-1GTNEW/Render'
COMMAND_MODE
'unix2003'
CONTENT_LENGTH
''
CONTENT_TYPE
'text/plain'
DISPLAY
'/tmp/launch-eJizQ9/:0'
DJANGO_SETTINGS_MODULE
'tracker.settings'
GATEWAY_INTERFACE
'CGI/1.1'
HOME
'/Users/John'
HTTP_ACCEPT
'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/
plain;q=0.8,image/png,*/*;q=0.5'
HTTP_ACCEPT_ENCODING
'gzip, deflate'
HTTP_ACCEPT_LANGUAGE
'en-us'
HTTP_CACHE_CONTROL
'max-age=0'
HTTP_CONNECTION
'keep-alive'
HTTP_COOKIE
'sessionid=f356ef76d6c20c3be39aec3d29ff023a'
HTTP_HOST
'127.0.0.1:8000'
HTTP_USER_AGENT
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_2; en-us) AppleWebKit/
525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18'
LANG
'en_US.UTF-8'
LOGNAME
'John'
MANPATH
'/usr/share/man:/usr/local/share/man:/usr/X11/man'
OLDPWD
'/Users/John/development'
PATH
'/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin'
PATH_INFO
'/announce/'
PWD
'/Users/John/development/tracker'
QUERY_STRING
'info_hash=%EByXm%C5%7EmfD%D8%9A%91%D4%F7%C7%86%C7%D18%A7&peer_id=-
TR1210-1q4q9aomcne9&port=51413&uploaded=0&downloaded=0&corrupt=0&left=0&compact=1&numwant=80&key=jda2jjrygr&event=started'
REMOTE_ADDR
'127.0.0.1'
REMOTE_HOST
''
REQUEST_METHOD
'GET'
RUN_MAIN
'true'
SCRIPT_NAME
''
SECURITYSESSIONID
'6939d0'
SERVER_NAME
'localhost'
SERVER_PORT
'8000'
SERVER_PROTOCOL
'HTTP/1.1'
SERVER_SOFTWARE
'WSGIServer/0.1 Python/2.5.1'
SHELL
'/bin/bash'
SHLVL
'1'
SSH_AUTH_SOCK
'/tmp/launch-qjIQx5/Listeners'
TERM
'xterm-color'
TERM_PROGRAM
'Apple_Terminal'
TERM_PROGRAM_VERSION
'240'
TMPDIR
'/var/folders/v-/v-IkkU9PHbeIn98mRd6ZMTI/-Tmp-/'
TZ
'America/Los_Angeles'
USER
'John'
_
'./manage.py'
__CF_USER_TEXT_ENCODING
'0x1F5:0:0'
wsgi.errors
', mode 'w' at 0x170b0>
wsgi.file_wrapper

wsgi.input

wsgi.multiprocess
False
wsgi.multithread
True
wsgi.run_once
False
wsgi.url_scheme
'http'
wsgi.version
(1, 0)



john

On May 29, 7:04 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Thu, May 29, 2008 at 3:54 AM, John M <[EMAIL PROTECTED]> wrote:
>
> > I've run into some more trouble with what I think is an encoding
> > issue?
>
> > I am writting a bittorrent tracker, and one of the GET parameters that
> > is passed is called info_hash, which is a lengthy / escaped hex
> > string, for example:
>
> > GET /announce?info_hash=%EByXm%C5%7EmfD%D8%9A%91%D4%F7%C7%86%C7%D18%A7
>
> > the django / python code I am using to decode this is:
>
> > request.encoding = "iso-8859-1"
> > hash = request.GET['info_hash'].encode('iso-8859-1').encode("hex")
>
> > But when I print the hash field, i get this:
>
> > efbfbd6defbfbd6d6644d89aefbfbdefbfbdc786efbfbd38efbfbd
>
> > where it should be
>
> > eb79586dc57e6d6644d89a91d4f7c786c7d138a7
>
> > I had it working for a while, but I'm not sure what changed to 'break'
> > this.
>
> > Any help would be greatly appreciated
>
> First, the code you've included doesn't produce the answer you show, so I'm
> a little confused about what your code is really doing.  In a python shell:
>
> >>> s = '%EByXm%C5%7EmfD%D8%9A%91%D4%F7%C7%86%C7%D18%A7'
> >>> s.encode('iso8859-1').encode('hex')
>
> '25454279586d2543352537

how to config the Mnemosyn

2008-05-29 Thread Qiang

anyone can tell me how to config the follow settings in Mnenosyn,the
personal wiki.
if i put the Mnemosyne in the folder : D:/Mnemosyne
MNEMOSYNE_SETTINGS[ 'path' ] = 'mnemosyne'
MNEMOSYNE_SETTINGS[ 'media_url'] = MEDIA_URL
i am so confused about that.

thanks

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



Just getting started

2008-05-29 Thread jfinke

Hi everyone,

I am just getting started in Django.  I have run through most of the
tutorial at this point.  I played some with TG back when it was
getting started, so I am familiar with MVC.  I just got irritated that
they were constantly changing stuff.

I have a project in mind and I was wondering if I could get some
people's input on whether it would work or not.  It may be more of a
db question than django.

I work in let's say the auditing world.  Right now a lot of the work
is done manually with word documents and excel spreadsheets.  This
type of works lends itself to a db based application very well because
it is structured and repeatable.  Plus, it will allow me to normalize
my data (the holy grail).

Here is my architectural issue.  I would like to keep a centralize
system.  All the data is stored on a server back at HQ.  However, alot
of the work is done in the field on notebooks.  These notebooks more
than likely do not have access to the server back in HQ.  So, they
would need to run a version of the application locally.  This could be
done through the test webserver and sqlite or if need be apache +
postgresql/mysql/whatever.

The problem then becomes is there any easy to sync the notebook
information back with HQ when the notebooks come home or VPN in or
whatever?  Do I need to write a program to export it out and then
import it back in?  Or are there already existing features that handle
something like disconnected clients?

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



Re: time and attendance management system

2008-05-29 Thread Eric Wertman

This should go in an FAQ somewhere.  I really like it.

On Thu, May 29, 2008 at 10:06 AM, Tim Chase
<[EMAIL PROTECTED]> wrote:
>
>> hi...related to the same problem i also have to designe
>> forms,reports and tables for ma data base ...will plz guide me
>
> It's a fairly trivial process so I will guide you:
>
> 1) get a server (I recommend Debian GNU/Linux)
> 2) install the following:
>
>   Python
>   Django
>   a web-server such as Apache/lighttpd
>   a web-server interface:  mod_python/mod_wsgi/fastcgi/etc
>   a database (PostgreSQL, MySQL or sqlite are popular choices)
>
> 3) do lots of hard work:
>   - design your application, data-structures, and tests
>   - implement your design
>
> 4) deploy your design
>
> 5) fix bugs
>
> 6) repeat steps 3-6 until your code is perfect
>
> I leave step #3 as an exercise to the reader.  If you get stuck
> on particular issues, this list and the comp.lang.python mailing
> list are helpful places to get specific help.  However, as
> friendly as both places are, neither will be a replacement for
> doing the hard work yourself.
>
> -tim
>
>
>
>
>
>
> >
>

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



Re: time and attendance management system

2008-05-29 Thread Tim Chase

> hi...related to the same problem i also have to designe
> forms,reports and tables for ma data base ...will plz guide me

It's a fairly trivial process so I will guide you:

1) get a server (I recommend Debian GNU/Linux)
2) install the following:

   Python
   Django
   a web-server such as Apache/lighttpd
   a web-server interface:  mod_python/mod_wsgi/fastcgi/etc
   a database (PostgreSQL, MySQL or sqlite are popular choices)

3) do lots of hard work:
   - design your application, data-structures, and tests
   - implement your design

4) deploy your design

5) fix bugs

6) repeat steps 3-6 until your code is perfect

I leave step #3 as an exercise to the reader.  If you get stuck 
on particular issues, this list and the comp.lang.python mailing 
list are helpful places to get specific help.  However, as 
friendly as both places are, neither will be a replacement for 
doing the hard work yourself.

-tim






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



Re: Help with request encoding (again)

2008-05-29 Thread Karen Tracey
On Thu, May 29, 2008 at 3:54 AM, John M <[EMAIL PROTECTED]> wrote:

>
> I've run into some more trouble with what I think is an encoding
> issue?
>
> I am writting a bittorrent tracker, and one of the GET parameters that
> is passed is called info_hash, which is a lengthy / escaped hex
> string, for example:
>
> GET /announce?info_hash=%EByXm%C5%7EmfD%D8%9A%91%D4%F7%C7%86%C7%D18%A7
>
> the django / python code I am using to decode this is:
>
> request.encoding = "iso-8859-1"
> hash = request.GET['info_hash'].encode('iso-8859-1').encode("hex")
>
> But when I print the hash field, i get this:
>
> efbfbd6defbfbd6d6644d89aefbfbdefbfbdc786efbfbd38efbfbd
>
> where it should be
>
> eb79586dc57e6d6644d89a91d4f7c786c7d138a7
>
> I had it working for a while, but I'm not sure what changed to 'break'
> this.
>
> Any help would be greatly appreciated
>

First, the code you've included doesn't produce the answer you show, so I'm
a little confused about what your code is really doing.  In a python shell:

>>> s = '%EByXm%C5%7EmfD%D8%9A%91%D4%F7%C7%86%C7%D18%A7'
>>> s.encode('iso8859-1').encode('hex')
'25454279586d2543352537456d664425443825394125393125443425463725433725383625433725443138254137'

Where the 'efbbd...' is coming from I don't understand.  But doing anything
with an encoding like iso8859-1 isn't what you want to do anyway.  You just
want to un-do the percent-encoding and convert (encode) into the hex
representation, using just the plain ASCII values for anything that wasn't
percent-encoded:

>>> urllib.unquote(s).encode('hex')
'eb79586dc57e6d6644d89a91d4f7c786c7d138a7'

so try:

import urllib
hash = urllib.unquote(request.GET['info_hash']).encode('hex')

Karen

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



Re: Error while importing URLconf '{{ project_name }}.urls'...

2008-05-29 Thread nib

Karen,
Thanks for your reply.  First, I am new to this and I did not make any
change to the install per the tutorial I referenced above.  Now, to
your suggestion.  This is my urls.py file:
from django.conf.urls.defaults import *

urlpatterns = patterns('',
# Example:
# (r'^CSP/', include('CSP.foo.urls')),

# Uncomment this for admin:
 (r'^admin/', include('django.contrib.admin.urls')),
)

As you can see there is not reference to {{ project_name }}.urls in
this file, there is a reference in settings.py, I changed it to:
ROOT_URLCONF = 'CSP.urls'

but now I get the same error as above but with this reference:
Error while importing URLconf 'csp.urls': No module named csp.urls

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



Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-29 Thread Berco Beute

I can surely pass the path variable into the context from within my
view, but the view doesn't know which filename to include. So in the
template, I would still have to combine path and filename when
creating an include tag such as:

{% include "dir/tag.html" %}

But how can I combine the path 'dir' and the filename 'tag.html'?

Besides, passing the path into the context from within every view
isn't very elegant.

Thanks,
2B

On May 28, 9:57 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Could you set the entire path variable from within your view, then
> pass the path, including the filename, into the context?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



[Best 100 Funny Videos] Super fly -- www.unlimitedfun.net

2008-05-29 Thread UnlimitedFun



Superb Video...

  Super fly  


By  UnlimitedFun


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






[Best 100 Funny Videos] Super fly -- www.unlimitedfun.net

2008-05-29 Thread UnlimitedFun



Superb Video...

  Super fly  


By  UnlimitedFun


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






[Best 100 Funny Videos] Yuvi's 666666 -- www.unlimitedfun.net

2008-05-29 Thread UnlimitedFun



Superb Video...

  Yuvi's 66  


By  UnlimitedFun


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






[Best 100 Funny Videos] Yuvi's 666666 -- www.unlimitedfun.net

2008-05-29 Thread UnlimitedFun



Superb Video...

  Yuvi's 66  


By  UnlimitedFun


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






[Best 100 Funny Videos] Sometimes Comedy leads to Tragedy -- www.unlimitedfun.net

2008-05-29 Thread UnlimitedFun



Superb Video...

  Sometimes Comedy leads to Tragedy  


By  UnlimitedFun


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






[Best 100 Funny Videos] Sometimes Comedy leads to Tragedy -- www.unlimitedfun.net

2008-05-29 Thread UnlimitedFun



Superb Video...

  Sometimes Comedy leads to Tragedy  


By  UnlimitedFun


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






[Latest Funny Video] Apple i-Phone -- www.unlimitedfun.net

2008-05-29 Thread UnlimitedFun



Superb Video...

  Apple i-Phone  


By  UnlimitedFun


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






[Latest Funny Video] Apple i-Phone -- www.unlimitedfun.net

2008-05-29 Thread UnlimitedFun



Superb Video...

  Apple i-Phone  


By  UnlimitedFun


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






[Latest Funny Video] Little dancer -- www.unlimitedfun.net

2008-05-29 Thread UnlimitedFun



Superb Video...

  Little dancer  


By  UnlimitedFun


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






[Latest Funny Video] Little dancer -- www.unlimitedfun.net

2008-05-29 Thread UnlimitedFun



Superb Video...

  Little dancer  


By  UnlimitedFun


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






[Latest Funny Video] Woman changing Tyre -- www.unlimitedfun.net

2008-05-29 Thread UnlimitedFun



Superb Video...

  Woman changing Tyre  


By  UnlimitedFun


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






[Latest Funny Video] Insurance Ad -- www.unlimitedfun.net

2008-05-29 Thread UnlimitedFun



Superb Video...

  Insurance Ad  


By  UnlimitedFun


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






[Latest Funny Video] Woman changing Tyre -- www.unlimitedfun.net

2008-05-29 Thread UnlimitedFun



Superb Video...

  Woman changing Tyre  


By  UnlimitedFun


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






[Latest Funny Video] Insurance Ad -- www.unlimitedfun.net

2008-05-29 Thread UnlimitedFun



Superb Video...

  Insurance Ad  


By  UnlimitedFun


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






[Latest Funny Video] Why you should have insurance -- www.unlimitedfun.net

2008-05-29 Thread UnlimitedFun



Superb Video...

  Why you should have insurance  


By  UnlimitedFun


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






[Latest Funny Video] Why you should have insurance -- www.unlimitedfun.net

2008-05-29 Thread UnlimitedFun



Superb Video...

  Why you should have insurance  


By  UnlimitedFun


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






Re: time and attendance management system

2008-05-29 Thread Guillaume Lederrey

Your question is very general, so it is difficult to give you a
meaningful answer ... If you give us a much more precise description
of your problem, or if you ask much more specific questions, you might
get a useful answer.

Here is a probably completely off-topic answer :

You will make your employee database using Django model as described
in the tutorial
(http://www.djangoproject.com/documentation/tutorial01/#creating-models)
or described in more details in the documentation
(http://www.djangoproject.com/documentation/model-api/). You might
also find appropriate examples in
http://www.djangoproject.com/documentation/models/

Good luck !

  MrG

2008/5/29 sesh <[EMAIL PROTECTED]>:
>
> i want to make time and attendance management system but how i make
> data base for employees for thisits realy argent
> >
>



-- 
Jabber : [EMAIL PROTECTED]
Skype : Guillaume.Lederrey
Projects :
* http://rwanda.ledcom.ch/

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



Re: put columns in rows

2008-05-29 Thread Alessandro Ronchi

Tim Chase ha scritto:
>> I want to show my query results in rows instead of columns in
>> an html page, but I don't know if it's possible in templates,
>> because of
>> 12
>> 34
>> structure
>>
>> how can I do?
> 
> I've solved this in the past by creating this filter:
> 
> ==
> from itertools import islice
> 
> def columnize(data, args="2"):
>if ',' in args:
>  columns, padding = args.split(',', 1)
>  columns = int(columns)
>else:
>  columns = int(args)
>  padding = ""
>i = iter(data)
>while True:
>  data = list(islice(i, columns))
>  ld = len(data)
>  if not ld: break
>  if ld <> columns:
>data.extend([padding] * (columns - ld))
>  yield data
> ==
> 
> 
> and then, after registering it as a filter[1], using it like this:
> 
> -
> 
>   {% for myrow in data|columnize:"3, " %}
> 
>  {% for value in myrow %}
>   {{ value }}
>  {% endfor %}
> 
>   {% endfor %}
>   
> 
> or
> 
>   
>   {% for thing in my_queryset|columnize %}
> 
>  {% for value in myrow %}
>   
>{% if value %}
>  {{ value.name }}:
>  {{ value.other_field }}
>{% else %}
>   
>{% endif %}
>   
>  {% endfor %}
> 
>   {% endfor %}
>   
> -
> 
> My original can be found here[2] but I think this version is a 
> little easier to understand than the original.
> 
> Hope this helps,
> 
> -tim
> 
> [1]
> http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-filters
> 
> [2]
> http://groups.google.com/group/django-users/browse_thread/thread/a9ca56a9f601271a/


I have two questions.

1) I cannot find where must I write the register of the filter
2) I have a structure like this:
(caption1, caption2, caption3, caption4)
(a,b,c,d)

I want to print it like:

Caption1A
Caption2B
Caption3C
Caption4D

How can I do that? It seems a bit different than your, because you don't have 
captions...
-- 

Alessandro Ronchi
Skype: aronchi

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: list index out or range,getting rss feed urls out of db

2008-05-29 Thread sebastian stephenson

great thats helpful thanks
On 29 May 2008, at 10:29, Eric Abrahamsen wrote:

>
> Sure. Add instances of your Feed class in the admin. Then in your
> standalone script, the one that runs under your regular django
> environment, do this:
>
> from ubermicro.shows.models import Feed
>
> feeds = Feed.objects.all()
> for feed in feeds:
>  f = feedparser.parse(feed.link)
>  for item in f['entries']:
>  # continue as below
>
>
> So you'll add Feeds in the admin, but your standalone script will add
> FeedItems automatically; you'll probably just leave those alone in the
> admin. Part of the standalone script should clear old FeedItems from
> the database when you don't need them anymore.
>
> E
>
> On May 29, 2008, at 5:08 PM, sebastian stephenson wrote:
>
>>
>> well umm. can I add urls though the admin interface?
>> On 28 May 2008, at 19:42, Eric Abrahamsen wrote:
>>
>>>
>>> What I was originally suggesting you do (which of course might not
>>> turn out to be the best solution) is use feedparser to read feed
>>> urls,
>>> and save those feeds into your database. That way, you wouldn't be
>>> using feedparser at all in your views, just regular database  
>>> queries.
>>>
>>> If your models include Feed and FeedItem (FeedItem having a
>>> foreignkey
>>> to a Feed), then feed parser will do something like this:
>>>
>>> f = feedparser.parse('http://somefeed.url')
>>> feed = Feed.objects.get(link=f.feed.link) # f.feed provides
>>> information corresponding to one Feed instance
>>> for item in f['entries']: # entries are all the items under a
>>> particular feed
>>> it, created = FeedItem.objects.get_or_create(title=item.title,
>>> link=item.link, desc=item.description, date=item.date_parsed,
>>> id=item.id, feed=feed)
>>>
>>> Repeat the above for every url in your list of feed urls. Note: this
>>> code goes in your standalone script running on a cron job, NOT in
>>> your
>>> views or whatever other normal part of your django code base. That
>>> will put RSS feed items into your database, your views.py pulls them
>>> out again as per normal django methods:
>>>
>>> feed = Feed.objects.get(link=somelinkvalue)
>>> items = feed.feeditem_set.all()
>>> return render_to_response(template, {'items':items})
>>>
>>> That's how it ought it work, in my opinion. Note that it's late  
>>> here,
>>> and I've been drinking, so there may be some inaccuracies in the
>>> above. I concur with the general consensus, that you need to start
>>> with some simple CGI scripts and python basics, and move up from
>>> there. That said, good luck!
>>>
>>> E
>>>
>>>
>>> On May 28, 2008, at 11:45 PM, sebey wrote:
>>>

 please much suggestions thank you

 On May 28, 4:37 pm, sebastian stephenson <[EMAIL PROTECTED]> wrote:
> great finally some help thank you so much!
> On 28 May 2008, at 15:20, Rajesh Dhawan wrote:
>
>
>
>
>
>> On May 28, 6:30 am, sebey <[EMAIL PROTECTED]> wrote:
>>> from django.http import HttpResponse
>>> import feedparser
>>> from ubermicro.shows.models import show
>
>>> def show_page(request):
>>>   """this is where we take what we need form the rss feeds in  
>>> the
>>> data base"""
>>>   query = show.objects.filter(show_feed__contains="http://";)
>>>   podcast = feedparser.parse(query)
>
>> It seems that you are making feedparser parse an instance of a
>> Django
>> ORM query. I think what you want to do is to make it parse a URL.
>> May
>> be something like this:
>
>> for q in query:
>>   podcast = feedparser.parse(q.show_feed)
>>   if podcast.entries:
>>  show_latest_title = podcast.entries[0].title
>
>> This will do it for all objects in your query. So you will  
>> have to
>> collect that list of titles etc. in a collection of some kind
>> (list,
>> dict, etc.) and pass it on to your template.
>
>>>   #show_about = podcast.feed.description
>>>   show_latest_title = podcast.entries[0].title
>
>> The above statement assumes that there is at least one entry in
>> the
>> feed. That may not be always true. So, you should consider  
>> testing
>> that first. Something like:
>
>> if podcast.entries:
>> show_latest_title = podcast.entries[0].title
>
>>>   #show_latest = podcast.entries[0].description
>
>>>   return  HttpResponse(show_latest_title)
>
>>> this code is what I think its doing is that I am grabing the rss
>>> url
>>> then using feedparser (http://www.feedparser.org) to get rss
>>> element
>>> such as  and such but every time I try to do this I
>>> get
>>> this error
>
>>> Traceback (most recent call last):
>>> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
>>> python2.5/
>>> site-packages/django/core/handlers/base.py" in get_response
>>> 77. response = callback(request, *callback_args,
>>> **callback_kwargs)
>>

time and attendance management system

2008-05-29 Thread sesh

hi...related to the same problem i also have to designe forms,reports
and tables for ma data base ...will plz guide me
thAnks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



time and attendance management system

2008-05-29 Thread sesh

i want to make time and attendance management system but how i make
data base for employees for thisits realy argent
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Session logout behaviour

2008-05-29 Thread Scott Moonen
Louis, there is some value in retaining the session past logout.  The
decision of what session data to keep/destroy is best left to the
application.  For any application that allows both anonymous and
authenticated access, any site settings that you are able to set as an
anonymous user (e.g., font size) should be able to persist across logout.
Or consider the case of an application that is able to remember your login
id in its login form -- that, too, would remain in your session after
logout.

  -- Scott

On Thu, May 29, 2008 at 5:59 AM, Louis Cordier <[EMAIL PROTECTED]> wrote:

>
> From http://www.djangoproject.com/documentation/sessions/ it follows,
>
> Clearing the session table
> =
> ...
> To understand this problem, consider what happens when a user uses a
> session. When a user logs in, Django adds a row to the django_session
> database table. Django updates this row each time the session data
> changes. If the user logs out manually, Django deletes the row. But if
> the user does not log out, the row never gets deleted.
>
> But in actual fact Django never deletes the row on logout.
>
> In trunk/django/contrib/auth/__init__.py
>
> ---8<--
> def logout(request):
>"""
>Remove the authenticated user's ID from the request.
>"""
>try:
>del request.session[SESSION_KEY]
>except KeyError:
>pass
>try:
>del request.session[BACKEND_SESSION_KEY]
>except KeyError:
>pass
>if hasattr(request, 'user'):
>from django.contrib.auth.models import AnonymousUser
>request.user = AnonymousUser()
> ---8<--
>
> It only deletes '_auth_user_id' and '_auth_user_backend' from the
> session, but keep the rest in tact.
> If a new user logs in with this browser (without closing it first and
> thus deleting the session cookie)
> the session middleware takes the session cookie and instantiates a
> SessionStore with it.
>
> request.session = engine.SessionStore(session_key)
>
> This effectivly gives the new user the previous user's (polluted) session.
>
> An easy fix would be to actually delete the row as stated in the
> documentation.
> ---8<--
> from django.conf import settings
>
> def logout(request):
>try:
>
>  request.session.delete(request.COOKIES[settings.SESSION_COOKIE_NAME])
>except KeyError:
>pass
> ...
> ---8<--
>
> My questions are:
>
> * Is there a good reason why the sessions are not cleared at manual logout
> ?
> * Is there an alternative method of dealing with this situation,
> polluted sessions ?
> * Is this a bug, should I file a ticket ?
>
> Regards Louis.
>
> >
>


-- 
http://scott.andstuff.org/ | http://truthadorned.org/

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



Session logout behaviour

2008-05-29 Thread Louis Cordier

>From http://www.djangoproject.com/documentation/sessions/ it follows,

Clearing the session table
=
...
To understand this problem, consider what happens when a user uses a
session. When a user logs in, Django adds a row to the django_session
database table. Django updates this row each time the session data
changes. If the user logs out manually, Django deletes the row. But if
the user does not log out, the row never gets deleted.

But in actual fact Django never deletes the row on logout.

In trunk/django/contrib/auth/__init__.py

---8<--
def logout(request):
"""
Remove the authenticated user's ID from the request.
"""
try:
del request.session[SESSION_KEY]
except KeyError:
pass
try:
del request.session[BACKEND_SESSION_KEY]
except KeyError:
pass
if hasattr(request, 'user'):
from django.contrib.auth.models import AnonymousUser
request.user = AnonymousUser()
---8<--

It only deletes '_auth_user_id' and '_auth_user_backend' from the
session, but keep the rest in tact.
If a new user logs in with this browser (without closing it first and
thus deleting the session cookie)
the session middleware takes the session cookie and instantiates a
SessionStore with it.

request.session = engine.SessionStore(session_key)

This effectivly gives the new user the previous user's (polluted) session.

An easy fix would be to actually delete the row as stated in the documentation.
---8<--
from django.conf import settings

def logout(request):
try:
request.session.delete(request.COOKIES[settings.SESSION_COOKIE_NAME])
except KeyError:
pass
...
---8<--

My questions are:

* Is there a good reason why the sessions are not cleared at manual logout ?
* Is there an alternative method of dealing with this situation,
polluted sessions ?
* Is this a bug, should I file a ticket ?

Regards Louis.

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



Re: list index out or range,getting rss feed urls out of db

2008-05-29 Thread Eric Abrahamsen

Sure. Add instances of your Feed class in the admin. Then in your  
standalone script, the one that runs under your regular django  
environment, do this:

from ubermicro.shows.models import Feed

feeds = Feed.objects.all()
for feed in feeds:
 f = feedparser.parse(feed.link)
 for item in f['entries']:
 # continue as below


So you'll add Feeds in the admin, but your standalone script will add  
FeedItems automatically; you'll probably just leave those alone in the  
admin. Part of the standalone script should clear old FeedItems from  
the database when you don't need them anymore.

E

On May 29, 2008, at 5:08 PM, sebastian stephenson wrote:

>
> well umm. can I add urls though the admin interface?
> On 28 May 2008, at 19:42, Eric Abrahamsen wrote:
>
>>
>> What I was originally suggesting you do (which of course might not
>> turn out to be the best solution) is use feedparser to read feed  
>> urls,
>> and save those feeds into your database. That way, you wouldn't be
>> using feedparser at all in your views, just regular database queries.
>>
>> If your models include Feed and FeedItem (FeedItem having a  
>> foreignkey
>> to a Feed), then feed parser will do something like this:
>>
>> f = feedparser.parse('http://somefeed.url')
>> feed = Feed.objects.get(link=f.feed.link) # f.feed provides
>> information corresponding to one Feed instance
>> for item in f['entries']: # entries are all the items under a
>> particular feed
>> it, created = FeedItem.objects.get_or_create(title=item.title,
>> link=item.link, desc=item.description, date=item.date_parsed,
>> id=item.id, feed=feed)
>>
>> Repeat the above for every url in your list of feed urls. Note: this
>> code goes in your standalone script running on a cron job, NOT in  
>> your
>> views or whatever other normal part of your django code base. That
>> will put RSS feed items into your database, your views.py pulls them
>> out again as per normal django methods:
>>
>> feed = Feed.objects.get(link=somelinkvalue)
>> items = feed.feeditem_set.all()
>> return render_to_response(template, {'items':items})
>>
>> That's how it ought it work, in my opinion. Note that it's late here,
>> and I've been drinking, so there may be some inaccuracies in the
>> above. I concur with the general consensus, that you need to start
>> with some simple CGI scripts and python basics, and move up from
>> there. That said, good luck!
>>
>> E
>>
>>
>> On May 28, 2008, at 11:45 PM, sebey wrote:
>>
>>>
>>> please much suggestions thank you
>>>
>>> On May 28, 4:37 pm, sebastian stephenson <[EMAIL PROTECTED]> wrote:
 great finally some help thank you so much!
 On 28 May 2008, at 15:20, Rajesh Dhawan wrote:





> On May 28, 6:30 am, sebey <[EMAIL PROTECTED]> wrote:
>> from django.http import HttpResponse
>> import feedparser
>> from ubermicro.shows.models import show

>> def show_page(request):
>>   """this is where we take what we need form the rss feeds in the
>> data base"""
>>   query = show.objects.filter(show_feed__contains="http://";)
>>   podcast = feedparser.parse(query)

> It seems that you are making feedparser parse an instance of a
> Django
> ORM query. I think what you want to do is to make it parse a URL.
> May
> be something like this:

> for q in query:
>   podcast = feedparser.parse(q.show_feed)
>   if podcast.entries:
>  show_latest_title = podcast.entries[0].title

> This will do it for all objects in your query. So you will have to
> collect that list of titles etc. in a collection of some kind
> (list,
> dict, etc.) and pass it on to your template.

>>   #show_about = podcast.feed.description
>>   show_latest_title = podcast.entries[0].title

> The above statement assumes that there is at least one entry in  
> the
> feed. That may not be always true. So, you should consider testing
> that first. Something like:

> if podcast.entries:
> show_latest_title = podcast.entries[0].title

>>   #show_latest = podcast.entries[0].description

>>   return  HttpResponse(show_latest_title)

>> this code is what I think its doing is that I am grabing the rss
>> url
>> then using feedparser (http://www.feedparser.org) to get rss
>> element
>> such as  and such but every time I try to do this I
>> get
>> this error

>> Traceback (most recent call last):
>> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
>> python2.5/
>> site-packages/django/core/handlers/base.py" in get_response
>> 77. response = callback(request, *callback_args,
>> **callback_kwargs)
>> File "/Users/sebey/Sites/ubermicro/../ubermicro/shows/views.py"  
>> in
>> show_page
>> 10. show_latest_title = podcast.entries[0].title

>> IndexError at /shows/
>> list index out of range
>> I am to django programing web

Re: list index out or range,getting rss feed urls out of db

2008-05-29 Thread sebastian stephenson

well umm. can I add urls though the admin interface?
On 28 May 2008, at 19:42, Eric Abrahamsen wrote:

>
> What I was originally suggesting you do (which of course might not
> turn out to be the best solution) is use feedparser to read feed urls,
> and save those feeds into your database. That way, you wouldn't be
> using feedparser at all in your views, just regular database queries.
>
> If your models include Feed and FeedItem (FeedItem having a foreignkey
> to a Feed), then feed parser will do something like this:
>
> f = feedparser.parse('http://somefeed.url')
> feed = Feed.objects.get(link=f.feed.link) # f.feed provides
> information corresponding to one Feed instance
> for item in f['entries']: # entries are all the items under a
> particular feed
>  it, created = FeedItem.objects.get_or_create(title=item.title,
> link=item.link, desc=item.description, date=item.date_parsed,
> id=item.id, feed=feed)
>
> Repeat the above for every url in your list of feed urls. Note: this
> code goes in your standalone script running on a cron job, NOT in your
> views or whatever other normal part of your django code base. That
> will put RSS feed items into your database, your views.py pulls them
> out again as per normal django methods:
>
> feed = Feed.objects.get(link=somelinkvalue)
> items = feed.feeditem_set.all()
> return render_to_response(template, {'items':items})
>
> That's how it ought it work, in my opinion. Note that it's late here,
> and I've been drinking, so there may be some inaccuracies in the
> above. I concur with the general consensus, that you need to start
> with some simple CGI scripts and python basics, and move up from
> there. That said, good luck!
>
> E
>
>
> On May 28, 2008, at 11:45 PM, sebey wrote:
>
>>
>> please much suggestions thank you
>>
>> On May 28, 4:37 pm, sebastian stephenson <[EMAIL PROTECTED]> wrote:
>>> great finally some help thank you so much!
>>> On 28 May 2008, at 15:20, Rajesh Dhawan wrote:
>>>
>>>
>>>
>>>
>>>
 On May 28, 6:30 am, sebey <[EMAIL PROTECTED]> wrote:
> from django.http import HttpResponse
> import feedparser
> from ubermicro.shows.models import show
>>>
> def show_page(request):
>"""this is where we take what we need form the rss feeds in the
> data base"""
>query = show.objects.filter(show_feed__contains="http://";)
>podcast = feedparser.parse(query)
>>>
 It seems that you are making feedparser parse an instance of a
 Django
 ORM query. I think what you want to do is to make it parse a URL.
 May
 be something like this:
>>>
 for q in query:
podcast = feedparser.parse(q.show_feed)
if podcast.entries:
   show_latest_title = podcast.entries[0].title
>>>
 This will do it for all objects in your query. So you will have to
 collect that list of titles etc. in a collection of some kind  
 (list,
 dict, etc.) and pass it on to your template.
>>>
>#show_about = podcast.feed.description
>show_latest_title = podcast.entries[0].title
>>>
 The above statement assumes that there is at least one entry in the
 feed. That may not be always true. So, you should consider testing
 that first. Something like:
>>>
 if podcast.entries:
  show_latest_title = podcast.entries[0].title
>>>
>#show_latest = podcast.entries[0].description
>>>
>return  HttpResponse(show_latest_title)
>>>
> this code is what I think its doing is that I am grabing the rss
> url
> then using feedparser (http://www.feedparser.org) to get rss
> element
> such as  and such but every time I try to do this I
> get
> this error
>>>
> Traceback (most recent call last):
> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/
> site-packages/django/core/handlers/base.py" in get_response
>  77. response = callback(request, *callback_args,
> **callback_kwargs)
> File "/Users/sebey/Sites/ubermicro/../ubermicro/shows/views.py" in
> show_page
>  10. show_latest_title = podcast.entries[0].title
>>>
>  IndexError at /shows/
>  list index out of range
> I am to django programing web dev etc. but I guess that the query
> I am
> useing is not correct so I what should I do thanks
>>>
 -Rajesh
>>>
>>> see ya
>>>
>>> sebey
>>>
>
>
> >

see ya

sebey



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



Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-29 Thread Berco Beute

Inclusion tags sound good, but I'm not sure how it could solve my
problem. In my template I would like to use an inclusion tag this way:

###template
{% showTag 'tagName' %}


###inclusion tag
@register.inclusion_tag('tag.html')
def showTag(tagname):
#...


###tag.html
bla


But how can the inclusion-tag load the tag based on the name that is
passed to it?

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



Re: Sydney - Django Contracts - Mobile/Web Dev

2008-05-29 Thread Ben Ford
Hi Glen,

Have you tried posting this on djangogigs.com..? You might get a wider
readership there :-)

Ben

2008/5/29 Wunderkind <[EMAIL PROTECTED]>:

>
> Hi,
>
> A client of mine located in North Sydney is looking for a couple of
> contractors who have experience developing in Django and who will be
> available over the next month.
>
> They develop big branded websites and quite a bit of work in the
> mobile space.
>
> If you have relevant open source experience and can be available in a
> week or two - please contact me at [EMAIL PROTECTED]
> or give me a call on +61 400 639008.
>
> Thanks very much - if you aren't from Australia - sorry for clogging
> up your email with another job!  I'm sure you must get sick of it :)
>
> Glen McGrath.
>
> >
>


-- 
Regards,
Ben Ford
[EMAIL PROTECTED]
+447792598685

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



Help with request encoding (again)

2008-05-29 Thread John M

I've run into some more trouble with what I think is an encoding
issue?

I am writting a bittorrent tracker, and one of the GET parameters that
is passed is called info_hash, which is a lengthy / escaped hex
string, for example:

GET /announce?info_hash=%EByXm%C5%7EmfD%D8%9A%91%D4%F7%C7%86%C7%D18%A7

the django / python code I am using to decode this is:

request.encoding = "iso-8859-1"
hash = request.GET['info_hash'].encode('iso-8859-1').encode("hex")

But when I print the hash field, i get this:

efbfbd6defbfbd6d6644d89aefbfbdefbfbdc786efbfbd38efbfbd

where it should be

eb79586dc57e6d6644d89a91d4f7c786c7d138a7

I had it working for a while, but I'm not sure what changed to 'break'
this.

Any help would be greatly appreciated

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



Re: problem with installing Django

2008-05-29 Thread Arki

10x!

On May 27, 5:05 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Tue, May 27, 2008 at 5:14 AM, Arki <[EMAIL PROTECTED]> wrote:
>
> > hi, i'm new to web frameworks, (but have several years of experience
> > in c,c++)
> > I followed the "How to install Django" guide, i'm working under
> > Windows.
> > i installed python and everything else, but when running:
> > setup.py install
> > i get:
> > running install
> > running build
> > running build_py
> > error: package directory '\django' does not exist
>
> > though i have this directory.
> > what should i do?
>
> This is a bug in the 0.96 installer, see:
>
> http://code.djangoproject.com/ticket/3245
>
> Personally I'd recommend using an SVN checkout of Django instead of the
> 0.96.x release.  There have been over a year's worth of features (some quite
> major) and bug fixes since 0.96 and if you are just getting started I see no
> reason to start with the old release level.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



sending pickled data to other users

2008-05-29 Thread stuntgoat

I generate forms based on a modelform that references primary keys
from different models in my app.  A nested tuple is used to reference
these primary keys; the modelform can reference these primary keys
along with other values submitted from the form.

I want to send pickled data of a nested tuple, that I generate
dynamically, to a different user. If I pickle the nested tuple and
store it in a database table somewhere, the other user can generate
the form by unpickling the data and letting my views.py functions
generate the modelform form. The user can then submit the form and
save the modelform data.

Any ideas about how to do this effectively and efficiently in the
Django idiom?

Where should I store the pickled data?
How do I make that stored location accessible to my other user/users?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---