Re: connectiong querysets

2009-08-11 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects

Luke Seelenbinder

luke.seelenbin...@gmail.com
http://www.google.com/profiles/luke.seelenbinder



On Tue, Aug 11, 2009 at 9:38 AM, elminio wrote:
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkqBiQwACgkQXQrGVCncjPyeTwCdF4GGYBU62n/R6Gjw86aRSGUL
1tMAnRvdOjSgTQFD6oL7Hak8EZ9x6GLz
=qiHK
-END PGP SIGNATURE-

>
> Hello,
> Is it possiblo to merge Querystets into one big Queryset?
> >
>

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



Re: Django comments honeypot hide

2009-08-10 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

xhtml:
html:

Luke Seelenbinder

luke.seelenbin...@gmail.com
http://www.google.com/profiles/luke.seelenbinder



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkqAgj8ACgkQXQrGVCncjPz8FACffs+kJ757sMZIB2MEiuLX7V9P
LIQAnj/o4jNup6x9CJ4o7yrVfUm/J6pD
=kMMm
-END PGP SIGNATURE-

On Mon, Aug 10, 2009 at 10:31 AM, Alessandro
Ronchi<alessandro.ron...@soasi.com> wrote:
> I need to hide the django-comments honeypot in my comment form, but It's
> visible to the user.
>
> Is there a way to do that in an easy way?
>
> --
> Alessandro Ronchi
>
> SOASI
> Sviluppo Software e Sistemi Open Source
> http://www.soasi.com
>
> >
>

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



Re: Javascript with built-in templates tags

2009-08-08 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

That needs to be :
alert({{ selectedAreas.BC }});

Look at the documentation. This problem is fairly obvious if you do:
http://docs.djangoproject.com/en/dev/topics/templates/#variables

I'm not trying to be mean, but please look at the docs before you post
here, it wastes our time, and yours waiting for a response. Thanks!
We are more than happy to help, just please check the documentation first. ;)

Hope that works for you.

Luke Seelenbinder
luke.seelenbin...@gmail.com



On Sat, Aug 8, 2009 at 5:32 PM, WilsonOfCanada wrote:
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkp+Nf4ACgkQXQrGVCncjPy+0QCeJApu38xtnpmR9lEg4XgMrXaK
fQEAoIo0vbiYDVLkHLnTMZb5SlpnpELT
=QOCH
-END PGP SIGNATURE-

>
> I sent the variable as dictionary with lists
> {'BC:['Vancouver', 'Kamloops'], AB:['Calgary']}
>
> However, when I use the variable in the function, it is treated as a
> string.
>
> function changeArea(mooman)
> {
>        alert(selectedAreas["BC"]);
> }
>
> This was not defined.  Is there something more I need to add to the
> onchange="changeArea('{{ mooman|safe|escape}}');?
>
> Thanks
> >
>

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



Re: using python libraries in django?

2009-08-08 Thread Luke Seelenbinder

Django follows normal python import rules. So just lookup those to
know what Django can use and how it needs to be setup.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


Luke Seelenbinder
luke.seelenbin...@gmail.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkp+M70ACgkQXQrGVCncjPy43gCfbxz5dw6uLeysyXl98qoZ9Ktp
DysAn2mwAKm9MeIFMcKdL6LTHfgxyUHR
=K/yu
-END PGP SIGNATURE-





On Sat, Aug 8, 2009 at 3:11 PM, Daniel Roseman<dan...@roseman.org.uk> wrote:
>
> On Aug 8, 7:42 pm, djangonoob <ye.eug...@gmail.com> wrote:
>> Hi Alex,
>> in that case, do we need to know where is the python modules being
>> installed
>> before importing it?
>
> No.
>
>> Or do we install another python library to a directory where our
>> django project lives before importing the
>> python modules?
>>
>> Best Rgds.
>
> If it's not in the standard library, you need to install it somewhere
> on the Pythonpath (not necessarily the same place as your Django
> project). However, urllib is in the standard library, so you don't
> need to install it.
>
> --
> DR.
> >
>

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



Re: How to get rid of the 'u'? Seems to be everyhere :)

2009-08-08 Thread Luke Seelenbinder

As James said, spend some time with the Python basics.
Here is a good online book to checkout (free)
http://www.diveintopython.org/toc/index.html

Get a firm foundation in Python before attempting anything with
Django. That will help immensely.
I took a college-level python class before I started anything with
Django, it helped a lot.

Hope it helps,

Luke Seelenbinder
luke.seelenbin...@gmail.com

On Sat, Aug 8, 2009 at 10:03 PM, strotos<da...@strotos.com> wrote:
>
> Hey all,
>
> I am very new to Django and am having a bit of trouble with something
> and I'm hoping I can get some help from you all.
>
> I was just wondering how do I share say a list or dictionary between
> views?
>
> What I have at the moment is.
>
> from django.shortcuts import render_to_response
> from django.http import HttpResponse
>
> myList = ["http://localhost:1;, "http://localhost:2;]
>
> def index(request):
>        head = "Viewer"
>
>        thelist = ""
>
>        for i in myList:
>                thelist = ('%s  Test ') % (thelist, i)
>
>        body ="%s" % thelist
>        tail = ""
>        print thelist
>        html = head,body,tail
>
>        return HttpResponse(html)
>
> def update(request):
>
>        query = request.GET.get('t', '')
>        print query
>        myList.append(query)
>        html ="UploadUpload OK %s body
>        return HttpResponse(html)
>
>
> In my update the "query" variable is added to the list myList, but a u
> is appended which seams to be the url of the app, is there a way to
> remove this u, or is there a better way to share data like a dict or
> list between views?
>
> Thanks in advance
>
> >
>

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



Re: Javascript with built-in templates tags

2009-08-08 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I think your problem is just the spaces between the filters, try {{
mooman|safe|escapejs }}.
Other then that, as long as the mooman is set in the context... that
should work.

Luke

On Sat, Aug 8, 2009 at 12:34 PM, WilsonOfCanada wrote:
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkp9rFMACgkQXQrGVCncjPycTgCfeWdooEJqmAV2ngoI8sU8edKs
Cq0An0iGdBDQH1mY0O/LH7PgDK1YwWOc
=yqjZ
-END PGP SIGNATURE-

>
> I am not sure; I am just trying to pass the variable from the
> dictionary using render_to_response to a javascript function.  The
> function is stored as a .js file.  This is a part of the code I am
> using it for:
>
> {{ selectCity|safe }}
>
>  onchange = "changeArea({{ mooman | safe | escapejs}});">
> 
>
> The {{ selectCity|safe }} works but the {{ mooman | safe | escapejs}}
> does not.  I was wondering if the syntax is incorrect or they cannot
> be used between " ".  Please show an example.
>
> Thanks
> >
>

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



Re: Duplicate results using ORd Q queries

2009-08-08 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tom,

The reason it was returning dupes is simply you had multiple querysets
that matched some of the same items.
As for the while loop, it was malformed. It looks like an infinite
loop to me... I might be wrong; however, a for loop would have better
served you, e.g.,

films = []
for r in results:
#checks if instance already films list
#if it is, this is a dupe, do nothing
if not r in films:
#if not this is not a dupe, append to list
films.append(r)


that would have served the same purpose as the distinct method.

Luke

On Sat, Aug 8, 2009 at 10:21 AM, Tom wrote:
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkp9n94ACgkQXQrGVCncjPyeLQCeKGYLvv4jL2vDLLQ+DQKh/1+d
lg0AoIEABek7zEx800mmEpnjzUH0uxVa
=w/tR
-END PGP SIGNATURE-

>
> Luke,
>
> That's brilliant, thank you so much!  Just out of interest, do you
> know why the query was returning dupes in the first place, and why my
> while loop was not removing them?
>
> Thanks again,
>
> Tom
>
> On Aug 8, 2:51 pm, Luke Seelenbinder <luke.seelenbin...@gmail.com>
> wrote:
>> Tom,
>>
>> make your line read:
>> results = Film.objects.filter(
>>                                 Q(title__icontains=q) |
>>                                 Q(director__name__icontains=q) |
>>                                 Q(actors__name__icontains=q) |
>>                                 Q(screenwriters__name__icontains=q) |
>>                                 Q(genre__icontains=q)
>>                                 ).distinct()
>>
>> So just add the distinct method to the Q set. And then you won't need
>> the while loop at all.
>> Read:http://docs.djangoproject.com/en/dev/ref/models/querysets/#distinct
>>
>> Hope that helps.
>>
>> Luke
>>
>>
>>
>> On Sat, Aug 8, 2009 at 9:19 AM, Thomas Scrace<t.scr...@gmail.com> wrote:
>>
>> > Hi all,
>>
>> > In order to teach myself Django I am creating a simple film database
>> > project.  My search code looks like this:
>>
>> > results = Film.objects.filter(
>> >                                Q(title__icontains=q) |
>> >                                Q(director__name__icontains=q) |
>> >                                Q(actors__name__icontains=q) |
>> >                                Q(screenwriters__name__icontains=q) |
>> >                                Q(genre__icontains=q)
>> >                                )
>>
>> > This lets me have a 'catch-all' search box that allows you to search
>> > on all of the fields of my film class.  It works, but I always get
>> > duplicate results.  The same film will appear several times (typically
>> > 3, 4 or 6 times) in the search results.
>>
>> > As a sort of kluge to get around this, and to try to further diagnose
>> > what was happening, I wrote the following to try to remove duplicate
>> > results:
>>
>> > films = list(results)
>> >                while len(films) > 1:
>> >                        if films[len(films)-1] == films[len(films)-2]:
>> >                                films.remove(films[len(films)-1])
>> > This executes without any errors, but does not remove duplicate
>> > results from the list, from which I can only infer that for some
>> > reason the results that I think are identical are in fact different in
>> > some way.
>>
>> > My models look like this:
>>
>> > class Director(models.Model):
>> >        name = models.CharField(max_length=70)
>>
>> >        def __unicode__(self):
>> >                return u'%s' % (self.name,)
>>
>> > class Actor(models.Model):
>> >        name = models.CharField(max_length=70)
>>
>> >        def __unicode__(self):
>> >                return u'%s' % (self.name,)
>>
>> > class Screenwriter(models.Model):
>> >        name = models.CharField(max_length=70)
>>
>> >        def __unicode__(self):
>> >                return u'%s' % (self.name,)
>>
>> > class Film(models.Model):
>> >        title = models.CharField(max_length=100)
>> >        genre = models.CharField(max_length=40)
>> >        actors = models.ManyToManyField(Actor)
>> >        screenwriters = models.ManyToManyField(Screenwriter)
>> >        director = models.ForeignKey(Director)
>> >        release_date = models.DateField(blank=True, null=True)
>>
>> >        def __unicode__(self):
>> >                return self.title
>>
>> > Does anybody have any ideas on what is happening here?  I am flummoxed!.
>>
>> > Thanks in advance,
>>
>> > Tom
> >
>

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



Re: Duplicate results using ORd Q queries

2009-08-08 Thread Luke Seelenbinder

Tom,

make your line read:
results = Film.objects.filter(
Q(title__icontains=q) |
Q(director__name__icontains=q) |
Q(actors__name__icontains=q) |
Q(screenwriters__name__icontains=q) |
Q(genre__icontains=q)
).distinct()

So just add the distinct method to the Q set. And then you won't need
the while loop at all.
Read: http://docs.djangoproject.com/en/dev/ref/models/querysets/#distinct

Hope that helps.

Luke

On Sat, Aug 8, 2009 at 9:19 AM, Thomas Scrace wrote:
>
> Hi all,
>
> In order to teach myself Django I am creating a simple film database
> project.  My search code looks like this:
>
> results = Film.objects.filter(
>                                Q(title__icontains=q) |
>                                Q(director__name__icontains=q) |
>                                Q(actors__name__icontains=q) |
>                                Q(screenwriters__name__icontains=q) |
>                                Q(genre__icontains=q)
>                                )
>
> This lets me have a 'catch-all' search box that allows you to search
> on all of the fields of my film class.  It works, but I always get
> duplicate results.  The same film will appear several times (typically
> 3, 4 or 6 times) in the search results.
>
> As a sort of kluge to get around this, and to try to further diagnose
> what was happening, I wrote the following to try to remove duplicate
> results:
>
> films = list(results)
>                while len(films) > 1:
>                        if films[len(films)-1] == films[len(films)-2]:
>                                films.remove(films[len(films)-1])
> This executes without any errors, but does not remove duplicate
> results from the list, from which I can only infer that for some
> reason the results that I think are identical are in fact different in
> some way.
>
> My models look like this:
>
> class Director(models.Model):
>        name = models.CharField(max_length=70)
>
>        def __unicode__(self):
>                return u'%s' % (self.name,)
>
> class Actor(models.Model):
>        name = models.CharField(max_length=70)
>
>        def __unicode__(self):
>                return u'%s' % (self.name,)
>
> class Screenwriter(models.Model):
>        name = models.CharField(max_length=70)
>
>        def __unicode__(self):
>                return u'%s' % (self.name,)
>
>
> class Film(models.Model):
>        title = models.CharField(max_length=100)
>        genre = models.CharField(max_length=40)
>        actors = models.ManyToManyField(Actor)
>        screenwriters = models.ManyToManyField(Screenwriter)
>        director = models.ForeignKey(Director)
>        release_date = models.DateField(blank=True, null=True)
>
>
>        def __unicode__(self):
>                return self.title
>
> Does anybody have any ideas on what is happening here?  I am flummoxed!.
>
> Thanks in advance,
>
> Tom
>
> >
>

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



Re: Javascript with built-in templates tags

2009-08-07 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Wilson,

Are you referring to rendering JS with template tags, or actual
template tags in JS?

In the first case, you use them like any other template tag.
The second case is only possible if there is some JS library that uses
Django-like templates.

Luke

On Fri, Aug 7, 2009 at 10:31 PM, WilsonOfCanada wrote:
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkp85c8ACgkQXQrGVCncjPyvtACfdp1MNDbfcA4FVXCEBA6vAlAs
NGgAnjlGepehXauPkVf20eW2wGtKiqfa
=29IC
-END PGP SIGNATURE-

>
> Hellos,
>
> I was wondering how to use {{ }} variables in javascript functions.
>
> ex. onchange = "changeArea({{ mooman |safe|escapejs}});"
>
> Thanks
> >
>

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



Re: ValueError

2009-08-06 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Could we have the full traceback? That really isn't enough information
to determine your problem.

Regards,

Luke
luke.seelenbin...@gmail.com


rekha wrote:
> Hi, im getting ValueError when try to redirect to an html page.. also
> the validation code in forms.py doesnt work when i test it with wrong
> inputs. it accepts the wrong input also.. what would be the bug?
> ===views.py code==
> def register(request):
>   if request.method == 'POST':
>   form = form_register(request.POST)
>   if form.is_valid():
>   reg = loginform( usr_name = 
> form.cleaned_data['usr_name'], pswd =
> form.cleaned_data['pswd'])
>   reg.save()
>   return HttpResponseRedirect('/index/')
>   #return render_to_response('thanks.html')
>   else:
>   form = form_register()
>   variables = RequestContext(request, {'form':form})
>   return render_to_response('register.html',variables)
> 
> ===forms.py code===
> class form_register(forms.Form):
>   usr_name = forms.CharField(label='Enter your user
> name:',max_length=50)
>   pswd = forms.CharField(label='Password:',widget=forms.PasswordInput
> (render_value=False))
>   def clean_usr_name(self):
>   usr_name = self.cleaned_data['usr_name']
>   if not re.search(r'^\w+$',usr_name):
>   raise forms.ValidationError('Username can only contain 
> alphanumeric
> characters and the underscore.')
>   return usr_name
> --
> ===urls.py code===
> 
> urlpatterns = patterns('',(r'^$',index),(r'^register/$',register),
> (r'^login/$',login),(r'^index/$',index),(r'^logout/$',logout_page),
> > 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkp607UACgkQXQrGVCncjPw8XQCgknqhHrD5b6dQtZu0nvom2/Sy
P8UAoKPUkHsSbgtYHGM0gtmw6n4d5Q1B
=51xf
-END PGP SIGNATURE-

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



Re: multiple projects shared database

2009-08-05 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

There is no problem with that, as long as your code accounts for it.

Luke
luke.seelenbin...@gmail.com


Robin Becker wrote:
> My boss wants to have two different django controlled websites with a common 
> database. Is there a way to do this?
> 
> We are already running multiple websites into a single django project and 
> because they have a disambiguating term in the urls eg each url has 
> /lang/brand/path we can map the URLs pretty well.
> 
> With the multiple django projects & 1 database I am worried there are some 
> hidden problems waiting to come out and play.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkp5vgsACgkQXQrGVCncjPz1PACgnzUvWNdB7xcIf5K0nvKu3IHO
334AnRbzsb9ajiJSWAuHZNxkmRexGq84
=RJj/
-END PGP SIGNATURE-

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



Re: Counting results

2009-08-05 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I believe QuerySets have a .count() method.

Luke

luke.seelenbin...@gmail.com


When ideas fail wrote:
> Hi, I was wondering what is the simpliest way to count the number of
> objects returned in a QuerySet?
> 
> Basically i have a blog and i want to count the number of comment
> relating to each post and display it, the blog posts are shown on a
> seperate page to the comments but i guess you would still have to
> create the query set in the posts view so that you can count the
> results.
> 
> Thanks
> > 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkp5ojMACgkQXQrGVCncjPxzcACgpGprrgc/o00WHsJ3XdvZmeFD
wZwAnRczHExrEqTDHBNMvCu8BcES3jBI
=apvd
-END PGP SIGNATURE-

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



Re: Template links when Django not domain root

2009-08-01 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Check out RequestContext and setting it up with the setting in
settings.py:
http://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors

Luke
luke.seelenbin...@gmail.com

"I [may] disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire


Streamweaver wrote:
> Thanks for the great replies here.
> 
> It seems from this there might be less repetition if I can just put a
> SITE_URL attribute in my settings.py file and then make that available
> to the template without having to go through the view.  Is this
> possible or easy?  Custom template filter perhaps but these seem
> pretty complicated and more intended to work like decorators than just
> pushing variables to the template.  Hmmm, not sure.
> 
> On Jul 31, 1:42 pm, Adam Yee  wrote:
>> On Jul 30, 7:29 pm, Graham Dumpleton 
>> wrote:
>>
>>
>>
>>> If you are using mod_wsgi then you definitely do not need
>>> FORCE_SCRIPT_NAME as mod_wsgi does the correct think in respect of
>>> setting up SCRIPT_NAME/PATH_INFO. The only time it might not be right
>>> with mod_wsgi is if you used WSGIScriptAliasMatch to map the
>>> application and you didn't set up the directive properly. This can
>>> happen because how you set up pattern and target for that directive
>>> will control how SCRIPT_NAME is calculated. WSGIScriptAliasMatch
>>> should only be used if absolutely required.
>>> So, post how you configured mod_wsgi to mount your application just to
>>> eliminate that as possibility. Verify that FORCE_SCRIPT_NAME isn't set
>>> in settings.py or if it is that it is set to None.
>>> Someone with more Django knowledge would then need to tell you if you
>>> are specifying urls.py correctly, whether any other settings you need
>>> to check and whether how URL references are generated are correct. All
>>> I can tell you is that if mod_wsgi is set up properly, you should
>>> never need FORCE_SCRIPT_NAME with mod_wsgi.
>>> You may need to explain better what is meant by 'This is causing all
>>> my template links to break'. Ie., what errors are you getting, what
>>> are the URLs it is generating and what they should be etc.
>>> Graham
>>> On Jul 31, 12:09 pm, Streamweaver  wrote:
 I'm not actually using {% url %} at this time.  I am setup for
 mod_wsgi and don't know how to go about configuring links in the
 templates when the sites root is on a subdirectory.  There isn't much
 in the way of examples on FORCE_SCRIPT_NAME I can find and I'm not
 really an apache admin so I'm a bit out of my depth here.
 Is this the avenue I should be pursuing or is there some way to set
 this up better.  the url filter seems to violate DRY methodology.
 Thanks again.
 On Jul 30, 9:52 pm, Graham Dumpleton 
 wrote:
> Using FORCE_SCRIPT_NAME is only appropriate for certain WSGI hosting
> mechanisms. Using it may simply hide the fact that the OPs application
> code is wrong to begin with.
> OP should indicate how they are hosting their application for real
> site. Ie., mod_python, mod_wsgi, fastcgi or other.
> Graham
>> Graham is right about needing to mount your site correctly.  Post your
>> Apache config athttp://groups.google.com/group/modwsgi?hl=enand they
>> can help with that.  I've not had to use FORCE_SCRIPT_NAME when using
>> mod_wsgi.  What I found that works is passing the script_name in each
>> view context.  This is violating DRY, but I haven't worried about that
>> too much.  This is a way to make apps portable.  If you still need or
>> want to use the {% url %} tag, you just need to preceed it by a
>> {{ script_name }} (I'm mostly sure, correct me if wrong).  You can
>> give script_name to your context with request.META['SCRIPT_NAME'] if
>> it exists.
>>
>> hope this helps,
>> Adam
>>
> On Jul 31, 6:04 am, Alex Koshelev  wrote:
>> If you are using `{% url %}` template tag or `reverse` function you can 
>> set
>> FORCE_SCRIPT_NAME [1] settings variable specified for your deployment
>> project root. Or working with right web-server in front of django project
>> force it to tell proper SCRIPT_NAME himself.
>> [1]:http://docs.djangoproject.com/en/dev/ref/settings/#force-script-name
>> ---
>> Alex Koshelev
>> On Thu, Jul 30, 2009 at 10:55 PM, Streamweaver 
>> wrote:
>>> I have a django project that has worked just fine in development but
>>> I'm trying to move it to a demo site and the application is not on a
>>> root domain or sub-domain.
>>> Instead the site root URL is suppose to be something like
>>> https://site.domain.com/appname/
>>> This is causing all my template links to break.  The {% url %} tag
>>> seems to work only for the site root and doesn't bring in the
>>> subdirectory name.
>>> 

Re: Amazon Product Advertising API

2009-08-01 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Bryan,

I decided not to totally write a new module for it. I took pyaws, and
re-factored it to account for the secret key you now have to use with
requests.

If you want the new ecs.py from pyaws, I'll be happy to get it to you.
I'm not 100% sure it works, but for what I've used it for I think it
does. Any testing is 100% appreciated.

Luke Seelenbinder

luke.seelenbin...@gmail.com

"I [may] disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire


br...@instantdirectmarketing.com wrote:
> Luke,
> I was curious how this was going.
> 
> I did find this:
> http://jjinux.blogspot.com/2009/06/python-amazon-product-advertising-api.html
> 
> import time
> import urllib
> 
> from boto.connection import AWSQueryConnection
> 
> AWS_ACCESS_KEY_ID = '...'
> AWS_ASSOCIATE_TAG = '...'
> AWS_SECRET_ACCESS_KEY = '...'
> 
> 
> search_index = 'All'
> keywords = 'pink'
> aws_conn = AWSQueryConnection(
> aws_access_key_id=AWS_ACCESS_KEY_ID,
> aws_secret_access_key=AWS_SECRET_ACCESS_KEY, is_secure=False,
> host='ecs.amazonaws.com')
> aws_conn.SignatureVersion = '2'
> params = dict(
> Service='AWSECommerceService',
> Version='2008-08-19',
> SignatureVersion=aws_conn.SignatureVersion,
> AWSAccessKeyId=AWS_ACCESS_KEY_ID,
> AssociateTag=AWS_ASSOCIATE_TAG,
> Operation='ItemSearch',
> SearchIndex=search_index,
> Keywords=keywords,
> ResponseGroup='ItemAttributes,Images',
> Order='salesrank',
> Timestamp=time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime()))
> verb = 'GET'
> path = '/onca/xml'
> qs, signature = aws_conn.get_signature(params, verb, path)
> qs = path + '?' + qs + '=' + urllib.quote(signature)
> print "verb:", verb, "qs:", qs
> response = aws_conn._mexe(verb, qs, None, headers={})
> print response.read()
> 
> 
> 
> On Jul 17, 8:34 am, Luke Seelenbinder <lukeq...@gmail.com> wrote:
>> I'm working on a django project right now that uses the Amazon Product
>> Advertising API. I was using pyaws, but it is quite outdated and won't
>> be useful for the changes coming in the next month.
>>
>> My first question is whether you know of any other python library for
>> it.
>> Second question, is there anybody willing to help me develop a new
>> python abstraction for the api.
>>
>> I'm going to get started today with a new python api, if there is
>> anybody willing to help, drop me an email (lukeqsee at gmail), or just
>> reply to this message.
>>
>> Thanks,
>> Luke
> > 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkp0PE8ACgkQXQrGVCncjPx4QACfQGVAE5fnZwUcM8DLCLmA9ZLc
loQAnjWhHC6zZS/2B8IkdGXkItTC20aT
=qxR4
-END PGP SIGNATURE-

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



Re: Log in problem

2009-07-31 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Try: {% if user.is_authenticated() %}

If that doesn't work, you would need to setup the
TEMPLATE_CONTEXT_PROCESSORS setting in settings.py.

http://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors

Luke
luke.seelenbin...@gmail.com

"I [may] disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire


When ideas fail wrote:
> Ok, thanks, i will try that. As a thought could i not have something
> like:
> 
> {% ifequal user.username "" %}
> 
> login form
> 
> {% else %}
> 
>  you are already logged in
> 
> I don't know if that would work or not though.
> 
> On 1 Aug, 01:30, Luke Seelenbinder <luke.seelenbin...@gmail.com>
> wrote:
> No it doesn't. That would be your problem, you would have to write a
> custom backend if you wanted to not show the login form to already
> logged-in visitors.
> 
> Luke
> luke.seelenbin...@gmail.com
> 
> "I [may] disapprove of what you say, but I will defend to the death your
> right to say it." -- Voltaire
> 
> 
> 
> When ideas fail wrote:
>>>> I'm using (r'^login/$', 'django.contrib.auth.views.login',
>>>> {'template_name': 'blogSite/login.html'}), for the view, so does that
>>>> pass a request of not?
>>>> On 1 Aug, 01:09, Luke Seelenbinder <luke.seelenbin...@gmail.com>
>>>> wrote:
>>>> Are you passing the "request" to it?
>>>> That's the only thing I can think of that would mess it up, otherwise it
>>>> looks good syntactically.
>>>> Luke
>>>> luke.seelenbin...@gmail.com
>>>> "I [may] disapprove of what you say, but I will defend to the death your
>>>> right to say it." -- Voltaire
>>>> When ideas fail wrote:
>>>>>>> Hi, i am using this template to log people in, but it seems to always
>>>>>>> return the login form no matter what i do, i can be logged in or
>>>>>>> logged out and it will still say i need to log in.
>>>>>>> Does anyone know what might be happening. Any help would be
>>>>>>> appreciated.
>>>>>>> Thanks
>>>>>>> {% extends "blogSite/index.html" %}
>>>>>>> {% block content %}
>>>>>>>{% if not request.user.is_authenticated %}
>>>>>>>{% if form.errors %}
>>>>>>>Sorry, that's not a valid 
>>>>>>> username or
>>>>>>> password
>>>>>>>{% endif %}
>>>>>>> Please enter you user name and password 
>>>>>>> below:
>>>>>>>
>>>>>>>>>>>>> for="username">Username:
>>>>>>>>>>>>> value=""
>>>>>>> id="username">
>>>>>>>>>>>>> for="password">Password:
>>>>>>>>>>>>> name="password" value=""
>>>>>>> id="password">
>>>>>>>
>>>>>>>>>>>>> value="../login/" />
>>>>>>>
>>>>>>>{% else %}
>>>>>>> you are already logged in 
>>>>>>>{% endif %}
>>>>>>> {% endblock %}
> 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpzqlIACgkQXQrGVCncjPzD9gCgne53F8UBFiwMpzD0WxfLFDd9
7K4AoIXGlYzqJNh3g+J8pBqsDFH4MaYa
=8Mku
-END PGP SIGNATURE-

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



Re: Do I need django.contrib.auth in my INSTALLED_APP when if I don't use the models from there?

2009-07-31 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

No, you would not. Hope that helps.

Luke

luke.seelenbin...@gmail.com

"I [may] disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire


Vasil Vangelovski wrote:
> It's like this:
> I actually have 3 projects. These projects share apps. So all the apps 
> besides the third party ones are placed in one folder which is on 
> PYTHONPATH. The third party ones are in another folder on the 
> PYTHONPATH. Yes 2 of these projects use the admin and do use the 
> ModelBackend for authentication, I have django.contrib.auth in 
> INSTALLED_APPS for those 2.
> 
> But this smaller project I'm asking about provides just a few views for 
> a REST API. Now the calls to that REST service are made only by one 
> application on the internal network which will have it's own 
> username/password in the settings file. And this project doesn't use the 
> admin or any of the models in django.contrib.auth (besides returning 
> User from the authenticate method in the backend).
> 
> So I guess I don't need django.contrib.auth in INSTALLED_APPS for that 
> project.
> 
> Luke Seelenbinder wrote:
> Vasil,
> 
> That will vary on what the apps you are using. If none of the apps
> depend on django.contrib.auth, you won't need it, unless you want to use
> the django admin (which depends on django.contrib.auth).
> 
> To fully answer your question, we would need to know what apps it is using.
> 
> Luke
> luke.seelenbin...@gmail.com
> 
> "I [may] disapprove of what you say, but I will defend to the death your
> right to say it." -- Voltaire
> 
> 
> Vasil Vangelovski wrote:
>   
>>>> I'm making a very small project that will use the apps/models from a 
>>>> larger one. This will be hosted on a separate domain. Now the larger 
>>>> project uses the models from django.contrib.auth, but I don't need and 
>>>> don't want to store users in a database for this smaller one. I'll just 
>>>> provide my own authentication backend that reads usernames and password 
>>>> from a config file and uses Base64 authentication. Do I still need to 
>>>> put django.contrib.auth in INSTALLED_APPS?
>>>>
>>>> 
>>

> 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpzjOQACgkQXQrGVCncjPysvQCcCXJrUwoK7pzgqp8LCh0BDby5
VIsAn3rEh74fXv9xaAF0AOFO83rYJ0TW
=K69Z
-END PGP SIGNATURE-

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



Re: Log in problem

2009-07-31 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

No it doesn't. That would be your problem, you would have to write a
custom backend if you wanted to not show the login form to already
logged-in visitors.

Luke
luke.seelenbin...@gmail.com

"I [may] disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire


When ideas fail wrote:
> I'm using (r'^login/$', 'django.contrib.auth.views.login',
> {'template_name': 'blogSite/login.html'}), for the view, so does that
> pass a request of not?
> 
> On 1 Aug, 01:09, Luke Seelenbinder <luke.seelenbin...@gmail.com>
> wrote:
> Are you passing the "request" to it?
> That's the only thing I can think of that would mess it up, otherwise it
> looks good syntactically.
> 
> Luke
> 
> luke.seelenbin...@gmail.com
> 
> "I [may] disapprove of what you say, but I will defend to the death your
> right to say it." -- Voltaire
> 
> 
> 
> When ideas fail wrote:
>>>> Hi, i am using this template to log people in, but it seems to always
>>>> return the login form no matter what i do, i can be logged in or
>>>> logged out and it will still say i need to log in.
>>>> Does anyone know what might be happening. Any help would be
>>>> appreciated.
>>>> Thanks
>>>> {% extends "blogSite/index.html" %}
>>>> {% block content %}
>>>>{% if not request.user.is_authenticated %}
>>>>{% if form.errors %}
>>>>Sorry, that's not a valid 
>>>> username or
>>>> password
>>>>{% endif %}
>>>> Please enter you user name and password below:
>>>>
>>>>Username:
>>>>>>> value=""
>>>> id="username">
>>>>Password:
>>>>>>> value=""
>>>> id="password">
>>>>
>>>>>>> value="../login/" />
>>>>
>>>>{% else %}
>>>> you are already logged in 
>>>>{% endif %}
>>>> {% endblock %}
> 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpzjIsACgkQXQrGVCncjPwajACfaas+qNkiozhiTDdnxJHFb0OB
SuoAn31FpPjrbeD4AlOqeOt5B6adzXd/
=qG2H
-END PGP SIGNATURE-

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



Re: Do I need django.contrib.auth in my INSTALLED_APP when if I don't use the models from there?

2009-07-31 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Vasil,

That will vary on what the apps you are using. If none of the apps
depend on django.contrib.auth, you won't need it, unless you want to use
the django admin (which depends on django.contrib.auth).

To fully answer your question, we would need to know what apps it is using.

Luke
luke.seelenbin...@gmail.com

"I [may] disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire


Vasil Vangelovski wrote:
> I'm making a very small project that will use the apps/models from a 
> larger one. This will be hosted on a separate domain. Now the larger 
> project uses the models from django.contrib.auth, but I don't need and 
> don't want to store users in a database for this smaller one. I'll just 
> provide my own authentication backend that reads usernames and password 
> from a config file and uses Base64 authentication. Do I still need to 
> put django.contrib.auth in INSTALLED_APPS?
> 
> > 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpziWMACgkQXQrGVCncjPxAVQCfb2PIkFzWgU5v2CGYe8oh5gG3
vNUAnihZxM5r0KgJpAR7V0G+TrEFFETD
=qJUh
-END PGP SIGNATURE-

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



Re: Log in problem

2009-07-31 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Are you passing the "request" to it?
That's the only thing I can think of that would mess it up, otherwise it
looks good syntactically.

Luke

luke.seelenbin...@gmail.com

"I [may] disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire


When ideas fail wrote:
> Hi, i am using this template to log people in, but it seems to always
> return the login form no matter what i do, i can be logged in or
> logged out and it will still say i need to log in.
> 
> Does anyone know what might be happening. Any help would be
> appreciated.
> 
> Thanks
> 
> {% extends "blogSite/index.html" %}
> 
> {% block content %}
>   {% if not request.user.is_authenticated %}
>   {% if form.errors %}
>   Sorry, that's not a valid username or
> password
>   {% endif %}
>Please enter you user name and password below:
>   
>   Username:
>id="username">
>   Password:
>id="password">
> 
>   
>value="../login/" />
>   
>   {% else %}
>you are already logged in 
>   {% endif %}
> 
> {% endblock %}
> > 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpzh8AACgkQXQrGVCncjPxJVACfQ68PD0uA2KGisU43jpzSLTbj
p78AnjVqqu37G8JTPQHI4Lnuatn++JuJ
=DCaK
-END PGP SIGNATURE-

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



Re: Django 1.1 returns 500 instead of 404 in non-debug mode

2009-07-30 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


Prabhu,

Let's establish the reason the 404.html doesn't show on a supposed 404
error; that is because every single request on the output you posted a
little while ago from the server is responded with a 500 error.
Something is fouled up with the views, or somewhere in the server process.

I'll look through and see if I can spot anything.

Good luck!

Luke
luke.seelenbin...@gmail.com

"I [may] disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire


prabhu S wrote:
> Hi Luke,
> 
> Thanks for your email. The particular source is already fine with
> no /. I also tried adding slash assuming you swapped the particular
> line in your email.
> 
> Can you give another shot and let me know if you can spot something?
> 
> Regards,
> Prabhu
> 
> On Jul 30, 6:46 pm, Luke Seelenbinder <luke.seelenbin...@gmail.com>
> wrote:
> Hey, I think I located your problem.
> 
> In file invoicy / guidy / urls.py
> 
> You should change the first url pattern to read:
> url(r'^/$', 'guidy_default', name='guidy-default'),
> instead of:
> url(r'^$', 'guidy_default', name='guidy-default'),
> 
> That should fix your problem. What is actually happening is you are
> raising 500s on 404s. That's why the 404 error page is not showing.
> 
> Luke
> luke.seelenbin...@gmail.com
> 
> "I [may] disapprove of what you say, but I will defend to the death your
> right to say it." -- Voltaire
> 
> 
> 
> 
> 
> prabhu S wrote:
>>>> Hi Karen,
>>>> Thanks for replying. I have put my 404.html in the same place as that
>>>> of500.html. To make sure, I even copy pasted500.html and changed the
>>>> error message text alone.
>>>> Here is an output from the django development server, when I tried to
>>>> access "sdfsa" (Invalid url)
>>>> [30/Jul/2009 18:25:45] "GET /admin/clienty/sdfsa HTTP/1.1"5001387
>>>> [30/Jul/2009 18:25:45] "GET /scripts/jquery-1.3.2.min.js HTTP/1.1"500
>>>> 1387
>>>> [30/Jul/2009 18:25:46] "GET /css/style.css HTTP/1.1"5001387
>>>> I have the sources online athttp://github.com/prabhu/invoicy. I would
>>>> appreciate if you can take a look at settings.py and let me know if
>>>> something is obvious.
>>>> Thanks & Regards,
>>>> Prabhu
>>>> On Jul 30, 2:25 pm, Karen Tracey <kmtra...@gmail.com> wrote:
>>>>> On Thu, Jul 30, 2009 at 8:40 AM, prabhu S <prabhu...@gmail.com> wrote:
>>>>>> Hi All,
>>>>>> I am not noticing a weird issue in django 1.1. When DEBUG is true in
>>>>>> settings and if I try a non-existent url, django shows me a friendly
>>>>>> 404 page. Now I create 404.html and500.html and place this in
>>>>>> templates directory. Then If I turn off debug and try a non-existent
>>>>>> url, I expect to see my 404 html. Instead django shows me500.html.
>>>>>> Infact, even in development I see500error codes for missing css,
>>>>>> images and js.
>>>>>> Is anyone else noticing the same issue? Am I missing something?
>>>>> I cannot recreate this.  Are you absolutely sure everything is set so that
>>>>> your 404.html is being found by the server?
>>>>> Karen
> 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpyTG0ACgkQXQrGVCncjPz94gCcCkyRaKjRdf11QcCU1x8qnRXp
lPsAoIjA42jV5QHx/Vrs5pUje+JAnL88
=jGM0
-END PGP SIGNATURE-

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



Re: how encrypt datetime.now with python?

2009-07-30 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

convert it to a string: str(datetime.now())

Luke
luke.seelenbin...@gmail.com

"I [may] disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire


Asinox wrote:
> hi guys, i want to encrypt the "datetime.now()" , im try with base64
> but base64 need string... how ill encrypt ?
> Thanks :)
> > 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpyBAIACgkQXQrGVCncjPylkACgmeeVS61T62myd/v+cxIlqxU3
9VkAn0QFoQwGBJFFvzsSO/FOLuFrtVcy
=KS21
-END PGP SIGNATURE-

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



Re: Django 1.1 returns 500 instead of 404 in non-debug mode

2009-07-30 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hey, I think I located your problem.

In file invoicy / guidy / urls.py

You should change the first url pattern to read:
url(r'^/$', 'guidy_default', name='guidy-default'),
instead of:
url(r'^$', 'guidy_default', name='guidy-default'),

That should fix your problem. What is actually happening is you are
raising 500s on 404s. That's why the 404 error page is not showing.

Luke
luke.seelenbin...@gmail.com

"I [may] disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire


prabhu S wrote:
> Hi Karen,
> 
> Thanks for replying. I have put my 404.html in the same place as that
> of 500.html. To make sure, I even copy pasted 500.html and changed the
> error message text alone.
> 
> Here is an output from the django development server, when I tried to
> access "sdfsa" (Invalid url)
> 
> [30/Jul/2009 18:25:45] "GET /admin/clienty/sdfsa HTTP/1.1" 500 1387
> [30/Jul/2009 18:25:45] "GET /scripts/jquery-1.3.2.min.js HTTP/1.1" 500
> 1387
> [30/Jul/2009 18:25:46] "GET /css/style.css HTTP/1.1" 500 1387
> 
> I have the sources online at http://github.com/prabhu/invoicy. I would
> appreciate if you can take a look at settings.py and let me know if
> something is obvious.
> 
> Thanks & Regards,
> Prabhu
> 
> On Jul 30, 2:25 pm, Karen Tracey  wrote:
>> On Thu, Jul 30, 2009 at 8:40 AM, prabhu S  wrote:
>>
>>> Hi All,
>>> I am not noticing a weird issue in django 1.1. When DEBUG is true in
>>> settings and if I try a non-existent url, django shows me a friendly
>>> 404 page. Now I create 404.html and 500.html and place this in
>>> templates directory. Then If I turn off debug and try a non-existent
>>> url, I expect to see my 404 html. Instead django shows me 500.html.
>>> Infact, even in development I see 500 error codes for missing css,
>>> images and js.
>>> Is anyone else noticing the same issue? Am I missing something?
>> I cannot recreate this.  Are you absolutely sure everything is set so that
>> your 404.html is being found by the server?
>>
>> Karen
> > 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpx3HAACgkQXQrGVCncjPyTCACfR6jyWAfXScSgM9STXKN5nksa
zRYAoJv2zvJnLpI47kuuArFS+tO5X6MW
=7wa6
-END PGP SIGNATURE-

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



Re: dictionaries in template

2009-07-30 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

You are overwriting the 'answer' key every time. So there is only one
key called 'answer'. Try editing it so you make the 'answer' key a list
of the 'attach_list's, that is one possible solution.

Or possibly do you mean to use if loops in the template since you are
only passing one object?

Luke

luke.seelenbin...@gmail.com

"I [may] disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire


Salvatore Leone wrote:
> Hi,
> 
> I pass to my template a dictionary of answer -> [attach_list]
> 
> so the data structure is
> 
> answers_list[answer] = attach_list
> 
> 
> Inside the template I actually can read the answers:
> 
> {%  for answer in answers_list.keys %}
> #use the answer object
> 
> # answer_list.answer returns a attach list, right?
> {% for attach in answer_list.answer %}
># use the attach
># but nothing happens!
> {% endfor %}
> 
> any idea?
> -Salvatore
> 
> > 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpxlOwACgkQXQrGVCncjPx7RACghWejN3IDjVHsVENQ99W2PA/D
IRMAn2r6nX2J3bECrpYAxp1IFSCCYH8C
=+qy+
-END PGP SIGNATURE-

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



Re: [solved]Re: test if GET is "empty"

2009-07-29 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

There is a more "pythonic" way to test, use request.GET.get(,
False)

e.g.:
if request.GET.get('q', False):
etc.

That tests the dict for the key 'q' if it's not there, it returns false.

Luke Seelenbinder

luke.seelenbin...@gmail.com


Salvatore Leone wrote:
> 
>> Given the way boolean tests go in Python, you should just be able to  
>> test for the dictionary itself:
>>
>> if request.GET:
>>
>> else:
>>
>>
>> E
>>   
> 
> mmm I don't think so, I think request.GET is true even if the dictionary 
> is empty, isn't it?
> 
> so the test will allways return true for a GET request.
> 
> -Salvatore
> 
> 
> 
> > 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpwXD4ACgkQXQrGVCncjPxcJwCgsLS2/6YwW64288KRzdUW0Bub
FtsAn3kAW7kb01zMPkVvaEjLLZl5/InB
=3IX4
-END PGP SIGNATURE-

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



Re: No such Table Error

2009-07-28 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Did you run manage.py syncdb in your project folder?
And are the apps in your settings.py?

Luke Seelenbinder


marcoshernandez wrote:
> Im having this error in my application (both admin models and my app
> models) I'm almost certain that has to be something with Apache-
> mod_wsgi not finding the files... but I just can't find the origin of
> the error...
> complete traceback next:
> 
> Environment:
> 
> Request Method: GET
> Request URL: http://127.0.0.1/admin/
> Django Version: 1.0.2 final
> Python Version: 2.6.2
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.admin',
>  'mysite.polls']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware')
> 
> 
> Traceback:
> File "C:\Python26\lib\site-packages\django\core\handlers\base.py" in
> get_response
>   86. response = callback(request, *callback_args,
> **callback_kwargs)
> File "C:\Python26\lib\site-packages\django\contrib\admin\sites.py" in
> root
>   140. if not self.has_permission(request):
> File "C:\Python26\lib\site-packages\django\contrib\admin\sites.py" in
> has_permission
>   99. return request.user.is_authenticated() and
> request.user.is_staff
> File "C:\Python26\lib\site-packages\django\contrib\auth\middleware.py"
> in __get__
>   5. request._cached_user = get_user(request)
> File "C:\Python26\lib\site-packages\django\contrib\auth\__init__.py"
> in get_user
>   83. user_id = request.session[SESSION_KEY]
> File "C:\Python26\lib\site-packages\django\contrib\sessions\backends
> \base.py" in __getitem__
>   46. return self._session[key]
> File "C:\Python26\lib\site-packages\django\contrib\sessions\backends
> \base.py" in _get_session
>   172. self._session_cache = self.load()
> File "C:\Python26\lib\site-packages\django\contrib\sessions\backends
> \db.py" in load
>   16. expire_date__gt=datetime.datetime.now()
> File "C:\Python26\lib\site-packages\django\db\models\manager.py" in
> get
>   93. return self.get_query_set().get(*args, **kwargs)
> File "C:\Python26\lib\site-packages\django\db\models\query.py" in get
>   304. num = len(clone)
> File "C:\Python26\lib\site-packages\django\db\models\query.py" in
> __len__
>   160. self._result_cache = list(self.iterator())
> File "C:\Python26\lib\site-packages\django\db\models\query.py" in
> iterator
>   275. for row in self.query.results_iter():
> File "C:\Python26\lib\site-packages\django\db\models\sql\query.py" in
> results_iter
>   206. for rows in self.execute_sql(MULTI):
> File "C:\Python26\lib\site-packages\django\db\models\sql\query.py" in
> execute_sql
>   1734. cursor.execute(sql, params)
> File "C:\Python26\lib\site-packages\django\db\backends\util.py" in
> execute
>   19. return self.cursor.execute(sql, params)
> File "C:\Python26\lib\site-packages\django\db\backends
> \sqlite3\base.py" in execute
>   168. return Database.Cursor.execute(self, query, params)
> 
> Exception Type: OperationalError at /admin/
> Exception Value: no such table: django_session
> > 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpvulIACgkQXQrGVCncjPxvbwCePG3a0DGKpsYcHZfh5l0cAcZX
JlcAn2xnNX8OguotubJcSbY0wxhHXk9A
=Ko3m
-END PGP SIGNATURE-

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



Re: IDE for Django and Ext JS

2009-07-28 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I don't know of an extension for Eclipse. I really hope somebody will
develop one soon. As far as Netbeans django template handling, I've
heard they have a beta version. Haven't tried it yet though.

Luke S.

Jonas Obrist wrote:
> Maybe a good question would be is there any IDE that supports the django 
> template language? Because I use eclipse (pydev+webtools) but I really 
> dislike it that it complains about my HTML files being invalid because 
> of the django tags. Also a highlighting mode might reduce the amount of 
> errors one (=me) does...
> 
> Luke Seelenbinder wrote:
> I personally use Eclipse w/ PyDEV and web dev tools. I absolutely love
> it. I tried netbeans a while ago, and didn't see an advantage to switch
> to it.
> 
> That being said, IDEs are really a matter of personal preference, I know
> of a lot of people that just use vim. My recommendation is try out the
> ones that interest you and have the features you need, give them a week
> of development and decide for yourself. That is really the only way to
> find "your" IDE. We could start a fight really quickly if "the best IDE"
> discussion got started. :)
> 
> Luke S.
> 
> Amir Habibi wrote:
>   
>>>> Hi All,
>>>>
>>>> What  development environment do you suggest for Django and Ext JS
>>>> based large projects?
>>>> Is Netbeans the best choice out there?
>>>>
>>>> Thanks
>>>> Amir
>>>>
>>>> 
>>

> 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpvRqMACgkQXQrGVCncjPyYVQCfZvP8eAz96x4ME/BNUXwBmm+3
OXcAn0y+ub7CN9xWYGtVn0eFNshUUdtd
=AO1O
-END PGP SIGNATURE-

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



Re: IDE for Django and Ext JS

2009-07-28 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I personally use Eclipse w/ PyDEV and web dev tools. I absolutely love
it. I tried netbeans a while ago, and didn't see an advantage to switch
to it.

That being said, IDEs are really a matter of personal preference, I know
of a lot of people that just use vim. My recommendation is try out the
ones that interest you and have the features you need, give them a week
of development and decide for yourself. That is really the only way to
find "your" IDE. We could start a fight really quickly if "the best IDE"
discussion got started. :)

Luke S.

Amir Habibi wrote:
> Hi All,
> 
> What  development environment do you suggest for Django and Ext JS
> based large projects?
> Is Netbeans the best choice out there?
> 
> Thanks
> Amir
> 
> > 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEUEARECAAYFAkpvO84ACgkQXQrGVCncjPxT1wCbBHbDNr19IJ/oI4ZR6VnMOZie
jOkAlik7heMvG6xoxqhyq+Cjt0fywe0=
=Tnav
-END PGP SIGNATURE-

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



Re: Where are the admin app icons from?

2009-07-27 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

No problem, glad to help. At that size things really are hard to deal
with, hope you find the solution.

Luke S.

Margie wrote:
> 
> I'll try the css idea, but I suspect that things this small just can't
> be resized well.  I actually contacted Wilson Miner, and he said that
> he did create those especially for the admin site.  When I asked him
> about scaling other images (like the famfam ones, which he also
> pointed me to), he said:  "No at those sizes, you have to design the
> icons at the size they'll be used. Not enough pixels in such a small
> image to scale properly."
> 
> Between the famfam stuff and various other random "finds" on the web,
> I think I can get by.  Thanks for the pointers to that other grey
> scale library as well.  I can see that being useful in the future.
> 
> Margie
> 
> On Jul 27, 12:15 pm, Luke Seelenbinder <luke.seelenbin...@gmail.com>
> wrote:
>> Could you resize them simply with CSS?
>> CSS handles resizing quite well.
>>
>> I did find one set of icons sized at 10x10 
>> here:http://www.brandspankingnew.net/archive/2006/12/hohoho.html
>> But they are greyscale.
>>
>> Luke S.
>>
>> On Mon, Jul 27, 2009 at 3:07 PM, Margie <margierogin...@yahoo.com> wrote:
>>
>>> Yeah, I looked at those and they are very nice, but not quite the
>>> same, and the size differences seem to be a problem.  My graphic
>>> design skills are pretty minimal.  I tried scaling them down to the
>>> size I need in gimp, but they didn't look very good after that.
>>> Tried the "minis" in that set as well, but they were *too* small!
>>> Arrgh!  It ain't easy designing a web app with no graphic design
>>> skills!
>>> Margie
>>> On Jul 27, 11:11 am, Luke Seelenbinder <luke.seelenbin...@gmail.com>
>>> wrote:
>>>> I think they are the FamFamFam Icon pack.
>>>> http://www.famfamfam.com/
>>>> Luke S.
>>>> On 07/27/2009 02:10 PM, Margie wrote:
>>>>> Yeah ... I know where the icons used in the admin app are.  And I'm
>>>>> using them in my own app (which is derived from the admin app).  So I
>>>>> was just trying to figure out if they came from some general package
>>>>> of icons where there were more with the same look and feel.  Based on
>>>>> Daniel's reply, it sounds like they were designed specifically for
>>>>> django, or that I should talk to Wilson Miner about it. (Thanks,
>>>>> Daniel).
>>>>> Margie
>>>>> On Jul 25, 6:38 pm, Asinox<asi...@gmail.com>  wrote:
>>>>>> The icons :
>>>>>> site-packages\django\contrib\admin\media\img\admin
>>>>>> :)
>>>>>> On Jul 25, 1:46 pm, Margie<margierogin...@yahoo.com>  wrote:
>>>>>>> Thanks Alex - I will check those out.  But if anyone knows where the
>>>>>>> admin icons came from, I'd still love to know ...
>>>>>>> Margie
>>>>>>> On Jul 24, 4:01 pm, Alex Gaynor<alex.gay...@gmail.com>  wrote:
>>>>>>>> On Fri, Jul 24, 2009 at 5:12 PM, Margie<margierogin...@yahoo.com>  
>>>>>>>> wrote:
>>>>>>>>> Hi,
>>>>>>>>> I'm wondering if the icons in the admin app (for example, the
>>>>>>>>> addlink.gificon) come from some standardicon(free)iconpackage
>>>>>>>>> where there are more goodies of the same sort?  Anyone have any
>>>>>>>>> pointers for where those came from?
>>>>>>>>> Margie
>>>>>>>> I don't know where the Django ones came from (they may have been
>>>>>>>> custom designed for all I know), but if you're looking for good free
>>>>>>>> icons I'm quite fond of the famfamfam 
>>>>>>>> silkiconset:http://www.famfamfam.com/lab/icons/silk/
>>>>>>>> Alex
>>>>>>>> --
>>>>>>>> "I disapprove of what you say, but I will defend to the death your
>>>>>>>> right to say it." -- Voltaire
>>>>>>>> "The people's good is the highest law." -- Cicero
>>>>>>>> "Code can always be simpler than you think, but never as simple as you
>>>>>>>> want" -- Me
>>>>  smime.p7s
>>>> 4KViewDownload
> > 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpuMiMACgkQXQrGVCncjPy34wCeOtbFlM0vY0ezkKtETWKAI43v
hCEAoKSqReXUCDPihdtoDegsPQHmQYZf
=OtXY
-END PGP SIGNATURE-

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



Re: Trying to reference a foreignKey in a modelAdmin class

2009-07-27 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

What error exactly is it throwing?

I noticed this: is it supposed to be:
list_filter('Competition.startDate', 'Division')?

Hope that helps. We really need the error it is throwing to more
accurately diagnose and repair.

Luke S.

irishsteve wrote:
> Hi
> 
> I'm new to Django, so thanks in advance for taking the time to help
> me! I can't work out how to reference a foreignKey in the list_filter
> method.
> 
> 
> 
> Here are the two relevant objects from my model:
> 
> class Competition(models.Model):
> name = models.CharField("Event title", max_length=200)
> startDate = models.DateTimeField('Competition start date')
> divisions = models.ManyToManyField(Division)
> 
> def __unicode__(self):
> return self.name
> 
> class Entry(models.Model):
> member = models.ForeignKey(Member)
> competition = models.ForeignKey(Competition)
> division = models.ForeignKey(Division, null=True, blank=True)
> finishPosition = models.IntegerField("Finishing position",
> null=True, blank=True)
> description = models.TextField("Update", null=True, blank=True)
> 
> class Meta:
> verbose_name_plural = "entries"
> unique_together = ['member','competition']
> 
> def __unicode__(self):
> return self.member.get_formatted_name()
> 
> 
> 
> 
> 
> Then I have a few modelAdmin classes, here is the problematic one:
> 
> class EntryAdmin(admin.ModelAdmin):
> fieldsets = [
> ("Event entrant details", { "fields": ("member",
> "competition", "division")}),
> ("Event results information", {"fields": ("finishPosition",
> "description")})
> ]
> 
> list_display = ('member', 'competition', 'division')
> ordering = ('member',)
> list_filter = ('competition','division')
> 
> admin.site.register(Entry, EntryAdmin)
> 
> 
> Everything is working correctly however, in the list_filter method,
> I've been trying to do:
> 
> list_filter = ('competition.startDate', 'division')
> 
> but it's just throwing an error. I've done quite a lot of digging
> about and I'm sure the answer is staring me in the face, but I haven't
> been able to work it out.
> 
> Many thanks,
> Steve
> 
> 
> > 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpuLOQACgkQXQrGVCncjPyIqACgpRWSWWc6bQYNwz6z3o34ZpTK
tXwAnA+KHWA2ySocF2MuiOJrEzR33CP1
=aHDA
-END PGP SIGNATURE-

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



Re: Where are the admin app icons from?

2009-07-27 Thread Luke Seelenbinder

Could you resize them simply with CSS?
CSS handles resizing quite well.

I did find one set of icons sized at 10x10 here:
http://www.brandspankingnew.net/archive/2006/12/hohoho.html
But they are greyscale.

Luke S.

On Mon, Jul 27, 2009 at 3:07 PM, Margie <margierogin...@yahoo.com> wrote:
>
> Yeah, I looked at those and they are very nice, but not quite the
> same, and the size differences seem to be a problem.  My graphic
> design skills are pretty minimal.  I tried scaling them down to the
> size I need in gimp, but they didn't look very good after that.
> Tried the "minis" in that set as well, but they were *too* small!
>
> Arrgh!  It ain't easy designing a web app with no graphic design
> skills!
>
> Margie
>
> On Jul 27, 11:11 am, Luke Seelenbinder <luke.seelenbin...@gmail.com>
> wrote:
> > I think they are the FamFamFam Icon pack.
> >
> > http://www.famfamfam.com/
> >
> > Luke S.
> >
> > On 07/27/2009 02:10 PM, Margie wrote:
> >
> >
> >
> > > Yeah ... I know where the icons used in the admin app are.  And I'm
> > > using them in my own app (which is derived from the admin app).  So I
> > > was just trying to figure out if they came from some general package
> > > of icons where there were more with the same look and feel.  Based on
> > > Daniel's reply, it sounds like they were designed specifically for
> > > django, or that I should talk to Wilson Miner about it. (Thanks,
> > > Daniel).
> >
> > > Margie
> >
> > > On Jul 25, 6:38 pm, Asinox<asi...@gmail.com>  wrote:
> > >> The icons :
> >
> > >> site-packages\django\contrib\admin\media\img\admin
> >
> > >> :)
> >
> > >> On Jul 25, 1:46 pm, Margie<margierogin...@yahoo.com>  wrote:
> >
> > >>> Thanks Alex - I will check those out.  But if anyone knows where the
> > >>> admin icons came from, I'd still love to know ...
> >
> > >>> Margie
> >
> > >>> On Jul 24, 4:01 pm, Alex Gaynor<alex.gay...@gmail.com>  wrote:
> >
> > >>>> On Fri, Jul 24, 2009 at 5:12 PM, Margie<margierogin...@yahoo.com>  
> > >>>> wrote:
> >
> > >>>>> Hi,
> >
> > >>>>> I'm wondering if the icons in the admin app (for example, the
> > >>>>> addlink.gificon) come from some standardicon(free)iconpackage
> > >>>>> where there are more goodies of the same sort?  Anyone have any
> > >>>>> pointers for where those came from?
> >
> > >>>>> Margie
> >
> > >>>> I don't know where the Django ones came from (they may have been
> > >>>> custom designed for all I know), but if you're looking for good free
> > >>>> icons I'm quite fond of the famfamfam 
> > >>>> silkiconset:http://www.famfamfam.com/lab/icons/silk/
> >
> > >>>> Alex
> >
> > >>>> --
> > >>>> "I disapprove of what you say, but I will defend to the death your
> > >>>> right to say it." -- Voltaire
> > >>>> "The people's good is the highest law." -- Cicero
> > >>>> "Code can always be simpler than you think, but never as simple as you
> > >>>> want" -- Me
> > > >
> >
> >
> >  smime.p7s
> > 4KViewDownload
>
> >

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



Re: Where are the admin app icons from?

2009-07-27 Thread Luke Seelenbinder

I think they are the FamFamFam Icon pack.

http://www.famfamfam.com/

Luke S.

On 07/27/2009 02:10 PM, Margie wrote:


Yeah ... I know where the icons used in the admin app are.  And I'm
using them in my own app (which is derived from the admin app).  So I
was just trying to figure out if they came from some general package
of icons where there were more with the same look and feel.  Based on
Daniel's reply, it sounds like they were designed specifically for
django, or that I should talk to Wilson Miner about it. (Thanks,
Daniel).

Margie

On Jul 25, 6:38 pm, Asinox  wrote:

The icons :

site-packages\django\contrib\admin\media\img\admin

:)

On Jul 25, 1:46 pm, Margie  wrote:


Thanks Alex - I will check those out.  But if anyone knows where the
admin icons came from, I'd still love to know ...



Margie



On Jul 24, 4:01 pm, Alex Gaynor  wrote:



On Fri, Jul 24, 2009 at 5:12 PM, Margie  wrote:



Hi,



I'm wondering if the icons in the admin app (for example, the
addlink.gificon) come from some standardicon(free)iconpackage
where there are more goodies of the same sort?  Anyone have any
pointers for where those came from?



Margie



I don't know where the Django ones came from (they may have been
custom designed for all I know), but if you're looking for good free
icons I'm quite fond of the famfamfam 
silkiconset:http://www.famfamfam.com/lab/icons/silk/



Alex



--
"I disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you
want" -- Me

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





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Application level data

2009-07-27 Thread Luke Seelenbinder
Look at the official caching documentation:

Low-level API (for individual data pieces)
http://docs.djangoproject.com/en/dev/topics/cache/#the-low-level-cache-api

That should work for you

Luke S.

On 07/27/2009 12:21 PM, vishy wrote:
> Hi,
>
> I have some data which I don't want to get from database for every
> user request.How should I make such data available to all users(like
> caching?)? What options are available in Django?
>
> thanks
> --~--~-~--~~~---~--~~
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en
> -~--~~~~--~~--~--~---
>
>



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Using Django's Cache

2009-07-20 Thread Luke Seelenbinder

That is entirely possible; however, it might slow down the rendering
of the template, because you simply have more to handle.

Luke

On Jul 20, 12:49 pm, WilsonOfCanada  wrote:
> Well then I will have to try a different approach.  When using
> render_to_response('webpage.html', d), I have d as a dictionary.  I
> was wondering if you send a whole text file as a part of the
> dictionary.
>
> For example:
>
> fileView = open('C://path//main_cities.txt', 'r+')
> d['main_cities'] = fileView
> render_to_response('webpage.html', d)
>
> Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How redirect lightweight webserver messages?

2009-07-17 Thread Luke Seelenbinder

That would depend on the OS you use.

If you use linux:  "python manage.py runserver >> example.log"
That will save the output in a file, instead of showing it on screen,
allowing you to have another webserver serve it.

Luke

On Jul 17, 6:38 am, Andrew  wrote:
> Hi,
> I run Django light web server with command line "python manage.py
> runserver".
> I must redirect to another stream web server output messages, the ones
> like "[17/Jul/2009 12:35:58] "GET /home/foo/ HTTP/1.1" 200 1061".
> Any help?
>
> Tnx,
> 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Amazon Product Advertising API

2009-07-17 Thread Luke Seelenbinder

I'm working on a django project right now that uses the Amazon Product
Advertising API. I was using pyaws, but it is quite outdated and won't
be useful for the changes coming in the next month.

My first question is whether you know of any other python library for
it.
Second question, is there anybody willing to help me develop a new
python abstraction for the api.

I'm going to get started today with a new python api, if there is
anybody willing to help, drop me an email (lukeqsee at gmail), or just
reply to this message.

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



order_by function

2008-11-21 Thread Luke Seelenbinder

Can I order_by a function within the model? I know you can list them
in the admin inteface, etc. But can you order_by a model function? Or
would you have to write a custom piece of code to do that?

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



Combine QuerySets from two different child models

2008-11-19 Thread Luke Seelenbinder

the models are:

class Word(models.Model):
   ... some stuff...

   class Meta:
   abstract=True
class Noun(Word):
.. some stuff ..
class Verb(Word):
  ... some stuff ...

code:

nouns= Noun.objects.all()
verbs=Verb.objects.all()

words = verbs | nouns

I get an error saying: "Cannot combine queries on two different base
models."
is there anyway to accomplish this, the reason I don't want to do:

nouns= list(Noun.objects.all())
verbs=list(Verb.objects.all())

words = verbs + nouns

is I want to be able to run an order_by on the resulting list or
queryset

thanks,

Luke

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: ManyToManyField with multiple model options

2008-11-15 Thread Luke Seelenbinder

That was a typo. The error I'm getting is
"ForeignKey cannot define a relation with abstract class Word"
It is a ManyToMany through table, that's the reason it is ForeignKey

Luke

On Nov 15, 8:29 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sat, 2008-11-15 at 06:57 -0800, Luke Seelenbinder wrote:
> > Basically, I want to allow a ManyToManyField to use any of a Model's
> > children, like this:
>
> > class Word(models.Model):
> >     word = models.CharField(...)
>
> >     class Meta:
> >           abstract = True
>
> > class Noun(Word):
> >    gender = models.CharField(...)
> > class Verb(Word):
> >    irregular = models.BooleanField(...)
>
> > #Here is where I need the help
> > def WordStats(models.Model):
>
> This isn't valid Python. It looks like a cross between defining a
> function and defining a class.
>
> >    word = models.ManyToManyField(Word)
>
> This isn't valid. Model field belong in models, not functions. I suspect
> you've just made a typo and typed "def" above when you meant "class". If
> you've actually mentioned what the error you were seeing was (or read it
> carefully), I suspect that Python would have told you basically that.
>
> >    stats = ...
>
> > Is there anyway to accomplish this? Without writing separate models
> > for each word.
>
> A many-to-many field to the Word model is an appropriate approach.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Css and Images are missing

2008-11-15 Thread Luke Seelenbinder

Django doesn't serve the media files, look at
http://docs.djangoproject.com/en/dev/howto/static-files/?from=olddocs

Luke

On Nov 15, 10:49 am, Luis Goncalves <[EMAIL PROTECTED]> wrote:
> Hello guys I need your help in here.
>
> Sorry I am new in Django and I am having a problem, my css and jpgs
> are missing.
>
> I will write everything what i have and then maybe someone could give
> me a hint :)
>
> My settings.py:
> MEDIA_ROOT = '/home/lgoncalves/Arquivos/MyVitaminesShop/media/'
> MEDIA_URL = 'http://127.0.0.1:8000/media/'
> ADMIN_MEDIA_PREFIX = '/media/'
>
> My urls.py:
> (r'^media/(?P.*)', 'django.views.static.serve',{'document_root':
> 'settings.MEDIA_ROOT'}),
>
> And an example of base.html:
> http://127.0.0.1:8000/media/
> mm_health_nutr.css" type="text/css" />
> http://127.0.0.1:8000/media/picture.jpg; alt="Header image"
> width="382" height="101" border="0" />
>
> Thanks so much for your help.
>
> Best Regards,
>
> Luis
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Bug in Admin or in my model ?

2008-11-15 Thread Luke Seelenbinder

You need to specify your encoding in your models file.
Like: # -*- coding: iso-8859-15 -*-
Look at http://
evanjones.ca/python-utf8.html The sixth section of the page
explains.

Regards
Luke

On Nov 15, 11:09 am, Ivan Mincik <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a problem when adding record by Django Admin and I am not sure where I 
> have to look for it. Is this some problem in Django Admin or it can be solved 
> by some
> configuration in model ?
> I use  Foreign Key in table where I want to add record. Foreign Key is the 
> field containing some non ASCII characters. 
> See:http://gista.sk/dl/bugs/django/add_record_in_admin.png
> I want to add record to "Metadata" which uses ForeignKey from "Vrstva".
>
> *** When I submit, I get this error (nothing else printed):
> Screenshot is 
> here:http://gista.sk/dl/bugs/django/add_record_in_admin_submit.png
>
> Mod_python error: "PythonHandler django.core.handlers.modpython"
>
> Traceback (most recent call last):
>
>   File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299, in 
> HandlerDispatch
>     result = object(req)
>
>   File "/var/lib/python-support/python2.4/django/core/handlers/modpython.py", 
> line 222, in handler
>     return ModPythonHandler()(req)
>
>   File "/var/lib/python-support/python2.4/django/core/handlers/modpython.py", 
> line 195, in __call__
>     response = self.get_response(request)
>
>   File "/var/lib/python-support/python2.4/django/core/handlers/base.py", line 
> 128, in get_response
>     return self.handle_uncaught_exception(request, resolver, exc_info)
>
>   File "/var/lib/python-support/python2.4/django/core/handlers/base.py", line 
> 148, in handle_uncaught_exception
>     return debug.technical_500_response(request, *exc_info)
>
>   File "/var/lib/python-support/python2.4/django/views/debug.py", line 39, in 
> technical_500_response
>     html = reporter.get_traceback_html()
>
>   File "/var/lib/python-support/python2.4/django/views/debug.py", line 95, in 
> get_traceback_html
>     c = Context({
>
>   File "/var/lib/python-support/python2.4/django/utils/encoding.py", line 35, 
> in smart_unicode
>     return force_unicode(s, encoding, strings_only, errors)
>
>   File "/var/lib/python-support/python2.4/django/utils/encoding.py", line 70, 
> in force_unicode
>     raise DjangoUnicodeDecodeError(s, *e.args)
>
> DjangoUnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: 
> ordinal not in range(128). You passed in
>
> *** Snippets from my model:
> Full models.py is here:http://gista.sk/dl/bugs/django/models.py
>
> class Metadata(models.Model):
>         vrstva = models.ForeignKey(Vrstva)
>         nazov = models.CharField(u"Názov stĺpca", max_length=100)
>         dlhy_nazov = models.CharField(u"Dlhý názov stĺpca", max_length=200)
>         hodnota = models.CharField(u"Formátovanie hodnoty", max_length=512, 
> default="%s")
>         externa_databaza = models.ForeignKey(Externa_databaza, blank=True, 
> null=True)
>         sql = models.TextField(u"SQL dopyt", blank=True)
>
>         def __unicode__(self):
>                 return "%s %s" % (self.vrstva,self.nazov)
>
>         class Meta:
>                 ordering = ["vrstva", "nazov"]
>                 verbose_name_plural = u"metadata"
>
> class Vrstva(Vrstvy_zaklad):
>         kategoria = models.ForeignKey(Kategoria, verbose_name=u"Kategória")
>         sql_atrib = models.TextField(u"Atributový SQL", blank=True)
>         tabulka = models.CharField(u"Tabuľka", max_length=200, blank=True, 
> help_text=u"Tabuľka v ktorej sú gid a geom pre danú vrstvu")
>         transparent = models.BooleanField(u"Transparent")
>         zoom_level = models.IntegerField(u"Zoom level", default=1, 
> help_text=u"Zoom level ktory sa použije pri zoomovaní na objekt pri 
> vyhľadávaní")
>         sql_hladanie = models.TextField(u"Vyhľadávací SQL", blank=True)
>
>         class Meta:
>                 ordering = ['kategoria','poradie']
>                 verbose_name_plural = u"vrstvy"
>
> *** My environment details:
> OS: Debian Etch with python 2.4
> Django version: 1.0, also tested on new 1.0.1 with same results
> Database: PostgreSQL 8.1
>
> *** It looks like the bug #3924 which should be allready closed.
>
> Can anybody give me some hint where to look for the solution ?
>
> Thanks a lot
> --
> Ivan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



ManyToManyField with multiple model options

2008-11-15 Thread Luke Seelenbinder

Basically, I want to allow a ManyToManyField to use any of a Model's
children, like this:

class Word(models.Model):
word = models.CharField(...)

class Meta:
  abstract = True

class Noun(Word):
   gender = models.CharField(...)
class Verb(Word):
   irregular = models.BooleanField(...)

#Here is where I need the help
def WordStats(models.Model):
   # I get an error saying
   word = models.ManyToManyField(Word)
   stats = ...

Is there anyway to accomplish this? Without writing separate models
for each word.

Thanks,
Luke  S.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Foreign Key with a default key

2008-11-13 Thread Luke Seelenbinder

made a mistake in the c the line:
definition  =   models.CharField(max_length='100',
default=Stat())

should be:
definition  =   models.CharField(max_length='100',)

On Nov 13, 6:35 pm, Luke Seelenbinder <[EMAIL PROTECTED]> wrote:
> I'm am trying to make a ForeignKey with a default value.
> But when I save i get a "invalid literal for int() with base 10: 'Stat
> object'" error
> Here is my code:
>
> from django.db import models
>
> class Stat(models.Model):
>     total               =   models.IntegerField(default=0)
>     right               =   models.IntegerField(default=0)
>     wrong               =   models.IntegerField(default=0)
>
>     def percent_right(self):
>         return (float(right) / total) * 100
>
> class Noun(models.Model):
>
>     word                =   models.CharField(max_length='50',
> unique=True)
>
>     definition          =   models.CharField(max_length='100',
> default=Stat())
>
>     definition_stats    =   models.ForeignKey(Stat, default=Stat(),)
>
>     GENDER_CHOICES      =   (
>         (True, 'Masculine'),
>         (False,'Feminine'),
>         (None, 'Neuter'),
>     )
>     gender              =   models.BooleanField(blank=True, null=True,
> choices=GENDER_CHOICES)
>     gender_stats        =   models.ForeignKey(
>                                 Stat,
>                                 default=Stat(),
>                                 related_name='gender_stats',
>                             )
>
>     plurality           =   models.CharField(max_length='50',)
>
> class Verb(models.Model):
>     word                =   models.CharField(max_length='50',
> unique=True)
>
>     definition          =   models.CharField(max_length='100',)
>     definition_stats    =   models.ForeignKey(Stat, default=Stat(),)
>
>     irregular           =   models.BooleanField()
>
> Thanks,
> Luke
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Foreign Key with a default key

2008-11-13 Thread Luke Seelenbinder

I'm am trying to make a ForeignKey with a default value.
But when I save i get a "invalid literal for int() with base 10: 'Stat
object'" error
Here is my code:

from django.db import models

class Stat(models.Model):
total   =   models.IntegerField(default=0)
right   =   models.IntegerField(default=0)
wrong   =   models.IntegerField(default=0)

def percent_right(self):
return (float(right) / total) * 100

class Noun(models.Model):

word=   models.CharField(max_length='50',
unique=True)

definition  =   models.CharField(max_length='100',
default=Stat())

definition_stats=   models.ForeignKey(Stat, default=Stat(),)

GENDER_CHOICES  =   (
(True, 'Masculine'),
(False,'Feminine'),
(None, 'Neuter'),
)
gender  =   models.BooleanField(blank=True, null=True,
choices=GENDER_CHOICES)
gender_stats=   models.ForeignKey(
Stat,
default=Stat(),
related_name='gender_stats',
)

plurality   =   models.CharField(max_length='50',)

class Verb(models.Model):
word=   models.CharField(max_length='50',
unique=True)

definition  =   models.CharField(max_length='100',)
definition_stats=   models.ForeignKey(Stat, default=Stat(),)

irregular   =   models.BooleanField()

Thanks,
Luke
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Create field from two others

2008-07-04 Thread Luke Seelenbinder
Thanks, for the reply I have since defined a function to handle this.

On Thu, Jul 3, 2008 at 11:35 PM, James Bennett <[EMAIL PROTECTED]>
wrote:

>
> On Thu, Jul 3, 2008 at 8:59 PM, lukeqsee <[EMAIL PROTECTED]> wrote:
> >
> > Can you take a first_name & a last_name field and then in the same
> > model make a field that is full_name? ie
> > first_name = models.CharField(max_length=75)
> > last_name = models.CharField(max_length=75)
> > full_name = models.CharField(value=first_name + last_name,
> > max_length=100)
>
> Not like this, no, but you seem to be hung up on trying to use field
> classes for everything. This is not necessary (and in this case would
> be a bad idea: you'd have duplicated data and you'd need to constantly
> watch out to prevent the fields getting out of sync with each other),
> because you can define perfectly normal Python attributes and methods
> on your models.
>
> Most likely you want to use a property with both a getter and a
> setter, as shown in the examples in the documentation:
>
> http://www.djangoproject.com/documentation/models/properties/
>
>
>
> --
> "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
-~--~~~~--~~--~--~---