Re: Django Tutorial #5 Testing: return Poll.objects.filter( SyntaxError: 'return' outside function

2014-09-16 Thread Andy McKay
You've got a syntax error in your code, likely wherever you have
"return Poll.objects.filter(" in your code.

"Outside a function" likely means that you have not correctly indented
your code, for example if your return has no indentation. Whitespace
in Python is significant and is part of the syntax.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOjXX8bs%2BJqNcGbpFpDOgxg8KnTy0R-x5%2BR2UXTQr36eRg7JBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: memcached and redis

2014-03-01 Thread Andy McKay
On Sat, Mar 1, 2014 at 12:39 PM, Andreas Kuhne
wrote:

> The main difference is that you can use redis as a session cache for
> django (save the session objects to memory instead of the database), which
> I haven't found a solution for memcache yet.
>

Memcache works just fine as a session backend:

https://docs.djangoproject.com/en/dev/topics/http/sessions/#using-cached-sessions

Andy

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOjXX8aCOZXQcVkb%3Dfk%2BcJtgphAJdY%2BrUAC7aDVnMEDWFq2Vgg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Vancouver Python Day - Tickets on sale Friday

2013-10-23 Thread Andy McKay
We're pleased to announce that tickets for Vancouver Python Day will be
released on Friday, October 25 at 10AM. You can purchase tickets at
http://vanpyday.eventbrite.com/

Space is extremely limited, so we advise buying your tickets as early as
possible if you plan to attend. Thanks to our generous sponsors, tickets
will be priced very affordably.

We've also just released the list of scheduled talks. Visit
http://www.vanpyday.com/ to view the list of speakers, and to learn more
about the event.

Finally, we're really happy to announce that A Thinking Ape, OpenRoad
Communications, and Mobify have stepped up to sponsor this event. Vancouver
Python Day would not be possible without their support.

Hope to see you at the conference!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOjXX8bBQgBcfnT75muG8ja0FJMvOfTNEpUkUzaCGWtrrnhEmQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django Software Foundation minutes

2013-10-14 Thread Andy McKay
Just wanted to make people aware that each month the board of the Django
Software Foundation meets. The minutes of each meeting are published here:

https://www.djangoproject.com/foundation/records/

If there's anything you'd like discussed at the next board meeting, please
contact us at:

https://www.djangoproject.com/contact/foundation/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOjXX8YiyMUT5ROusPPJNW%2BWpMZ7YFuNRZ30ccBH6WRNYz8rvw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Vancouver Python Day - Talk Proposal Deadline

2013-10-14 Thread Andy McKay
Hi Djangonauts!

We've just set the deadline for Vancouver Python Day talk proposal
submissions. All talk proposals must be submitted by *Thursday, October 17,
2013 at 23:59 Pacific Time*. See
https://github.com/andymckay/vancouver-python-day for instructions on
submitting a talk proposal. All Python-related topics are welcome --
including Django!

In case you haven't heard, *Vancouver Python Day* is a one-day mini
conference celebrating the Python Developer Community in Vancouver. It will
be held on *Saturday, November 16, 2013* at SFU Harbour Centre. Stay tuned
for another announcement soon regarding ticket availability. In the
meantime, mark your calendar!

Andy

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOjXX8a10jJiwLctOrGSOwCzNZWPN6gNe-%2BFK34tw2d2dkSvWA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Vancouver Python Day

2013-09-30 Thread Andy McKay
The Vancouver Python User Group and the Vancouver Django Meetup Group are
pleased to announce:

Vancouver Python Day
Saturday, November 16, 2013
SFU Harbour Centre

Part of Vancouver Developer Week 2013, Vancouver Python Day is a one-day
mini conference celebrating the Python Developer Community in Vancouver.

We hope to have talks covering a wide variety of Python development, from
web development to gaming to performance and optimization. To that end,
we're currently seeking talk proposals. Please visit
https://github.com/andymckay/vancouver-python-day and submit your proposal
today.

Tickets will be offered for a nominal fee; we'll be sending another
announcement before tickets go on sale. In the meantime, please mark your
calendars!

More information on Vancouver Python Day:
http://www.vanpyday.com/

More information on Vancouver Developer Week:
http://vancouver.devweek.org/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOjXX8byc%2BVWV6Eu3m_f6ZykPdnF%3Dd7mra4BJkUjdhSy9CDX1g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Passing variables to css file in django

2013-08-25 Thread Andy McKay
Any string can be rendered as a template. This is covered pretty well in
the docs:

https://docs.djangoproject.com/en/dev/ref/templates/api/

For example:

>>> from django.template import Context, Template
>>> t = Template("body { background-color: {{ bgcolor }} }")
>>> c = Context({'bgcolor': '#999'})
>>> t.render(context=c)
u'body { background-color: #999 }'

However, CSS is served fastest if it's static and on a CDN and not using a
template and CPU resources to render.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Friendship model

2013-08-08 Thread Andy McKay
On Thu, Aug 8, 2013 at 12:41 PM, Robin Lery  wrote:

> How do i create a Friendship model? Please guide me.
>

You would need to provide more detail to get much help. The tutorial covers
how to make models:

https://docs.djangoproject.com/en/dev/intro/tutorial01/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how do I run a django script from command line or Pycharm?

2013-03-12 Thread Andy McKay
On Tue, Mar 12, 2013 at 5:42 PM, frocco  wrote:
> I want to run the code below in a file called migration.py

django-extensions will do this for you, if you create a run method.

http://blog.brendel.com/2012/01/how-to-use-djangextensions-runscript.html

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




Re: Benchmarking and timing DB transactions in Django

2013-03-03 Thread Andy McKay

On Feb 22, 2013, at 3:18 AM, R R  wrote:
> I was wondering if there are any tools to benchmark DB transactions using the 
> Django ORM. I'm using PostGreSQL with Django 1.4. I'm required to compare and 
> come up with the best possible database design for a project which will have 
> millions of records when it's deployed.

If nothing else use Django debug toolbar to time your pages and get debug 
information:

https://github.com/django-debug-toolbar/django-debug-toolbar

> I'd love to hear your workflow or suggestions. Also I haven't seen many 
> articles that focus on developing high-performance webapps in Django. May be 
> it's the problem with me. so if you know of any good articles which would 
> help me, kindly share it too.

I've given some talks on Mozilla sites here (e.g. OSCON 2012):

http://andymckay.github.com/presentations/

I find django statsd extremely useful for performance tuning:

https://django-statsd.readthedocs.org/en/latest/#usage

And don't forget to use all your standard database tools (e.g. slow query log).

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




Re: Can a method call inside save() display its return on template?

2012-07-20 Thread Andy McKay
>   cursor.execute("SELECT
> GetDirectionDescr("+str(nod_id1)+","+str(nod_id2)+") from sys.dual")

Please note that code means that you might be open to SQL injection.
You should be using the parameters for SQL, see:

https://docs.djangoproject.com/en/dev/topics/db/sql/#passing-parameters-into-raw

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

2012-07-05 Thread Andy McKay
> Thanks Andy. Super cool, and pretty much just what I was looking for.
> Seems to work fine in FF and Chrome, but in Safari I don't seem to
> have access to the performance.timing data. Should that be there or do
> I have do something to load or enable it?

Sadly, Safari does not support this :( You'd have to try and fake
this. Boomerang does this.

https://github.com/yahoo/boomerang

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

2012-07-05 Thread Andy McKay
> I'm trying to use the Navigation Timing package to measure how long a
> page takes to be rendered.

So you don't want to include all the lookups? Just the "rendering" part?

> So that would be loadEventEnd-responseEnd,
> however I am finding that loadEventEnd is always 0 for me, even though
> I am accessing it from within a window.onload function, e.g:
>
> window.onload = function() {
> var t = performance.timing;
> var render_time = parseInt(t['loadEventEnd']) - 
> parseInt(t['responseEnd']);
> }
>
> What do I have to wait for before loadEventEnd gets set?

Stupid question, but when does the onload event occur, before or after
loadEventEnd? Running it in a console as I type this email, it gives
me a non-zero value.

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

2012-06-25 Thread Andy McKay
> Now they want me to add to that how long
> the browser takes to render the page after it gets the data.

You can use the navigation timing API:

https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html

We use this in conjuction with graphite and django-statsd to produce
graphs of hour long our sites takes to render.

http://blog.mozilla.org/webdev/2012/01/06/timing-amo-user-experience/

And some more links:

https://github.com/andymckay/django-statsd
http://django-statsd.readthedocs.org/en/latest/#front-end-timing-integration
http://graphite.wikidot.com/

Cheers.

-- 
You received this message because you are subscribed to the Google 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: Off-line Django apps / Caching and synchronizing data

2012-05-24 Thread Andy McKay
> Somehow create a standalone django app that is the same as the online one
> and then have it synchronize when it goes back online. Something ala Google
> Gears / HTML5. But not done anything like this and I'm not sure how
> complicated the synchronizing would be and I'm reluctant to roll out django
> installations on loads of laptops.

If you have a JS based HTML 5 app, you could store data into IndexedDB
and then sync it all up when they come back online. From an end users
point of view it could be pretty seamless as they switch from online
to offline.

This would not require Django being installed, just using HTML5.

> Use a non-django app which might be a bit lighter, eg MS Access or some
> sqlite front end and then have that synchronize. Again, similar issues as
> above, although.

You'll likely have syncing issues whatever system you use. Choose your
pain point and remove as many syncing/conflict issues as you can
before you start implementing.

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



Re: Different urls.py file for different apps

2012-05-22 Thread Andy McKay
Use include to pull in values from other apps inside your urls.py

https://docs.djangoproject.com/en/dev/topics/http/urls/#including-other-urlconfs

On Tue, May 22, 2012 at 11:49 AM, siddharth56660
 wrote:
> Hi,
> I am developing an ERP system which is vast and covers many modules.
> After developing each module i create another app for second module
> by
> " django-admin.py startapp myapp2 "
> This is perfectly working fine.
> But my urls.py is growing very fast and has crossed more than 5000
> lines with lot more to come.
>
> Is there any other way in which i can make different urls.py as per my
> apps.
> I tried googling around but i dint find any way to give multiple apps
> in setting.py file in ROOT_URLCONF entry.
>
> Please help me around.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: How do you write a django model that can crunch numbers and automatically populate another field with results?

2012-05-08 Thread Andy McKay
You can hook into the model signal so that when the model changes, you
do you calculation and change your models.

https://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.signals.post_save

-- 
You received this message because you are subscribed to the Google 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 - Worldwide Developer Rates - Hourly Income - location and project duration specific

2012-05-05 Thread Andy McKay
> A plumber is mostly manual labor which will take a toll on the body over the
> years.

Programming too takes its toll on the body over time (make sure you
have a nice ergonomic setup). The relentless march of technology means
that the length of a programmers career is shorter than many jobs,
including plumbing.

> A plumber also has travel costs, fuel, cost in lost time travelling,
> covering free quotations etc.

Consultants have travel costs, fuel and lost time in travelling too.
Unless you never meet clients. Consultants have to provide free
quotations too. There are the same costs for any independent business
person.

> I've seen quite a few people making these comparisons to manual labor jobs
> and, in my opinion, they are completely irrelevant.

There are fixed and variable costs in any profession. I'm not sure of
the point of any comparison.

-- 
You received this message because you are subscribed to the Google 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: restarting a django development server

2012-04-23 Thread Andy McKay
Change your code so you don't have to. Relying on a restart for that
is the wrong approach.

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

2012-04-16 Thread Andy McKay
Run django debug toolbar, see what queries you are running and how
long they take and that you've got database indexes set up.

Failing that, run a middleware or other logging tool to tell you slow
pages. Then test with django debug toolbar. Rinse and repeat.

-- 
You received this message because you are subscribed to the Google 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: Problems extracting valid form data lately

2012-04-15 Thread Andy McKay
What does your form code look like?

-- 
You received this message because you are subscribed to the Google 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: mocking out a Model

2012-04-14 Thread Andy McKay
> @patch('apps.market.models.House')

Is create house in apps.market.models, or is it somewhere else? If
it's somewhere else, mock it relative to that file eg:
@patch('apps.some_file.House')

> I'm also wondering if it's possible to inspect MockedHouse to see if it has 
> for example some tags added to it.

Yep stick a pdb statement after create house.

-- 
You received this message because you are subscribed to the Google 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: PythonScript(Zope) like in a django app, any tips?

2012-04-14 Thread Andy McKay
I would not recommend allowing untrusted users to execute random python on
your server in any way.

The only sandbox ive seen that is well protected is app engine, if you are
hosting your site on app engine, things might be a bit better.

I would recommend sending webhooks or callbacks to users own servers and
excuting them there.
On Apr 14, 2012 11:43 AM, "Arruda" <felipe.arruda.pon...@gmail.com> wrote:

> Is this what you're talking about?
> https://developers.google.com/appengine/docs/python/overview
> Still don't understand how this would be used.
>
> Em sábado, 14 de abril de 2012 14h19min01s UTC-3, Andy McKay escreveu:
>>
>> That's not something I'd ever recommend an untrusted user do. There
>> are still many ways that could go wrong. The safest execution
>> environment I've seen for Python is App Engine, send a callback to
>> that instead :)
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/fUxBYWsIr4MJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: PythonScript(Zope) like in a django app, any tips?

2012-04-14 Thread Andy McKay
That's not something I'd ever recommend an untrusted user do. There
are still many ways that could go wrong. The safest execution
environment I've seen for Python is App Engine, send a callback to
that instead :)

-- 
You received this message because you are subscribed to the Google 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 add audio to a Django based webpage?

2012-04-04 Thread Andy McKay
On Wed, Apr 4, 2012 at 12:50 PM, Homer  wrote:

> Should I add something else so that it would work? Thanks for your help!

There's nothing I've seen yet that's a Django problem. Does the
outputted HTML look right? Does that work? If not tell us and we'll
see if we can help you figure out how your Django templating isn't
outputting the right value.

I'll also recommend the HTML audio tag.

-- 
You received this message because you are subscribed to the Google 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: Sorting the output of regroup

2012-03-10 Thread Andy McKay
> Any idea what is the best way to accomplish this?

Sort the list in Python in your view. Its easier to do, easier to test
and easier to maintain.

-- 
You received this message because you are subscribed to the Google 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: Question on unknown error

2012-02-26 Thread Andy McKay
You can return whatever you want. All depends how you are using the result.

On Sun, Feb 26, 2012 at 5:48 PM, Stanwin Siow  wrote:
> It's ok guys!
>
>
> I figured out the error.
>
> At the end of the method we were returning 0 and 1 that will throw the
> error.
>
> Is there some rule in django that we are not supposed to return integers?
>
>
> Best Regards,
>
> Stanwin Siow
>
>
>
> On Feb 27, 2012, at 5:38 AM, Mario Gudelj wrote:
>
> In print 'time' what's time? Should you not have print exp_datetime?
>
> On 27 February 2012 01:27, Stanwin Siow  wrote:
>>
>> Hello,
>>
>> I have the following method:
>>
>> def subscribe_keyword(userid,subDay =7,KEYWORD_SET=frozenset()):
>>     try:
>> ...
>>
>>         sub_datetime = datetime.datetime.now()
>>         exp_datetime = sub_datetime + timedelta(days=subDay)
>> print 'time'
>>
>> However when i try to run my app,
>>
>> The following error throws at those two lines.
>>
>> Err: sequence item 0: expected string, int found
>>
>> Is there something wrong with the module?
>>
>>
>>
>>
>>
>> Best Regards,
>>
>> Stanwin Siow
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

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



Re: Question on unknown error

2012-02-26 Thread Andy McKay
Please give us the full traceback and exact line of code it occurred
on. There isn't enough information right now.

On Sun, Feb 26, 2012 at 1:38 PM, Mario Gudelj  wrote:
> In print 'time' what's time? Should you not have print exp_datetime?
>
>
> On 27 February 2012 01:27, Stanwin Siow  wrote:
>>
>> Hello,
>>
>> I have the following method:
>>
>> def subscribe_keyword(userid,subDay =7,KEYWORD_SET=frozenset()):
>>     try:
>> ...
>>
>>         sub_datetime = datetime.datetime.now()
>>         exp_datetime = sub_datetime + timedelta(days=subDay)
>> print 'time'
>>
>> However when i try to run my app,
>>
>> The following error throws at those two lines.
>>
>> Err: sequence item 0: expected string, int found
>>
>> Is there something wrong with the module?
>>
>>
>>
>>
>>
>> Best Regards,
>>
>> Stanwin Siow
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google 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: User .get_all_permissions() vs. .has_perm() inconsistency

2012-02-10 Thread Andy McKay
On Fri, Feb 10, 2012 at 4:01 PM, dslowik  wrote:
 u.get_all_permissions()
> set([u'wb.delete_libraryitem', u'wb.change_libraryitem'])
 u.has_perm("wb.change_libraryitem")
> True
>
> ...Shouldn't that be False?

Why would it be False? get_all_permissions: Returns a set of
permission strings that the user has has_perm: Returns True if the
user has the specified permission.

https://docs.djangoproject.com/en/1.2/topics/auth/#django.contrib.auth.models.User.get_all_permissions

-- 
You received this message because you are subscribed to the Google 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: Speficy a Database for Testing

2012-02-08 Thread Andy McKay
You can define a custom test runner to do this. For example:

https://docs.djangoproject.com/en/dev/topics/testing/#django.test.simple.DjangoTestSuiteRunner.setup_databases

On Wed, Feb 8, 2012 at 7:42 AM, xina towner  wrote:
> Yes, but django makes a new testDatabase and that's my problem, I want
> django to use a database I've previously done.

-- 
You received this message because you are subscribed to the Google 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: Dynamic settings variables (dynamic global variable)

2012-02-08 Thread Andy McKay
You can define multiple caches:

https://docs.djangoproject.com/en/1.3/topics/cache/#django-s-cache-framework

You could then use a file system cache or your own local memcache.

https://docs.djangoproject.com/en/1.3/topics/cache/#filesystem-caching

You can then get that cache and access it in your code:

from django.core.cache import get_cache
cache = get_cache('my-filesystem-cache-defined-in-settings')

On Wed, Feb 8, 2012 at 3:29 PM, bfrederi  wrote:
> I'm already using memcached over http so I can have multiple memcached
> instances. But there isn't any way to set priority or which cache the
> item goes to or is pulled from. So if I had a local memcached
> instance, there's no way I could be sure which memcached instance the
> data was coming from. I already store the data on disk as a back-up in
> case the connection to my memcached servers fails. But I'm really
> looking to store it in local memory. And hopefully without adding any
> other tools to my stack.

-- 
You received this message because you are subscribed to the Google 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 (and Python) speakers

2012-02-08 Thread Andy McKay
> The Django crowd seems to prefer PostgreSQL collectively, but I know
> there are a million sites out there using MySQL, so that would
> probably resonate with people. Sort of the "frank Wiles of the mySQL
> world"?

+1 on good MySQL speakers, whilst its not preferred by many, its very
under represented.

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

2012-02-06 Thread Andy McKay
On Mon, Feb 6, 2012 at 9:04 AM, xina towner  wrote:
> How can I  check the template of a view??
..
>         self.assertTemplateUsed(resp, 'name_of_the_template', 'Bad
> Template')

Yes, the docs on assertTemplateUsed are at:

https://docs.djangoproject.com/en/dev/topics/testing/#django.test.TestCase.assertTemplateUsed

-- 
You received this message because you are subscribed to the Google 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: reverse() with keyword argument driving me batty

2012-01-12 Thread Andy McKay
On Thu, Jan 12, 2012 at 9:50 AM, John DeRosa  wrote:
>       url(r'^results/text/(?P)/$', 'textresults', 
> name='exporttextresults')

One guess, you haven't specified what the (?P in your regex accepts.
For example:
(?P\w+)

-- 
You received this message because you are subscribed to the Google 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 current session user in models.py?

2012-01-03 Thread Andy McKay
On Mon, Jan 2, 2012 at 12:25 PM, Waldek Herka
wrote:

> c) local threading way posted by you is not as straight
> forward as it looks - I'd say it's very similar in complexity to
> mine.. you still need to explicitly call 'activate' somewhere(view
> method)


Middleware can do that just fine.

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



Re: How to get current session user in models.py?

2012-01-02 Thread Andy McKay
Inspecting your stack to find the user seems a pretty convoluted way to do
it.

You could either a) not access users in your models b) explicitly pass the
user around or c) just place your user into a local threading and retrieve
it anywhere else for example:
https://github.com/andymckay/arecibo/blob/master/listener/lib/userstorage/utils.pyor
any other methods for doing that.

-- 
You received this message because you are subscribed to the Google 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:Field available via Django shell but not via web application (crossposted from StackOverFlow)

2011-11-01 Thread Andy McKay
Is this using the Django built in runserver or some other way of serving
pages? If not try using runserver.

-- 
You received this message because you are subscribed to the Google 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: Signals and listeners defined in a separate modules unusable in other apps

2011-10-09 Thread Andy McKay

On 2011-10-08, at 6:59 AM, Guruprasad L wrote:
> When the signals.py and listeners.py are in the same app in which the view 
> function triggers the signal, things are working fine. What could be the 
> issue here and how to work around it?

Most likely your signals and listeners aren't being imported. Stick a print 
statement in the module to confirm this is the case. If so, import them.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: Question about Signals and Bootstrap

2011-10-09 Thread Andy McKay

On 2011-10-08, at 7:36 AM, Santiago Basulto wrote:
> Where can i find some doc that explains how Django is bootstraped and
> loaded. I'm looking for this becouse while i was reading the "Signals"
> chapter at django docs, i read that "In some circumstances, the module
> in which you are connecting signals may be imported multiple times."
> This looks weird, and it's confusing me. So, before asking "where
> should i put my signals code not to duplicate it?" i ask for the
> django workflow.

There is no real guarantee on your import order. So relax, don't worry about 
it. Instead give each signal a unique dispatch_uid:

https://docs.djangoproject.com/en/dev/topics/signals/#preventing-duplicate-signals

This makes disconnecting signals easier as well.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

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

2011-10-09 Thread Andy McKay

On 2011-10-08, at 12:50 PM, Ian wrote:
> This is easy to do with PayPal's Adaptive Payments, and I've done it
> with PHP, but I'm trying to get it working on Django.  Any advice?

That's more a PayPal question than a Django one. But at Mozilla we use 
adapative payments with Django. Our codebase is rather big so might be hard to 
follow, but the key PayPal stuff is here:

https://github.com/jbalogh/zamboni/blob/master/apps/paypal/__init__.py

It doesn't answer your question, but gives you something to look at ;)

Cheers.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: Create socket server in django

2011-09-19 Thread Andy McKay
You could write a Python process that starts up a Socket Server and imports
all the Django stuff, just like the current server does for HTTP. Then
there's no need to "send the data to django". Might help:

http://docs.python.org/library/socketserver.html

On Mon, Sep 19, 2011 at 2:00 PM, Micke  wrote:

> Hi,
> Im new to Django and need some help in the right direction.
>
> I will create a socket server, that should recive raw udp data and put
> it in a database. After that Django should present the data in a
> customized view.
>
> Is it possible to create the server in Django, like in the views file,
> so it starts up when django starts? So I can use the in data and use
> orm to put it in db. Or do I need to do a separate server, that sends
> data to django after it recieves it?
>
>
> Thanks
> Mikael
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Can I write tests for 3rd party url shortener?

2011-09-02 Thread Andy McKay

On 2011-09-02, at 4:58 AM, Yaşar Arabacı wrote:
> 
> Is there a way to test whether or not a 3rd party url shortener works. What I 
> have in mind is this:

Sure, python has libraries like urllib for dong that sort of thing.

http://docs.python.org/library/urllib.html

--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

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

2011-09-02 Thread Andy McKay
On 2011-09-02, at 5:22 PM, Mo Mughrabi wrote:
> The problem with my approach that the xml is not validated and the reading 
> operation can be exhausting to parse the xml every time.

Why are you parsing through the XML every time? That seems awfully inefficient. 
There are xml parsers that don't involve parsing the entire tree, as far as I 
remember: http://docs.python.org/library/markup.html

But I would take the XML and store the bits you need in a more efficient format.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

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



Re: can django be used in destop application?

2011-08-23 Thread Andy McKay

On 2011-08-23, at 4:17 AM, smith jack wrote:

> i mean not use django for web site development, but for desktop application,
> it seems its orm can be used in destop application, isn't it?

Yes.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: message mark_safe and redirect results in message still showiing with encoded tags

2011-08-23 Thread Andy McKay

On 2011-08-23, at 1:08 AM, Leon van der Ree wrote:
> that explains why I experience this issue. However doesn't it suppose
> to work like this; Why should a safe string become unsafe again after
> deserialisation? I understand this is a current limitation of the
> serialisation process, but this is not exactly what you would expect,
> is it. So in my eyes this is still a bug.

Nothing advertises it would work this way, so its a feature request.

> Are there any known workarounds?

You could store more than a string in the message I bet, for example 
{'msg':'hello', 'safe':True} and then cope with it when you deserialize.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

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



Re: models.URLField does not validate a valid url

2011-08-22 Thread Andy McKay

On 2011-08-22, at 5:59 AM, Burcu Hamamcıoğlu wrote:

> Hi all, I 've a strange issue with URLField. It does not validate 
> "http://www.babacanyapi.com; and "ttp://www.crowntowers.net". When ı use 
> these urls the browser does not open anything I think it troubles into  an 
> infinite loop.  
> Why django does not recognize these urls?

That's an IIS server.

A search of Django issues brings me to this:

https://code.djangoproject.com/ticket/14955

"I've found a variety of IIS servers running ASP.NET that are responding with 
403 errors or simply timing out on HEAD requests"

Sounds like similar is happening here.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: message mark_safe and redirect results in message still showiing with encoded tags

2011-08-22 Thread Andy McKay
> However, it seems that the redirect removes the safe_marking around my
> message! since the result I get in my browser is html-encoded!

It won't work that way, safe string alters the class not the contents of the 
string [1]. The message module turns the string into JSON and stores it. Then 
when read it does the reverse turning it back into a string.

You'll have either to alter that behaviour or find another way around.

[1] 
https://code.djangoproject.com/browser/django/trunk/django/utils/safestring.py#L89
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: anybody using PhoneGap with Django

2011-07-07 Thread Andy McKay

On 2011-07-07, at 2:22 PM, John Fabiani wrote:
> I'm wondering if anyone has had any success with PhoneGap and Django?

Yes.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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 use the django-users mailing list properly and doing your homework..

2011-07-06 Thread Andy McKay

On 2011-07-06, at 3:55 PM, Andre Terra wrote:
> This is precisely the problem, imo. IRC is too outdated, and the folks

IRC may be outdated yet it persists as a completely awesome chat tool used by 
tons of developers every day. No disrespect to Convore or Stack Overflow, but 
one day when they are longer around - IRC will still be there :)

The #django IRC channel and all the other channels for all the other projects 
(celery, gevent, postgres, mysql etc) can be great. I'd recommend them as a 
great help channel to everyone.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

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

2011-06-21 Thread Andy McKay

On 2011-06-20, at 12:52 PM, Nan wrote:

> I'm not testing the third-party service.  I need to test *what I send
> to them*. 

Use Mock and assert_called_with:

http://www.voidspace.org.uk/python/mock/mock.html#mock.Mock.assert_called_with

In this case you'd set theAPI.call as your mock and check that under different 
conditions it is called correctly.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: Open source Django websites

2011-06-21 Thread Andy McKay
All the Mozilla sites are open source. Start with the presentation I gave at 
djangocon.eu here: 

https://github.com/andymckay/presentations/tree/master/djangoconeu-2011

On 2011-06-20, at 4:42 AM, benregn wrote:

> Thank you very much. I was not aware of that site.
> 
> On Jun 20, 12:48 pm, Kenneth Gonsalves <law...@thenilgiris.com> wrote:
>> On Mon, 2011-06-20 at 00:11 -0700, benregn wrote:
>>> I was wondering if there are any complete websites using Django that
>>> are open source, i.e. it's possible to browse all its files, structure
>>> and code.
>> 
>> http://www.djangosites.org/with-source/
>> --
>> regards
>> KGhttp://lawgon.livejournal.com
>> Coimbatore LUG roxhttp://ilugcbe.techstud.org/
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: Synchronize method or model field access

2011-05-25 Thread Andy McKay

On 2011-05-25, at 3:22 PM, Pawel R wrote:

>> I would push the atomic updates to the database or use a queue with a single 
>> worker.  Thread level locking doesn't scale across processes or servers.
> 
> Could you tell me please how?

Celery provides a queue you could use:

http://ask.github.com/celery/getting-started/introduction.html
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

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

2011-05-25 Thread Andy McKay
On 2011-05-25, at 7:58 PM, Alexandra wrote:
> Has anyone seen this before? My urls.py seem to be configured properly

Without knowing the relevant line in urls.py, its hard to guess, but one would 
be that phone.adder.username is an empty string, as noted here: 

> Caught NoReverseMatch while rendering: Reverse for 'profile_detail'
> with arguments '('',)' and keyword arguments '{}' not found.

Hence it can't find the matching url.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: Inverted checkbox value in modelForm field for BooleanField?

2011-05-14 Thread Andy McKay

On 2011-05-14, at 6:08 PM, br wrote:
> However, come interface tweaking time (now), we decided we want to
> display a page with a check box "Auto Cycle?" instead of "click-
> through", so I basically need to invert the actual value with respect
> to this interface .
> What is the easiest way to implement this?

You can access the field and initial data inside the form init and do anything 
you want there. Which depends upon how you are calling your Model form. If you 
are passing through an instance, for example, you could tweak it:

class MyForm(ModelForm):
  def __init__(self, *args, **kw):
kw['instance'].click_through = True
super(MyForm, self).__init__()

--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: [help]django's FloatField can't insert the mysql's double type data.

2011-05-14 Thread Andy McKay

On 2011-05-14, at 6:10 PM, Korobase wrote:
> price=models.FloatField(default=0.0)

You really should really be using a DecimalField for storing prices, not a 
FloatField.

http://docs.djangoproject.com/en/dev/ref/models/fields/#decimalfield
http://docs.djangoproject.com/en/dev/ref/models/fields/#floatfield

Not sure off the top of my head why you get that error though.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: [help]django's FloatField can't insert the mysql's double type data.

2011-05-14 Thread Andy McKay

> Exception Type: TypeError at /admin/main/learndjango/add/
> Exception Value: 'float' object is not callable


Please paste your model that is having the problem.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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] Error (EXTERNAL IP): /add_comment/10/

2011-05-07 Thread Andy McKay

On 2011-05-04, at 4:44 AM, Aragorn wrote:
> File "/home/max/public_html/examplesite.com/django/dbe/blog/
> models.py", line 44, in save
>   self.body)

You told us lots of stuff, including the save method, but since we don't know 
line numbers, which one is line 44?

> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position
> 41: ordinal not in range(128)

There's some helpful information on this error from Google, here's one of them:

http://wiki.python.org/moin/UnicodeDecodeError
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

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

2011-05-07 Thread Andy McKay

On 2011-05-05, at 9:36 PM, Phui-Hock wrote:

> On May 6, 4:22 am, Shawn Milochik <sh...@milochik.com> wrote:
>> This is a bad idea for multiple reasons. Don't do it.
> 
> Huh, care to explain, please?

Because it means you are storing passwords in plain text. There are multiple 
posts on the internet about this. Here's a couple:

http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database
http://www.codinghorror.com/blog/2007/09/youre-probably-storing-passwords-incorrectly.html

--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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 administration page, created a Site -- now what?

2011-05-06 Thread Andy McKay
On 2011-05-06, at 5:25 PM, Boštjan Mejak wrote:
> I have created a new Site in my "Django administration" page. How can I use 
> it now? If I visit the URL that this newly created Site points to, I get a 
> URLconf error. So what do I need to add to my project's urls.py file? A 
> newbie here. Please help me on this. Thanks.


A site object really doesn't do a whole lot apart from a way to connect 
functionality in your application to a domain, so I'm not sure what you are 
expecting. They are well documented here:

http://docs.djangoproject.com/en/dev/ref/contrib/sites/?from=olddocs

The tutorial is a good place to start:

http://docs.djangoproject.com/en/dev/intro/tutorial01/
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: Help! Database is locked! Windows developing envrionment, sqlite3, djcelery and djkombu

2011-05-06 Thread Andy McKay

On 2011-05-06, at 7:01 PM, Robert Ray wrote:

> I''im using Django 1.3 with Djcelery and Djkombu on Windows7. When I'm

> Can anyone give me any help? Thanks in advance!


You are using sqlite? Don't use that, use postgresql instead.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: selecting all columns from a table (advanced query)

2011-05-05 Thread Andy McKay
> anyone can help show columns from list and listi18n? I tried extra but It 
> doesn't allow me to pass things like category_list.* 


You retrieve and populate data from one model in django, no more than that. 
Select related allows you to avoid lookups on objects related to the initial 
model.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: Hidden rows elements also visible on list filters

2011-05-04 Thread Andy McKay
> problem is that few rows i have disabled.
> But list filter still displays those rows as well.

Are you using the built in django admin, or something else?
By "disabled" what do you mean, a change in the model or something else?

Until you give us a bit more information, we are unlikely to be able to help. 
But here's a bet:  

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter

The example for DecadeBornListFilter shows how you can define a custom queryset 
and perhaps this will allow you to filter out disabled rows.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: removing the source of a OneToOneField relationship

2011-05-03 Thread Andy McKay

On 2011-05-03, at 2:05 PM, Seth Gordon wrote:
> I get an exception, complaining that Target.source does not allow
> null values.

You'll probably want to allow null values on your OneToOne field then:

http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.Field.null
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: removing the source of a OneToOneField relationship

2011-05-03 Thread Andy McKay

On 2011-05-03, at 2:05 PM, Seth Gordon wrote:
> I get an exception, complaining that Target.source does not allow
> null values.

You'll probably want to allow null values on your OneToOne field then:

http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.Field.null
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: bound form with ModelChoiceField

2011-04-23 Thread Andy McKay
> what is the best way of do what I want to do?
> I don't think it will be store firstForm.data o request.POST in
> session it's a good idea, so, what are the other possibilities?

I would recommend taking a copy of the clean data, then run through and just 
change your ModelChoiceField back into the object ids.

new_dict = form.cleaned_data.copy()
new_dict['option'] = new_dict['option'].pk

Might work. You should then be able to cleanly store that in a session and 
repopulate forms with it again later.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: bound form with ModelChoiceField

2011-04-21 Thread Andy McKay

On 2011-04-21, at 4:07 PM, ekms wrote:
> So, what is the correct way to create a bound form of
> ModelChoiceField? I  could store request.POST or myform.data instead
> of myform.cleaned_data, but I don't know if this is right.

You are confusing me when you say a bound form of a ModelChoiceField. Since one 
is a form and one is a field. You can create a ModelForm given a Model and its 
instance or primary key as outlined here: 

http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#modelform
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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 auth.login() with multiple databases

2011-04-21 Thread Andy McKay

On 2011-04-21, at 6:30 PM, Lawrence wrote:

> 4. Add a custom login() method to my custom authentication backend?
> This sounds like an option I could undertake but I'm unsure of the
> syntax to select the appropriate database and perform all of the
> required login features like saving the User ID to the session, etc.

I would do this. Find some appropriate way of storing your database as a string 
and then do a lookup on get_user to use that. I wouldn't worry too much about 
what's there, just write something for your particular use case. 

Presumably you also have another user database where you can store data 
particular to you application such as session and profiles since your other 
databases sound immutable?
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: checkbox, how to return state back to html

2011-02-03 Thread Andy McKay

On 2011-02-03, at 4:46 AM, gintare wrote:
> 

You don't have " around cbSMWord so the full variable name is 'cbSMWord'.

>cbSMWord  = request.POST.get('cbSMWord ','')

You have a space on the end of the variable here. 'cbSMWord ' is not equal to 
'cbSMWord'

>   return render_to_response('c:/Python27/Scripts/Spokas/web.html',
> {'cbSMWord':cbSMWord}, context_instance = RequestContext(request) )

Also, you should not be specifying the full path to templates, let the template 
loader do that for you.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

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

2011-01-29 Thread Andy McKay

On 2011-01-29, at 5:25 AM, sami nathan wrote:
> now i want to change just message in my request.POST (denoted by red color in 
> above request) and i am helpless  i tried the following code  
> 
> def recive_ShortMessage(request):
> if request.method == 'POST':
>  request=request.POST.QueryDict.copy()
>  qt=request.QueryDict.copy()
>  print qt
>  qt['message'] = 'I am changing it!'
>  return HttpResponse(qt)

So presumably a) you'll want to parse the soap into some python datastructure 
then b) alter it and then c) serialise it back out as the new value. So you'll 
need to find a python SOAP library, suds might do it: 
https://fedorahosted.org/suds/

Please note that the HttpResponse takes a string, not a dictionary as you are 
trying to use. Documented here: 
http://docs.djangoproject.com/en/dev/ref/request-response/#httpresponse-objects
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: Word file Display and Save??

2011-01-29 Thread Andy McKay

On 2011-01-28, at 8:16 PM, nicolas lubkov wrote:

> Hello all, is there a way to display a word .doc in the user profile and let 
> the users edit it and save it to keep in their profile.??

You may add what ever you want to a user profile model and you can add files to 
models using a FileField.

http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

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



Re: "CSRF verification failed" when sending simple GET request using curl

2011-01-19 Thread Andy McKay
> What if I wanna expose my views as web services without providing a
> UI, how do I make sure clients (e.g. Ajax, actionscript, etc) can use
> it without this CSRF issue?

You can mark things as exempt if you'd like to and are aware of the 
implications:

http://docs.djangoproject.com/en/dev/ref/contrib/csrf/#exceptions
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
You received this message because you are subscribed to the Google 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: Anyone want to take over maintaining Instant Django?

2010-07-13 Thread Andy McKay

On 2010-07-13, at 7:37 AM, cjl wrote:

> I no longer have the time or interest to maintain my little project:
> 
> http://www.instantdjango.com

> I'll also give you my 'build' script, but it no longer works correctly
> because the Python core devs broke the Windows installer, and mocked
> me when I reported the bug.

Is the source for building it in some sort of source control eg: github?
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

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



Re: python logging and multiple process issue?

2010-07-12 Thread Andy McKay
Are you wanting to log errors that occur in your django site? If that's the 
case I'd recommend starting with simple tools like django's email logging and 
working up to more sophisticated tools like django-db-log or arecibo.

If you want to debug development code or you will find python's built in 
logging will be just fine for all but the most complicated of use cases. 

If you want to do access logging, your web server does that for you.
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Get pk before commit

2010-07-09 Thread Andy McKay
> I'd like to save the image file into a folder based on the ID of the
> new instance.

I wouldn't actually recommend saving your file with the filename being the 
primary key of your model anyway. It makes it a pain if you do database dumps 
or loads and need to keep the primary key in sync with your files. I would 
recommend making a UID field on your model (which also doesn't require a 
transaction) and using that for your filename.
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: News on every page

2010-07-08 Thread Andy McKay
On 2010-07-08, at 9:07 AM, Martin Tiršel wrote:
> 1.) Where is the right place to place news loader? 
> TEMPLATE_CONTEXT_PROCESSORS seems to be a good place and easy to implement. 
> Another possibility is a middleware, I feel, that it should go there instead 
> of TEMPLATE_CONTEXT_PROCESSORS.


Middleware is not the appropriate place, a context processor is the appropriate 
place.
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Parsing xml containing image - rawImage gif

2010-07-05 Thread Andy McKay
On 2010-07-05, at 8:09 AM, Bjørn Høj Jakobsen wrote:

> I have the following xml. how do I pass the image to a file.


This isn't really relevant to Django. 

There are libraries in Python for parsing XML, try using those: 
http://docs.python.org/modindex.html#cap-X

There are also SOAP libraries: http://www.google.ca/search?q=soap+python
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Signal emitted after successful login?

2010-06-29 Thread Andy McKay
On 2010-06-29, at 10:48 AM, tiemonster wrote:

> Is a signal emitted after a successful login? I need to hook a
> particular piece of code into that point in the application.


Not specifically, if you are using django.contrib.auth last_login is set by 
some scripts, eg the login django.contrib.auth.login. So you can listen to the 
save signals on that model.
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 logging

2010-06-23 Thread Andy McKay

On 2010-06-23, at 8:48 AM, thusjanthan wrote:
> I am creating a new django framework and figured django would come
> with its own logging feature. I found this one that Fraser wrote but
> is no longer in development (http://code.google.com/p/django-logging/
> wiki/Overview) Can anyone suggest me a django logging project to log
> debug/error messages at server level and as a bonus feature perhaps an
> email to admin if a critical error happens.

Give Arecibo a look. 

http://www.areciboapp.com/
http://www.areciboapp.com/docs/client/django.html
http://www.agmweb.ca/blog/andy/2268/

etc...

Cheers
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Weekly rss feed

2010-06-21 Thread Andy McKay

On 2010-06-21, at 5:48 PM, TheIvIaxx wrote:
> I was wondering how to create a weekly feed for django.  Lets say i
> have a table of objects that gets added to all week long.  I'd like to
> allow people to subscribe to a feed that would give a single update
> with all items that were added that week.  Since the client doesn't
> send anything about when it last checked for updates, it's hard to
> determine if the requesting client needs to be given an update or not.

A few points:

- RSS readers keep track of all the things that have been read and don't 
display duplicates, so I don't really see a need for doing this anyway

- You maybe want a script that runs once a week and produces a summary post of 
all the things entered that week, but that just gives you one item.

- Or you just do a query that specifies the time range, eg: filter and only 
show posts in the last seven days.
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

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



Re: Looking for a Django Developer

2010-05-21 Thread Andy McKay

On 2010-05-21, at 9:49 AM, Tom X. Tobin wrote:
> Job postings are perfectly relevant for django-users.  (Although
> follow-up replies to job postings should be handled via private email,
> and not on-list.)
> 
> By the way, djangogigs is not free; it costs $145 to post a job listing there.

http://djangozen.com/jobs is free
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 django version on developer machine

2010-05-11 Thread Andy McKay

On 2010-05-11, at 7:26 PM, james_027 wrote:
> While I have a number of django apps develop for Django 1.1 ... I also
> want to use Django 1.2 for my new project. How can I have multiple
> version of Django in my machine where my apps will be instructed
> either to use 1.1 or 1.2

You should look at using virtualenv to isolate your environment:

http://pypi.python.org/pypi/virtualenv
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Open source CMS (if based on Django better)

2010-05-07 Thread Andy McKay

On 2010-05-05, at 12:52 PM, Jonatan.mv wrote:

> What would be you recommended CMS?. Could you please give some reasons
> (pro and cons)?.


Just to confuse things, don't forget you can pretty much use any non-Django CMS 
as long as it can write to a relational database. All depends what you want to 
do.
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: multi-language capabilities of Django/Satchmo

2010-04-27 Thread Andy McKay
> I'm interested in finding out more about practical use of django's
> multi-language capabilities for international sites.  Do any of you
> have experience with this?  And can you point towards resources/apps
> etc. for utilizing these features?

This is for i18n of the interface: 
http://docs.djangoproject.com/en/dev/topics/i18n/

For content this is a great talk from djangoski: 
http://docs.google.com/fileview?id=0B29qXMz8reouYzJhMjhhZDMtOTQ5MC00NjY3LWIxM2EtY2U3ZmI2NzQzYjk3=en
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 django instances, one database?

2010-04-22 Thread Andy McKay

On 2010-04-22, at 9:52 AM, Tim Arnold wrote:

> hi,
> Until now I've been working on a single Freebsd server, hosting a
> couple of Django apps. Now we've bought another machine to provide
> load balancing and I'm wondering how to accomplish that.
> I guess the django code can be shared on the same drive, but the
> django instances running separately of course (apache/mod_python).
> 
> Is it possible to have two instances accessing the same database? How
> do you handle load-balancing?

Yes you can. There's lots of options, http://www.apsis.ch/pound/ is but one.
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Working for a startup.

2010-04-22 Thread Andy McKay

On 2010-04-21, at 10:40 PM, Joe Goldthwaite wrote:
>  The guy mentioned that they originally started with a
> different company using Ruby on Rails.  He said that after the other company
> got bogged down and wasn't making progress, he switched to the new company
> that we're considering.  He said that they got the project back on track and
> organized but ended up running into lots of problems with Rails.  They
> talked it over and decided to rewrite everything in .net.  Now he's happy
> with the progress and feels like .net is a superior platform and is allowing
> him to develop his program at a lower total cost.

So company X got into problems using rails, so they switched to .NET using 
company Y. And this is from a company referred to by company Y? 
That's not the most impartial conversation.

There's a lot of worrying about technology there - which can be relevant. But 
i've seen projects get bogged down in many different languages too, the skills 
of a company to produce are varied and include project management. 

There could be many, many reasons the Rails project didn't do too well and the 
.NET project is going better. And I bet few of them are to do with Rails.
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: DB Adapter for HTML5 Client Database Storage?

2010-04-07 Thread Andy McKay
Porting the Django ORM to Javascript would be great, but quite a lot of work. 
Go for it!

In the meantime I'm playing around (as noted in Daniels post) using the wrapper 
around lawnchair, which in turn stores stuff in the client side database if 
present, and to be honest that's enough for me ;)
--
  Andy McKay, @clearwind
  Django Consulting, Training and Support

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 execute erlang code ?

2010-03-11 Thread Andy McKay
On 2010-03-11, at 7:02 PM, nameless wrote:
> How can I execute erlang code through django views ?


A django view is just python, so ask yourself how you would execute erlang from 
python and the answer is you probably won't but you could be doing something 
like (first hit in Google for erland and python): 

http://code.activestate.com/recipes/534162-an-erlang-port-in-python/

or using the builtin popen functions:

http://docs.python.org/library/os.html#os.popen

--
  Andy McKay, @clearwind

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



Re: Strange difference between runserver and shell

2010-03-11 Thread Andy McKay
> def writer_stories(request, writer):
># Look up the writer (and raise a 404 if it can't be found).
>written=get_object_or_404(Writer, slug__iexact=writer)
>return list_detail.object_list(
>request,
>queryset=Entry.live.filter(writer=written),
>template_name='newssite/writer_archive.html',
>template_object_name='stories',


Presumably you've used pdb or simple print statements in your code to verify 
the results that the queryset is empty?
After that, look at your templates (this looks like you are using generic 
views).
--
  Andy McKay, @clearwind

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



Re: Strange difference between runserver and shell

2010-03-11 Thread Andy McKay
> Does anybody have any clue what the problem might be? Thanks for your help!

There should be no difference really between the two. What might help us if you 
show us the code that the runs from the shell and the code in the view.
--
  Andy McKay, @clearwind

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: getting request.user from a signal

2010-03-11 Thread Andy McKay
> Yes, this is essentially the same topic that was discussed here: 
> http://groups.google.com/group/django-users/browse_thread/thread/44ced967d9da3500
> However, there has not yet been an answer, and I think this particular (and 
> probably common) use-case renders the "write a function that accepts a user 
> argument" untenable.

No, but there's lots of other solutions. Marty Alchin solves this nicely with 
CurrentUserMiddleware:

http://bit.ly/9lIxsM

I've been wanting to make this into a reusable app for a long time, but the 
license on that code snippet is unclear.
--
  Andy McKay, @clearwind

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 marketplace?

2010-03-11 Thread Andy McKay

On 2010-03-11, at 8:50 AM, Tom Evans wrote:
> djangogigs.com

djangozen.com/jobs as well (and it's free)
--
  Andy McKay, @clearwind

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



Re: Django in the enterprise?

2010-02-24 Thread Andy McKay

On 2010-02-24, at 6:40 AM, Steven Elliott Jr wrote:
> Right now we have Java and ASP.NET doing most of the work for us but the 
> systems are old and need updating. Not to mention budgetary constraints are 
> big thing now. I used Django to write an intranet application and it was very 
> nice and I think I can probably handle the other stuff, just wanted to draw 
> on other's experience.

Yes there are many large scale (in terms of data and complexity) running on 
Django. We've just completed a large "enterprise" project converting classic 
ASP to Django and its gone extremely well. It's not on djangosites because the 
NDA denies it.

What you might need to consider if you are pitching to management is making 
sure that training, consulting and support is available from companies (which 
it is).
--
  Andy McKay, @clearwind
  http://clearwind.ca/djangoski

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Optimizing template rendering and database queries

2010-02-23 Thread Andy McKay
> I would like to include the following values on my admin pages, as
> part of the base_site:
> time_to_query_database
> time_to_render_page

django-debug-toolbar has all that and more
--
  Andy McKay, @clearwind
  http://clearwind.ca/djangoski

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Deciding how to start building a search form

2010-02-23 Thread Andy McKay

On 2010-02-23, at 12:50 PM, Nick wrote:
> Anyways, what I'm wondering is, should I build this up by hand or
> should I use something like haystack?  I am only querying against a DB
> and not en entire site.

Doing a search on one model is pretty straightforward. If however you need to 
do full text searches or searches on more than one model at a time, then you 
will need something like haystack.
--
  Andy McKay, @clearwind
  http://clearwind.ca/djangoski

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Is the user member of a certain group

2010-02-22 Thread Andy McKay

On 2010-02-22, at 2:56 PM, Joakim Hove wrote:
> Any tip on how to write the "user_is_member_of_admin_group()"
> function?

You can access the groups via the ManyRelatedManager, which exposes a queryset: 
user.groups.filter(...)

eg: if user.groups.filter(name="Admin")
--
  Andy McKay, @clearwind
  http://clearwind.ca/djangoski

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



Re: python manage.py test --omit=bad_app_one,bad_app_two

2010-02-17 Thread Andy McKay

On 2010-02-17, at 12:43 PM, Phlip wrote:

> Djangoids:
> 
> As Django apps get bigger, the odds that some contributed test cases
> fail go up.
> 
> (They fail for environmental reasons, and if nobody is changing their
> code at your site, then their test failures are less relevant!)
> 
> How can I knock out a list of apps from the test command line?

In the past for this I've defined a custom test runner:

http://docs.djangoproject.com/en/dev/ref/settings/#test-runner

But I haven't seen anything else that does that.
--
  Andy McKay, @clearwind
  http://clearwind.ca/djangoski

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Dictionary Model Merge

2010-02-15 Thread Andy McKay

On 2010-02-15, at 2:31 PM, cootetom wrote:

> Thanks Javier but I'm having problems with that. I do want to create a
> dictionary from the model first then override with the POST values.
> But when I try to make a dictionary from the model I get an 'object is
> not iterable' error.

Without the code that generates that error or the traceback, we can't provide 
much help.

One thing that is useful is model_to_dict, eg:

http://www.djangozen.com/blog/useful-django-apis
--
  Andy McKay, @clearwind
  http://clearwind.ca/djangoski

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Callback method on session timeout

2010-02-08 Thread Andy McKay

On 2010-02-06, at 4:08 PM, adamjamesdrew wrote:

> Does django have the ability to do a callback when a session time out
> occurs?

No, there is no session time out. Its just that a session isn't valid anymore.
--
  Andy McKay, @clearwind
  http://clearwind.ca/djangoski

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Slow admin performance with specific inline

2010-02-08 Thread Andy McKay
Try using the django-debug-toolbar and see if that tells you anything useful.
--
  Andy McKay, @clearwind
  http://clearwind.ca/djangoski

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: FieldError with get_object_or_404

2010-02-04 Thread Andy McKay

On 2010-02-04, at 7:36 AM, harryos wrote:
> In the shell I tried this
> from django.shortcuts import  get_object_or_404 as gtobj
> e1=gtobj(MyEntry,posted_time__year=2010,posted_time__month=2,posted_time__day=1)
> This is successful ,it gives this message
> MultipleObjectsReturned: get() returned more than one MyEntry -- it
> returned 4!

get(..) assumes there's one and only one object, hence the error.

> However when I tried ,
> e1=gtobj(MyEntry,posted_time__year=2010,posted_time__month=2,posted_time__day=1,posted_time__hour=10)
> 
> I get this error,
> FieldError: Join on field 'posted_time' not permitted. Did you
> misspell 'hour' for the lookup type?

There are lookups for year, month and day as documented here:

http://docs.djangoproject.com/en/dev/ref/models/querysets/#year

But *not* hour or minute.
--
  Andy McKay, @clearwind
  http://clearwind.ca/djangoski

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



  1   2   >