Re: templates..

2007-08-02 Thread Andy McKay
> > def login(request): > html = "HI" > get_template('prova.html') > return HttpResponse(html) -- Andy McKay --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django us

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.TestCa

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 repre

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 you

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

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

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: >> >

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

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

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

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 "Djang

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

2012-04-14 Thread Andy McKay
own servers and excuting them there. On Apr 14, 2012 11:43 AM, "Arruda" 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

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 adde

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

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

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

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, incl

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" gro

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 developi

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 djan

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 g

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 a

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 :( Y

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-i

Re: message mark_safe and redirect results in message still showiing with encoded tags

2011-08-22 Thread Andy McKay
es 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

Re: models.URLField does not validate a valid url

2011-08-22 Thread Andy McKay
ors 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 dja

Re: message mark_safe and redirect results in message still showiing with encoded tags

2011-08-23 Thread Andy McKay
7;:'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 djan

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

Re: configuration field

2011-09-02 Thread Andy McKay
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

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

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 wro

Re: PayPal Adaptive Payments

2011-10-09 Thread Andy McKay
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

Re: Question about Signals and Bootstrap

2011-10-09 Thread Andy McKay
ort 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 rec

Re: Signals and listeners defined in a separate modules unusable in other apps

2011-10-09 Thread Andy McKay
n'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 gro

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 t

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/bl

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. --

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 Gr

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 r

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

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 beca

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': '#99

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 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 Pyth

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://

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 generou

Re: Using auth.login() with multiple databases

2011-04-21 Thread Andy McKay
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 &q

Re: bound form with ModelChoiceField

2011-04-21 Thread Andy McKay
delChoiceField. 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 receive

Re: bound form with ModelChoiceField

2011-04-23 Thread Andy McKay
oiceField 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 twitt

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.nul

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.nul

Re: Hidden rows elements also visible on list filters

2011-05-04 Thread Andy McKay
e 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

Re: selecting all columns from a table (advanced query)

2011-05-05 Thread Andy McKay
tial 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

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...@clearwin

Re: Django administration page, created a Site -- now what?

2011-05-06 Thread Andy McKay
/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

Re: Django password reset modification

2011-05-07 Thread Andy McKay
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 thi

Re: [Django] Error (EXTERNAL IP): /add_comment/10/

2011-05-07 Thread Andy McKay
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

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 subscrib

Re: [help]django's FloatField can't insert the mysql's double type data.

2011-05-14 Thread Andy McKay
els/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

Re: Inverted checkbox value in modelForm field for BooleanField?

2011-05-14 Thread Andy McKay
): 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" g

Re: NoReverseMatch while rendering

2011-05-25 Thread Andy McKay
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

Re: Synchronize method or model field access

2011-05-25 Thread Andy McKay
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@googlegro

Re: Open source Django websites

2011-06-20 Thread Andy McKay
p. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, 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

Re: Unit-Testing Dilemma

2011-06-21 Thread Andy McKay
r 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-

Re: How to use the django-users mailing list properly and doing your homework..

2011-07-06 Thread Andy McKay
hey 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: @a

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"

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

2011-01-19 Thread Andy McKay
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 t

Re: Word file Display and Save??

2011-01-29 Thread Andy McKay
eField. 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@goog

Re: QUERYDICT immutable

2011-01-29 Thread Andy McKay
cs.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@google

Re: checkbox, how to return state back to html

2011-02-03 Thread Andy McKay
t 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

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 synta

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:

<    1   2