Re: override render_to_response

2009-03-16 Thread Malinka Rellikwodahs

On Mon, Mar 16, 2009 at 12:42, a b  wrote:
> Hi,
>
> I'm building a one page app with no page refresh.
> All the content is loaded as JSON dynamically and the UI is built using
> javascript.
>
> I'm using external django apps and I need them to send back the context dict
> as JSON instead
> of rendering the html template.
>
> Is it possible to override render_to_response so all the apps using it will
> respond with JSON without
> actually touching the apps code? I don't want to create a middleware that
> will modify the response because
> then I have the overhead of rendering the html template.

Unless I'm mistaken it should be fairly simple in this case to create
your own set of templates for each of the django apps you're using and
then have them output the data you need as json text instead of as
html

> Thanks
>
> >
>

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



Re: My app is missing!

2009-02-18 Thread Malinka Rellikwodahs

my first gues would be you are not in the akonline folder

On Wed, Feb 18, 2009 at 15:54, djandrow  wrote:
>
> Hello all,
>
> I've been trying to add a few extra fields to my model, as part of my
> blog app. So then I tried sqlall:
>
> python "C:\ProgLangs\Python25\Lib\site-packages\django\conf
> \project_template\manage.py" sqlall blog
>
> theres another thread about why i've included the path, but i don't
> see why it should make a difference.  Anyway, when i run that i get
> this error message.
>
> Error: App with label blog could not be found. Are you sure your
> INSTALLED_APPS
> setting is correct?
>
> my installed apps looks like this ;
>
> INSTALLED_APPS = (
>'django.contrib.auth',
>'django.contrib.contenttypes',
>'django.contrib.sessions',
>'django.contrib.sites',
>'django.contrib.admin',
>'akonline.blog',
> )
>
> it exists in akonline/blog and i created it in the proper way so can
> someone explain why i get an error? Or are there some things i can try
> to see whats going on?
>
> Thanks,
>
> Andrew
> >
>

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



Re: trouble with yesno to generate images

2009-01-26 Thread Malinka Rellikwodahs

This is just a quick guess without really knowing anything about the
yesno filter, but I would try single quotes inside the html in your
yesno filter

eg 

On Mon, Jan 26, 2009 at 16:39, Margie  wrote:
>
> Hi,
>
> I am trying to generate a symbol for true and false in my table, but
> am having problems with the escaping of quotes and also with
> generating the < > tags.  If I use the code below:
>   {{ task.done|yesno:" \" />," }}
>
> it ends up generating this:
>
> 
>  
> 
>
>
> < ends up being <, > ends up being > and my quotes become
> "  Could someone give me an example of how to use yesno to
> generate an image?
>
> Margie  an image?
>
> Margie
> >
>

--~--~-~--~~~---~--~~
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: Automatically Generating Non-Ajax Client-Side Form Validation

2009-01-23 Thread Malinka Rellikwodahs

following you're link they discussed client side form validation just
like you mentioned, not sure it's complete or what you need but
http://eikke.com/tag/django-validation/ might have some useful
information

On Fri, Jan 23, 2009 at 12:52, Chris  wrote:
>
> Is anyone aware of a simple way to automatically generate non-Ajax
> form validation? I've seen some useful posts about Ajax-form
> validation (e.g. http://eikke.com/django-generic-ajax-form-validation/),
> but I'd rather not waste bandwidth on validating integers/dates/phone-
> numbers/required-fields/etc that can easily be done directly in the
> browser. Ideally, once this initial client-side validation passes,
> then the Ajax validation would be used.
> >
>

--~--~-~--~~~---~--~~
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: Shouldn't blank=True imply null=True?

2009-01-06 Thread Malinka Rellikwodahs

On Tue, Jan 6, 2009 at 17:47, Malcolm Tredinnick
 wrote:

> This thread is about whether blank=True, null=False (the fourth
> possibility) ever makes sense for non-text fields.

not sure if django supports binary data or any form of arrays but in
those cases it could make sense to have blank=True and null=False,
because you could have for whatever reason a situation where you'd
have an array of zero length which afaics is the same as an empty
string, and could have a requirement outside of django to allow those
values but not allow nulls

--~--~-~--~~~---~--~~
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: Newbie: Help to understand string handling

2009-01-06 Thread Malinka Rellikwodahs

On Tue, Jan 6, 2009 at 16:49, Jeff Anderson  wrote:
> phoebebright wrote:
>> Thanks for your response. Do you think a working knowledge of python
>> is essential for django then?  And do I import modules the same in
>> django and python?  Are there any python things you can't do in
>> django?

yes you should be able to in django do anything you can do in python

>>
> Django *is* Python. In fact, Django is only a Python library. It is not
> its own language.

excluding the template language obviously that isn't python

--~--~-~--~~~---~--~~
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: Outdated data in django page rendering w/ cacheing disabled

2009-01-05 Thread Malinka Rellikwodahs

On Fri, Jan 2, 2009 at 09:56, Rajesh Dhawan  wrote:
>>
>> As far as I can tell there is no reason for this data to be outdated
>> on browser refresh, I've tried looking through the documentation and
>> other places to find what could be causing this
>
> You didn't include a code snippet of how you actually retrieve data in
> your views. Perhaps include the snippet for your index view for
> example so people can see if anything there might be causing this
> problem.

Sorry for the late response, due to other issues this got pushed down
in the priority list here, but here is some code examples of how I'm
retrieving my data etc.

views.py (cropped for index):

from django.views.decorators.cache import never_cache
from django.shortcuts import render_to_response
from django.http import Http404
from Client import GetClients

@never_cache
def index(request):
clients = GetClients()
pend = [cl for cl in clients if len(cl.Stops()) != 0 or 
len(cl.Limits()) != 0]
pos = [cl for cl in clients if cl.Position() != 0 or not cl.MatchPos()]
return render_to_response(
'Clients/index.html', {
'ReloadRate': 120,
'pending': pend,
'position': pos,
}
)

Client.py (cropped for GetClients):

from MySQLdb import connect

def GetClients():
avail_db = 
connect(user=AVAIL_USER,db=AVAIL_DB,host=AVAIL_HOST,port=AVAIL_PORT)
c = avail_db.cursor()
c.execute("SELECT acct_pk FROM t_acct")
return [Client(cl[0]) for cl in c.fetchall()]

where the Client object is a series of functions and private data that
gets pulled from the DB either on construction or on request depending
on how troublesome it is to get from the DB

now like I said before I've ran the code to get the data from the DB
outside of django and it gets the data on request fine w/o being
outdated, it's just when i use django to get html out of the data

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