Distinct rows by a column field?

2007-08-01 Thread Ryan K
I have a log that I want to generate reports from. It is an access log where each row represents a "hit." One of the columns in the table is a key and each user has a unique key. Is there a way using Django's database API to get the count of distinct keys so I can get the number of unique users?

'dict' object has no attribute 'rindex'

2007-08-16 Thread Ryan K
I am using Django 0.96 and I am getting this error. Any ideas as to why? Thanks, Ryan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: 'dict' object has no attribute 'rindex'

2007-08-16 Thread Ryan K
Sorry about that. I figured out what the problem was. It seems like that usually happens AFTER I post to a newsgroup. Anyway, thanks! On Aug 16, 12:19 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 8/16/07, Ryan K <[EMAIL PROTECTED]> wrote: > > > I am

Extra_context for 404 pages?

2007-09-10 Thread Ryan K
Hi. I have certain settings about the locations of static files (like CSS files) that I need to pass to the 404 page so it can render properly. How do I go about doing this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: SOMETIMES mod_python error

2007-09-11 Thread Ryan K
Have you tried restarting the web server? Arnold Chen wrote: > Dear all, > > I am experiencing some situation that is very strange. the development > site is http://alberta.design97.com > > This site is django-powered, it is up sometimes, on some computers, > you can visit this site for a

404 Page Help

2007-09-11 Thread Ryan K
Hi. All URLs in my templates are preceded by variables I added to the settings file so I could easily deploy my site on many different URLs, this includes CSS file URLs. When the custom error 404 page comes up, there is obviously no style because I can't pass the setting to it. Is there a way to

Only Simplified Chinese translation not working?

2007-09-11 Thread Ryan K
Hi. I have a few languages I've translated my site into. They all work except Simplified Chinese. Any hints as to why? This is in my settings file: LANGUAGES = ( ('es', ugettext('Spanish')), ('fr', ugettext('French')), ('it', ugettext('Italian')), ('ru', ugettext('Russian')),

Re: 404 Page Help

2007-09-11 Thread Ryan K
ect.com/documentation/templates_python/#writing-... > > -jake > > Ryan K wrote: > > Hi. All URLs in my templates are preceded by variables I added to the > > settings file so I could easily deploy my site on many different URLs, > > this includes CSS file URLs. When the cus

Re: 404 Page Help

2007-09-12 Thread Ryan K
Ok...so how do I pass my 'site_context' dictionary (which is just a dict with URL prefixes in it for static media) to the default 404 handler? On Sep 12, 4:24 am, Collin Grady <[EMAIL PROTECTED]> wrote: > You don't need a custom 404 handler in order to use RequestContext - > the default handler

Re: 404 Page Help

2007-09-12 Thread Ryan K
Ok...nevermind. Jake is righttemplate context processors are my friend. Thanks! On Sep 12, 10:06 am, Ryan K <[EMAIL PROTECTED]> wrote: > Ok...so how do I pass my 'site_context' dictionary (which is just a > dict with URL prefixes in it for static media) to the default 4

Re: Only Simplified Chinese translation not working?

2007-09-12 Thread Ryan K
Anyone? I have the site translated and working in Spanish, French, Italian and Russian yet simplified Chinese does not work. Any clues? This is my first attempt at internationalization. On Sep 11, 10:11 pm, Ryan K <[EMAIL PROTECTED]> wrote: > Hi. I have a few languages I've translate

Re: Only Simplified Chinese translation not working?

2007-09-13 Thread Ryan K
Yesafter checking the Django sources I saw that zh_CN is where the .po .mo files should go. On Sep 13, 10:02 am, Nis Jørgensen <[EMAIL PROTECTED]> wrote: > Ryan K skrev:> Hi. I have a few languages I've translated my site into. They > all work > > except Simplifi

Re: Only Simplified Chinese translation not working?

2007-09-13 Thread Ryan K
You are correct Nis...in django.utils.translation.trans_real.to_locale. No idea why the two need be any different... On Sep 13, 10:02 am, Nis Jørgensen <[EMAIL PROTECTED]> wrote: > Ryan K skrev:> Hi. I have a few languages I've translated my site into. They > all work > &

Strange error from get_and_delete_messages?

2007-09-18 Thread Ryan K
Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/django/core/handlers/ base.py", line 77, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/home/llcom/projects/llcom/makeav/views.py", line 231, in create_avatar return

View didn't return an HttpResponse object?

2007-09-25 Thread Ryan K
from django.http import HttpResponse, Http404 from django.template import RequestContext from django.shortcuts import render_to_response def verify_sl(request): if request.method == 'GET': if not request.GET.get('avatarkey',''): raise Http404 elif

Re: View didn't return an HttpResponse object?

2007-09-25 Thread Ryan K
Ok thank you! I've taken care of the superfluous code and thought it was something silly I was missing. Thanks! On Sep 25, 11:25 am, Tim Chase <[EMAIL PROTECTED]> wrote: > > if not request.GET.get('avatarkey',''): > > raise Http404 > > elif

Help understanding the DB API

2007-10-25 Thread Ryan K
For example, I have to basic models: class User(models.Model): name = models.CharField(max_length=30) class AlterEgo(models.Model): nickname = models.CharField(max_length=30) user = models.ForeignKey(User) I do a lookup for a User named 'Ryan' and one object is found.

Help understanding the DB API

2007-10-25 Thread Ryan K
For example, I have to basic models: class User(models.Model): name = models.CharField(max_length=30) class AlterEgo(models.Model): nickname = models.CharField(max_length=30) user = models.ForeignKey(User) I do a lookup for a User named 'Ryan' and one object is found.

Re: Help understanding the DB API

2007-10-25 Thread Ryan K
Perfect! Thanks. On Oct 25, 2:20 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > On 10/25/07, Ryan K <[EMAIL PROTECTED]> wrote: > > > Why can't I change the User's name like so: > > > results[0].user.name = 'Brian' > > results[0].user.save(

Server error/Template Context processors

2007-11-06 Thread Ryan K
Hi. When there is a server error (error 500 returns) the template context processors don't seem to be doing anything (not passed to the template). I have this template context processor: import llcom.settings def site_context(request): """ Add URL prefixes from settings file to request

Server error/Template Context processors

2007-11-06 Thread Ryan K
Hi. When there is a server error (error 500 returns) the template context processors don't seem to be doing anything (not passed to the template). I have this template context processor: import llcom.settings def site_context(request): """ Add URL prefixes from settings file to request

Flatpages-like application and caching

2009-07-03 Thread Ryan K
Greetings, I am designing an application that is very simple like flatpages but I need the ability to associate a menu with the content which will be done through the URL (i.e. example.com/products/widget2009 would invoke the products menu and the widget2009 static page). I expect these pages

Checking if a ForeignKey field is NULL

2009-07-04 Thread Ryan K
Lets say I retrieve from my database an object foo and foo's model has a ForeignKey field, baz, with null and blank set to True. Will a simple test like if foo.baz ... test whether the field is set to NULL or not? Cheers, Ryan --~--~-~--~~~---~--~~ You received

Django and its caching system help

2009-07-05 Thread Ryan K
Greetings, I am designing an application that includes a menu with a many to many relationship with links. These menus will hardly ever change. What is the best way to cache these pages? Should I use the messaging system to create an html file to use when the menu is changed? Is database access

Circular imports problem

2009-07-08 Thread Ryan K
I am creating an application that uses the dispatcher in Django. In the apps models.py file I connect the post_save of two models to functions in a signals.py file. The problem is that I need to use several models in models.py and that leads to a circular import. What is the best way to solve

Re: Circular imports problem

2009-07-08 Thread Ryan K
I hope this better specifies the issue. Should I import these in the run method for each Thread subclass? On Jul 8, 4:47 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > On Wed, Jul 8, 2009 at 3:45 PM, Ryan K <ryankas...@gmail.com> wrote: > > > I am creating an applicati

Middleware help -- screwing up the admin

2009-07-08 Thread Ryan K
I'm getting a very strange error: TypeError at /admin/ object.__new__() takes no parameters I've isolated the problematic code to my middleware for an application I built called staticpages. It uses the same mechanism and so the same middleware as flatpages. This is the code: from django.http

Re: Middleware help -- screwing up the admin

2009-07-08 Thread Ryan K
Please ignore this. I'm an idiot and placed the reference to the middleware in the template_context_processros settings. And so strange errors resulted. Please delete if possible. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Some post_related_objects_save signal or workaround?

2009-07-09 Thread Ryan K
Is there any reason you can't create your own signal and put it in the rounds save() method and then just call the parents save? http://docs.djangoproject.com/en/dev/topics/signals/#defining-and-sending-signals Cheers, Ryan On Jul 9, 6:12 am, Eugene Mirotin wrote: >

post_save signal bug

2009-07-10 Thread Ryan K
Hello, I am trying to implement a cache system using the post_save signal. The problem is the code below, a Thread subclass that ends up calling run(), the cache database never runs. It's driving me crazy!!! Is there something going on with the way Django cache's queries which is what I expect?

Re: post_save signal bug

2009-07-10 Thread Ryan K
I modified the above _cached_menu method to just create a new object every time (shown below). It only seems to get the links right, a ManyToMay field, after I save it _twice_? Hmmm...how I get the updated many2many table? def _cache_menu(self, menu, xhtml): """ Stores xhtml into

Does post_save signal need to be in models.py?

2009-07-11 Thread Ryan K
I am trying to avoid circular dependency issues between signals.py and models.py. Is there any reason why I can't connect the post_save signal in signals.py itself (the function is connects with would be in the same file? Should I import it in the apps/__init__.py file to ensure the signal is

Question regarding post_save signal and ManyToMany field objects

2009-07-13 Thread Ryan K
Recently I've been trying to get answers about the post_save signal behavior and perhaps have been asking too much of readers without narrowing down the problem enough myself. So here is my effort to ask a rather straightforward question: The code that connects to the post_save signal, according

Re: .views._CheckLogin.__call__ didn't return an HttpResponse object

2009-07-14 Thread Ryan K
Are you returning render_to_response in the view? On Jul 14, 6:12 am, alecs wrote: > Hi all :) Can u help me with .views._CheckLogin.__call__ didn't return > an HttpResponse object . I'm trying from my view 'jump' to another > view by calling    

Re: .views._CheckLogin.__call__ didn't return an HttpResponse object

2009-07-14 Thread Ryan K
To be a little more explicit, perhaps your view code contains: render_to_response('template.html",{},RequestContextInstance) as opposed to return render_to_response(...) Cheers, Ryan --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: Question regarding post_save signal and ManyToMany field objects

2009-07-14 Thread Ryan K
s (you can verify it by adding print statements to your > save methods or handlers and running the dev server from terminal). > The reason is that when you initially create the object, related > objects have to link to the existing object, so the parent object is > saved before them.

Re: .views._CheckLogin.__call__ didn't return an HttpResponse object

2009-07-14 Thread Ryan K
I'm not really sure I understand your question but you don't need to jump to another view...you just need to pass the relevant objects to the mailer function and then "return render_to_response(...)." If the mailer function is already in another view, refactor the code and create a non view

Re: Object attributes in change_form.html

2009-07-14 Thread Ryan K
I'm not sure but try {{ original }} ...here is the code: http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/options.py context = { 860 'title': _('Change %s') % force_unicode (opts.verbose_name), 861 'adminform': adminForm, 862

Re: Question regarding post_save signal and ManyToMany field objects

2009-07-14 Thread Ryan K
lt;freakboy3...@gmail.com > > > > > > > wrote: > > > On Tue, Jul 14, 2009 at 6:27 PM, Ryan K<ryankas...@gmail.com> wrote: > > > > Yea...it would be so elegant too! Here is a "bug" filing: > > >http://code.djangoproject.com/ticket/5390. It'

Re: post_save signal bug

2009-07-16 Thread Ryan K
icket/5390. (this post if for anyone searching the topic) On Jul 11, 1:57 am, Ryan K <ryankas...@gmail.com> wrote: > I modified the above _cached_menu method to just create a new object > every time (shown below). It only seems to get the links right, a > ManyToMay field, after I save it

Re: problems with large data

2009-07-16 Thread Ryan K
I'm starting to see that I too need to participate in Django sprints to help incorperate the features I want in Django and I think we all should and perhaps you do which is great. This is great software there is still a lot of work to be done. Ryan Kaskel http://consulting.ryankaskel.com/ On

Re: Checking if user is logged in and log in form

2009-07-19 Thread Ryan K
> urlpatterns = patterns('', > (r'^someurl/', login_required(direct_to_template), { 'template': > 'template.html', }), > ) http://groups.google.com/group/django-users/browse_thread/thread/e9f85ce0666da8c/ Cheers, Ryan http://consulting.ryankaskel.com On Jul 19, 5:31 pm, AKK

Re: Checking a User in another Table ...

2009-07-19 Thread Ryan K
What exactly are your models? If you are using a ManyToMany fields you could do it Rating.objects.get(user=request.user) and see if that returns anything. Cheers, Ryan On Jul 19, 10:06 am, The Danny Bos wrote: > Hey there, this should be easy, but my code just won't play

Strange error while trying to access admin: rendering fails (latest SVN)

2009-08-26 Thread Ryan K
I am getting a very strange error and I can't tell if it is coming from my code or Django's code. I have not modified the templates of the admin interface at all. Below is the error. I am trying to access http://localhost:8080/. This error still occurrs if I remove all apps from the install apps

Re: Strange error while trying to access admin: rendering fails (latest SVN)

2009-08-26 Thread Ryan K
This is where it says the problem is in the template: Template error In template /usr/local/lib/python2.6/dist-packages/django/contrib/ admin/templates/admin/base.html, error at line 30 Caught an exception while rendering: unsupported operand type(s) for +=: 'function' and 'list' 20 21

Re: Strange error while trying to access admin: rendering fails (latest SVN)

2009-08-26 Thread Ryan K
State in admin rendering process when error occurred: /usr/local/lib/python2.6/dist-packages/django/template/debug.py in render_node 74. e.source = node.source 75. raise 76. except Exception, e: 77. from sys import exc_info 78. wrapped = TemplateSyntaxError(u'Caught an exception while

Re: Strange error while trying to access admin: rendering fails (latest SVN)

2009-08-26 Thread Ryan K
Thanks Karen you've been helping me out recently with debugging a few things and have been a really great asset. Cheers, Ryan Kaskel On Aug 26, 7:19 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Wed, Aug 26, 2009 at 3:33 PM, Ryan K <ryankas...@gmail.com> wrote: > > &g

Newforms error question

2007-11-28 Thread Ryan K
I have a basic registration form for my site that has fields for a postal code, state and a country. Since our site caters to international users, I only want to require a state and postal code only if the country is the United States. I have a clean_country method in my form that raises a

Re: Newforms error question

2007-11-28 Thread Ryan K
On Nov 28, 10:40 am, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > On Nov 28, 2007 10:12 AM, Ryan K <[EMAIL PROTECTED]> wrote: > > > I have a basic registration form for my site that has fields for a > > postal code, state and a country. Since our site caters

FileField and form.save()

2007-12-18 Thread Ryan K
I am trying to allow certain users to upload media and then "attach" it via the contenttypes framework. The code posted below just puts the contents of the file in the media field. How do I make this work with the model.FileField? (putting it in the settings.MEDIA_ROOT+upload_to directory?) This

Re: FileField and form.save()

2007-12-18 Thread Ryan K
Just to make the question a little more clear: What type of object does model.FileType expect to get? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: FileField and form.save()

2007-12-18 Thread Ryan K
Thanks a lot. Missed save_FOO_file in the docs. On Dec 18, 12:52 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > On Dec 18, 2007 12:08 PM, Ryan K <[EMAIL PROTECTED]> wrote: > > > def save(self, user): > > if user != self.scheduled_produ

Allowing downloads for only certain users

2007-12-18 Thread Ryan K
What is the best way to serve static media and only letting certain users (using django.contrib.auth) download that data? Thanks, Ryan Kaskel --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Allowing downloads for only certain users

2007-12-18 Thread Ryan K
<[EMAIL PROTECTED]> wrote: > Ryan K wrote: > > What is the best way to serve static media and only letting certain > > users (using django.contrib.auth) download that data? > > > Thanks, > > Ryan Kaskel > > http://blog.lighttpd.net/articles/2006/07/02/x

Time zone settings

2007-12-20 Thread Ryan K
Hello. I want to use the pytz package. It has a tzinfo objects called pytz.UTC that it recommends you store as the general timezone. Is there a way for Django to set the tz to pytz.UTC whenever it deals with datetimes? Thanks, Ryan Kaskel --~--~-~--~~~---~--~~ You

Re: Time zone settings

2007-12-20 Thread Ryan K
Nevermind on this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL

Datetime ordering correct?

2007-12-26 Thread Ryan K
I have a simple functions that pulls objects from the database that are between a date range: def get_sp_from_date_range(start_date, end_date, order=False): s_products = ScheduledProduct.objects.filter(start__gt=start_date) s_products = s_products.filter(finish__lt=end_date) if

Re: Recommended tool for web load & stress testing

2008-01-02 Thread Ryan K
For all your testing needs http://www.softwareqatest.com/qatweb1.html On Jan 2, 2:58 pm, mamcxyz <[EMAIL PROTECTED]> wrote: > Hi, > > I wonder what tool let me to do web load & stress testing with this > options: > > - Run on Windows, test target are windows & solaris > - Simulate diferent

Many Django checkouts, setting which one to use (PYTHONPATH perference)

2008-01-07 Thread ryan k
I used svn propset svn:external so my project (in transition to another developer when I return to college) can easily use the most recent version fo Django (and comment_utils, etc). How can I ensure that the project uses that django module instead of the one found on /.../python2.X/site-packages

Re: Many Django checkouts, setting which one to use (PYTHONPATH perference)

2008-01-07 Thread ryan k
Ok thank you for your responses. I would try this out but not at the office now... what about __init__.py in the project's root directory? Right now I am trying this all on the Django development server. So let's say on my production server I have /home/ryan/projects/llcom/ trunk/lib (all

Anything special needed in URLconf for tilde?

2007-04-10 Thread ryan k
Hi. My django project lies in my public_html so I access my website through http://209.xxx.xxx.xx/~ryan/django-project. Do I have to do anything special because of the tilde? Using the URLconf defined in kitabu.urls, Django tried these URL patterns, in this order: 1.

Re: Anything special needed in URLconf for tilde?

2007-04-10 Thread ryan k
On Apr 10, 8:08 pm, "ryan k" <[EMAIL PROTECTED]> wrote: > Hi. My django project lies in my public_html so I access my website > throughhttp://209.xxx.xxx.xx/~ryan/django-project. Do I have to do > anything special because of the tilde? > > Using the URLconf defin

Re: Anything special needed in URLconf for tilde?

2007-04-10 Thread ryan k
On Apr 10, 8:32 pm, "Brian Beck" <[EMAIL PROTECTED]> wrote: > On Apr 10, 8:31 pm, "Brian Beck" <[EMAIL PROTECTED]> wrote: > > > I'm not sure, but it might be that tildes aren't valid URL characters. > > Web browsers have to violate the spec in order to support this thanks > > to someone

User and generic views

2007-04-28 Thread Ryan K
Hi all...quick question. If I have the auth app enabled, is the user object automatically exposed to templates used with generic views? I want to display a login link if no one is logged in and a logout link if a user is. Thanks, Ryan --~--~-~--~~~---~--~~ You

Re: User and generic views

2007-04-29 Thread Ryan K
On Apr 29, 4:26 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sun, 2007-04-29 at 03:47 +0000, Ryan K wrote: > > Hi all...quick question. If I have the auth app enabled, is the user > > object automatically exposed to templates used with generic views? I > > w

Best way to link to other pages in templates

2007-06-27 Thread Ryan K
What is the best form of a link in my Django site's templates? For example, I have a base.html which serves as the base template for all others. It contains links that are relative to the current directory like Manage. However, when I am at a page like

Re: Best way to link to other pages in templates

2007-06-27 Thread Ryan K
Perfect. Thanks. On Jun 27, 12:40 pm, Thomas Steinacher <[EMAIL PROTECTED]> wrote: > Try the {% url %} > tag:http://www.djangoproject.com/documentation/templates/#url > > tom > > On Jun 27, 2007, at 6:33 PM, Ryan K wrote: > > > > > What is the best form

Re: Best way to link to other pages in templates

2007-06-27 Thread Ryan K
What if I am using generic views? On Jun 27, 3:26 pm, Ryan K <[EMAIL PROTECTED]> wrote: > Perfect. Thanks. > > On Jun 27, 12:40 pm, Thomas Steinacher <[EMAIL PROTECTED]> wrote: > > > Try the {% url %} > > tag:http://www.djangoproject.com/documentation/temp

Re: Best way to link to other pages in templates

2007-06-27 Thread Ryan K
ed: > Instead of "http://example.com/mydjangosite/manage/manage; I would > just do "/mydjangosite/manage/manage" > > On Jun 27, 2:41 pm, Ryan K <[EMAIL PROTECTED]> wrote: > > > What if I am using generic views? > > > On Jun 27, 3:26 pm, Ryan K <[EMAIL PRO

Re: Best way to link to other pages in templates

2007-06-27 Thread Ryan K
for the documentation (which has gotten better though). On Jun 27, 6:45 pm, Ryan K <[EMAIL PROTECTED]> wrote: > Right but I'm using the Django server included with the package for > development and Apache for another. So the root of my test server is / > mydjangosite, but for my deploy

Searching for strings and URLconfs

2007-06-28 Thread Ryan K
Hi. I'm trying to setup an re pattern for /search in my URL conf. How can I match an entire string like "red fox" e.g. http://example.com/django/search/red%20fox? I noticed that Google replaces their query parameter q's spaces with '+'s using Javascript. Is that a better way to go? Thanks.

Re: Searching for strings and URLconfs

2007-06-28 Thread Ryan K
Note - I know that I am not using a parameter and it's much easier to do that (I was searching without having created the form yet so this slipped my mind). But how would you capture something like "red fox" in a URLconf pattern? On Jun 28, 2:46 pm, Ryan K <[EMAIL PROTECTED]>