Re: How to install psycopg2 using Pip?

2011-03-24 Thread Shawn Milochik
Ensure that pg_config is on your PATH and it should work. -- 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: Auto refresh of page for one user on other user's update

2011-03-24 Thread Shawn Milochik
In addition there's hookbox.org. There was a great talk on it at PyCon. http://pycon.blip.tv/file/4883145/ In addition, I'm in the process of playing with Hookbox, after which I'll write a blog post detailing how to use it with Django. In the meantime, this is the tutorial I've found most

Re: Django 1.3 released -- say thanks!

2011-03-23 Thread Shawn Milochik
On Wed, Mar 23, 2011 at 7:19 PM, Brian Neal wrote: > I also found a bug. :)  I got a 403 CSRF failure when Paypal sent me > to http://www.djangoproject.com/foundation/donate/thanks/ Oh the bitter irony! -- You received this message because you are subscribed to the Google

Re: newbie question regarding passwords and service requests

2011-03-23 Thread Shawn Milochik
It's not possible to have a system that can access another, yet block access to the other system if hacked. This is why it is impossible to have unbreakable encryption in consumer devices. You can't make a Blu-Ray player that doesn't contain the capability to decrypt Blu-Ray discs. Therefore, all

Re: Show differents views in a single template

2011-03-23 Thread Shawn Milochik
2011/3/23 Alberto Morales Fernández : > I have a problem, i need show differents "views" in a single template, how i > can  achive this? I think you need to ask a clearer question. You don't use templates to display views. You use templates within views (among other places) to

Django 1.3 released -- say thanks!

2011-03-23 Thread Shawn Milochik
Everyone: I just donated $25 to the Django Software Foundation. I would like to suggest that others who appreciate all the hard work chip in a couple of bucks if they are able. Especially those who, like me, want to express their gratitude but haven't yet contributed back to the community by

Re: Clueless Monk

2011-03-22 Thread Shawn Milochik
A good way to start is to go to the Python Web site, do the tutorial, and then graduate to the Python mailing list. Welcome to Python -- it's awesome! This list is for Django, so this isn't on-topic for this list. Tutorial: http://python.org/doc/ Mailing list:

Re: Postgresql transaction error

2011-03-22 Thread Shawn Milochik
pdb: www.doughellmann.com/PyMOTW/pdb/ -- 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.

Re: Postgresql transaction error

2011-03-22 Thread Shawn Milochik
The cause is that there's a problem with a line of code that interacts with the database, leaving the database connection dirty and unusable. The error occurs not at that line of code, but at the next line of code which tries to use the database connection. The solution is to use pdb and/or

Re: django 1.3

2011-03-22 Thread Shawn Milochik
It was claimed this morning that the release will be today. https://groups.google.com/forum/#!topic/django-developers/Bh33bkwnEZU -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Logging visitors/requests and showing it all in a nice report?

2011-03-21 Thread Shawn Milochik
It sounds like you want webalizer or awstats. They use your server log info. Shawn -- 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

Re: how to compose templates with widgets (that has dynamic contents in it)

2011-03-20 Thread Shawn Milochik
1. Create a Django form. 2. Add a ChoiceField to the form. 3. Populate the ChoiceField's 'choices' properly with an iterable (tuple or list) full of iterables containing the key and value you like. 4. Put the form into your template somewhere within your HTML form. Shawn P.S. I recommend

Re: case sensitive model fields: does object_id gets smallcap field?

2011-03-20 Thread Shawn Milochik
1. Why are you creating models with the ORM (via a Model subclass), then using raw SQL instead of the ORM to manipulate the database? 2. Why are you overriding the primary key just to replace it with the same type? 3. Your view allows for SQL injection errors -- one of the things the ORM

Re: How should I solve?

2011-03-20 Thread Shawn Milochik
Run a grep on your code and look for the word 'complete.' Then figure out where it's blowing up. If 'complete' doesn't appear anywhere in your code, then use pdb to trace into the django-socialauth code that's blowing up so you can figure out what your code is doing wrong that's breaking

Re: Auto import files into database

2011-03-19 Thread Shawn Milochik
I recommend creating a script that reads the CSV files then creates instances of your models from that data and saves them. This will ensure that your signals (if any) fire, and that any relationship or validation errors are known immediately, rather than breaking your application later. Shawn

Re: Posted Screen Text Field Manipulation

2011-03-18 Thread Shawn Milochik
Do you know for certain that you're getting past this line? if request.method == "POST" and referer.endswith('upload/'): Also, you might want to add some logging to your app (or use pdb) to get information about what's going on at runtime. Some things I would check: You have a LOT of

Re: Posted Screen Text Field Manipulation

2011-03-18 Thread Shawn Milochik
http://dpaste.com/ always works. I guess the view and the form. -- 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: Posted Screen Text Field Manipulation

2011-03-18 Thread Shawn Milochik
If you post code I will look at it, but I'm not keen to guess. -- 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: Posted Screen Text Field Manipulation

2011-03-18 Thread Shawn Milochik
What are you doing to the post data in the view? What are you doing in the form? If you overrode any clean() methods, did you take care to return the required value/object? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Django in low memory environments

2011-03-18 Thread Shawn Milochik
I use gunicorn with nginx, albeit on a much more powerful machine. I think you'll find nginx or lighttpd recommended for a lightweight server. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Posted Screen Text Field Manipulation

2011-03-18 Thread Shawn Milochik
On Fri, Mar 18, 2011 at 12:55 PM, hank23 wrote: > The order or priority of the fields are not important, but having a > minimum of at least one is, If that's the case, then just don't make any of those fields required, then in the clean() of your form check the

Re: Posted Screen Text Field Manipulation

2011-03-18 Thread Shawn Milochik
It's possible to do this by manipulating the post data. It's probably cleaner (and more easily reusable) to do it in the form's __init__ than in the view itself, though. I don't know what these fields are meant to contain, but assuming one is more important than the others, what if they leave the

Re: Help creatind postgres database

2011-03-18 Thread Shawn Milochik
Log into the PostgreSQL console using the psql command. Or manage.py dbshell. CREATE USER username PASSWORD 'secret' CREATEDB; CREATE DATABASE dbname OWNER username; That ought to do it. Also, you only need the CREATEDB if you plan to run unit tests, so don't bother with it in production. It

Re: Template Tags and TemplateSyntaxError: - expected 'endblock' or 'endblock content'

2011-03-18 Thread Shawn Milochik
Are you certain that your base template is structured properly? Check for missing closing tags. It may be that your template is correct but just inheriting a syntax problem. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: ModelChoiceField problems

2011-03-17 Thread Shawn Milochik
I believe you can filter them using ModelAdmin.formfield_for_choice_field. Check out the docs here: http://docs.djangoproject.com/en/1.2/ref/contrib/admin/ Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Cannot import models.py in views.py

2011-03-17 Thread Shawn Milochik
Try changing from: from reviewsapp.models import Category to: webservices.reviewsapp.models import Category It's all about the PYTHONPATH. When you use manage.py it configures your environment which allows you to import in your Django app and the shell. Shawn -- You received this

Re: How can I create Django web page to connect Facebook login and registration?

2011-03-17 Thread Shawn Milochik
It's easy to create an authentication backend: http://docs.djangoproject.com/en/1.2/topics/auth/#writing-an-authentication-backend If you know (or can figure out) what code you have to write in order to authenticate against Facebook, just drop that code into your custom authentication backend

Re: About using Django Auth with my app, Auto saving the User

2011-03-17 Thread Shawn Milochik
Here's an alternative way to do it. Something like (in view): post.save(user = request.user) And in your save override: user = kwargs.pop('user') self.user = user super(Post, self).save(*args, **kwargs) The reason you pop off the 'user' value instead of just reading it is that

Re: All views require login?

2011-03-17 Thread Shawn Milochik
Thanks for that. I wrote my own middleware for this, but the snippet is better-implemented than mine. Shawn -- 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

Re: How i can get username into the error mail?

2011-03-16 Thread Shawn Milochik
On Wed, Mar 16, 2011 at 2:47 PM, emonk wrote: > I'm tired of searching and found many examples of middleware but not the one > I seek > You almost certainly will not find the exact code you need to cut & paste. You need to read the examples you did find and learn something.

Re: How i can get username into the error mail?

2011-03-16 Thread Shawn Milochik
On Wed, Mar 16, 2011 at 1:16 PM, emonk wrote: > Yep, but i need an example and I have not found any. > If you haven't found any then you haven't looked. Have you heard of Google? Here are the docs:

Re: A little help before I run down the wrong rabbit hole

2011-03-15 Thread Shawn Milochik
You can use formsets, which can be passed querysets upon initialization. If this doesn't help, feel free to use a more specific question. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: dumping to excel from /admin

2011-03-15 Thread Shawn Milochik
Find out which template you need to modify and where to put the code, then just use xlwt. It's on PyPI and I've used it quite a bit. Alternatively you can use csv.writer or csv.DictWriter, which can be natively opened in Excel and is still easily parsable by other tools. The complicated thing is

Re: Why is the first Manager defined in a model the default?

2011-03-14 Thread Shawn Milochik
I also have a copy of that book, and I believe that what you're referring to pages 197 and 198. Here is what the authors are doing there: 1. Creating a special manager that does one thing -- return a filtered subset of the model instances. 2. Creating a replacement 'objects' manager

Re: Django projects, apps, and git repos

2011-03-14 Thread Shawn Milochik
Think of your pluggable Django apps like they were any other Python module, such as your database driver, Django itself, South, Celery, or whatever. The easiest and cleanest way to do it is to package your pluggable apps so you can install them with pip or setuptools. If there's an update,

Re: Why is the first Manager defined in a model the default?

2011-03-14 Thread Shawn Milochik
I can't address the first question because it was probably discussed among the developers and was a design decision. As for the second, you don't *have to* create an 'objects' manager at all. If you do nothing, you get a Manager() for free by default, and because it has to be named *something*,

Re: Can I sort a related model reference in a template?

2011-03-12 Thread Shawn Milochik
You can put a sort order in the model's meta info. That way you'll always have a default sort. -- 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,

Re: using Django from cron

2011-03-10 Thread Shawn Milochik
import os os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' >From the docs: http://docs.djangoproject.com/en/dev/topics/settings/ Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Main Application's settings.py floating multiple systems

2011-03-07 Thread Shawn Milochik
I really need to pay attention to whom incoming e-mail is addressed. I thought I was continuing the thread on the list. Shawn -- 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.

Re: Main Application's settings.py floating multiple systems

2011-03-07 Thread Shawn Milochik
The easiest solution I've found: 1. Create a file named local_settings.py that is *outside* of version control. 2. Import local_settings at the bottom of settings.py, handling the exception if it doesn't exist. 3. Override anything you like in local_settings.py. This has these

Re: celery tasks and circular imports

2011-03-07 Thread Shawn Milochik
If there's a "correct" way to do this I'd love to hear it also. At present I do the model imports in tasks.py within the task that requires the model. This is because in my models.py I import tasks from tasks.py. Shawn -- You received this message because you are subscribed to the Google

Re: user profiles

2011-03-06 Thread Shawn Milochik
What have you read and what have you tried? When you tried those things, what errors or unexpected results did you get? Without that information nobody can help you. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: current recommendations for using email as username

2011-03-04 Thread Shawn Milochik
> > Email addresses have been allowed since version 1.2 < > http://docs.djangoproject.com/en/1.2/topics/auth/#api-reference >. > Have you found place in 1.2.x where an email address doesn't work? > > Toodle-lo.. > creecode The problem here is that the username is still limited

Re: current recommendations for using email as username

2011-03-04 Thread Shawn Milochik
What's wrong with writing your own auth backend? It's two piddly functions: http://dpaste.com/hold/473373/ Shawn -- 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

Re: sites framework + gunicorn

2011-03-02 Thread Shawn Milochik
What do you mean by 'gunicorn instance' here? > The idea is that in each gunicorn instance I set the > DJANGO_SETTINGS_MODULE to a different settings.py file, and hopefully > get the corrrect result. In any case, I highly recommend you just use supervisord[1] for this and put the path to the

Re: Using Django to white-label sites for multiple clients

2011-03-02 Thread Shawn Milochik
One option would be to just change the value of MEDIA_ROOT in settings.py. Or, if you're using 1.3 beta or above, STATIC_ROOT. You could do this by having multiple settings files -- one main one with anything that's common across all clients and one settings file for each client which imports the

Python/Django position in King of Prussia, PA, US

2011-02-28 Thread Shawn Milochik
Hi everyone. I thought I'd check in with my "home group" before I post this up on Dice. Any locals? Shawn Python/Django Developer Greenphire is a growing company in King of Prussia, PA. We are looking for a bright developer to join us in our quest for truth, justice, and the Pythonic way. We

Re: Number of Django powered sites?

2011-02-25 Thread Shawn Milochik
This will give you some info on Django in particular, but not comparisons to other frameworks: http://www.djangosites.org/stats/ Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Django Donations App

2011-02-25 Thread Shawn Milochik
So, what's your Django question? Shawn -- 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: Python/Django AMQP?

2011-02-24 Thread Shawn Milochik
+1 on Celery and django-celery. I use them both. -- 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: Is there an official Django forum besides this mailing list?

2011-02-23 Thread Shawn Milochik
There was just a large amount of conversation on this topic. People listed some great resources and discussed why things have evolved to happen the way they do: https://groups.google.com/d/msg/django-users/0dVLMCIYa94/a5IuaB9V_z4J -- You received this message because you are subscribed to the

Re: unittest problems

2011-02-23 Thread Shawn Milochik
I have an idea. Why don't you remove the middleware and see if the tests work? That might give you the answer. -- 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

Re: Unexpected result from making single object query

2011-02-22 Thread Shawn Milochik
What do the 'next' and 'prev' methods of your Entry model do? Shawn -- 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: I'm having problem showing from the value a sub-sub model.

2011-02-21 Thread Shawn Milochik
Why are you re-posting this? You posted it over the weekend. I replied. If my reply didn't help, tell us the new problem you're having. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Best way to deploy a project with custom compiled python 2.7 & virtualdev

2011-02-21 Thread Shawn Milochik
On Mon, Feb 21, 2011 at 9:00 AM, Jason Mayfield wrote: > You can't just copy your Python binary around (which is what you'd be doing > if you attempt to copy the virtualenv itself) unless the systems are exactly > the same (and even then I'd be reticent to do so).  Why not

Re: What will happen when a model I modified get saved.

2011-02-20 Thread Shawn Milochik
On Sun, Feb 20, 2011 at 5:33 PM, wrote: > Hey Shawn, > I have been opportuned to have south installed on my pc but I must confess I > have never understood its use. Now that its being mentioned in here, I think > I am going to get into it and understand its use. > Sent

Re: How to display value from a sub model in the template

2011-02-20 Thread Shawn Milochik
What are the related_name values you gave to the foreign key fields of your related models? -- 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: What will happen when a model I modified get saved.

2011-02-20 Thread Shawn Milochik
First, what are you trying to do? 1. The code you posted is not valid Python, because 'Object' is capitalized. So you haven't actually even tried this, or it would have blown up. 2. Adding 'y' to your subclass of Model does nothing with the database, because y is not a subclass of one of the

Re: stop caching json response

2011-02-20 Thread Shawn Milochik
A quick and dirty way is to append a timestamp to the URL so it's always unique. That way it won't be cached. Add "new Date().getTime()" to the end of the URL your AJAX call requests. Just have your url pattern accept and ignore the extra stuff. Shawn -- You received this message because you

Re: testing foo_set existence for each object in a queryset

2011-02-19 Thread Shawn Milochik
Not only is it not a stupid question, but it's one of the best possible types of questions. Any time someone comes in and makes it obvious that they've thought about their problem and made an attempt to solve it themselves, they get my respect. The easiest answer to your question is to make a

Re: South - when to start?

2011-02-19 Thread Shawn Milochik
On Sat, Feb 19, 2011 at 8:28 PM, Rainy wrote: > I was going to say the exact same thing. I can just add that anything > is fairly > easy with South - starting from the beginning, starting just before > 2nd > dev joins in, or even starting after other devs join. Wiping out

Re: Constant signing out on production server - Django 1.2.5

2011-02-19 Thread Shawn Milochik
Okay, it sounds like your problem is different. Mine only happened in IE, and not to all users, and not the same IE version. Just to some specific users, 100% of the time. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Constant signing out on production server - Django 1.2.5

2011-02-18 Thread Shawn Milochik
By chance, is the client running Windows and using IE? If so, is their system time incorrect? I've had major problems with session timeouts myself, and ended up handling session expiration in custom middleware because I never could figure it out, and over a period of months this list was no help

Re: Just going to point this out ...

2011-02-18 Thread Shawn Milochik
I also didn't see the part where they state that you shouldn't put your database login information in a template. That's probably because Django is designed to allow Web developers to do their jobs more easily, not allow people who don't know what they're doing make Web applications. If you're

Re: How to reinstall Python Interpreters?

2011-02-17 Thread Shawn Milochik
On 02/17/2011 07:48 PM, LJ wrote: I installed the latest version of dajaxice, but I am still getting Unresolved import errors. My guess is that I need to remove and reinstall the Python Interpreters. Is there a some documentation somewhere that explains how to reinstall the Python Interpreters,

Re: Displaying a table and make its columns sortable

2011-02-17 Thread Shawn Milochik
On Thu, Feb 17, 2011 at 4:44 PM, Arun K.Rajeevan wrote: > Show me the django way to do this. > The "Django" way to do this is to learn basic programming skills. You originally asked a mess of random questions which didn't have anything to do with Django. We answered

Re: Displaying a table and make its columns sortable

2011-02-17 Thread Shawn Milochik
This sounds like a good time to use jQuery. If all the data is being displayed at once anyway, then it'll be faster and easier to do the filtering and sorting client-side. Even if you're talking about a lot of data, things like the click-sorting of table columns should probably be done with

Re: Problems Adding Django South Tool

2011-02-17 Thread Shawn Milochik
On Thu, Feb 17, 2011 at 11:26 AM, hank23 wrote: > Ok I added the southtut app to my installed apps after creating its > folder, but now when I enter this command: > > python manage.py schemamigration southtut --initial > > I get this: > > Unknown command: 'schemamigration'

Re: Django custom field or widget?

2011-02-16 Thread Shawn Milochik
Sure. In your ModelForm instance's __init__, set that field's ".choices" 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

Re: How to select a random tuples from a database table and render them?

2011-02-16 Thread Shawn Milochik
QuestionBank.objects.filter(id__in = id_list) -- 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: Authentication Framework Question

2011-02-15 Thread Shawn Milochik
See the 'next' stuff: http://docs.djangoproject.com/en/1.2/topics/auth/ -- 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: trouble storing a manytomany field in a session variable

2011-02-14 Thread Shawn Milochik
On Mon, Feb 14, 2011 at 9:53 PM, Bobby Roberts wrote: > yeah i've got it where session ends on browser close so they will > refresh when they come back and log back in.  I'm just trying to find > an efficient way to store the values so that I don't have to query on > every

Re: trouble storing a manytomany field in a session variable

2011-02-14 Thread Shawn Milochik
Pickling will let you store objects as strings. However, perhaps you would like to use a memoize[1] decorator on your function. Are you trying to do this for performance reasons, because getting that relationship info from the database is slow? Regardless of why you're doing it, make sure you

Re: trouble storing a manytomany field in a session variable

2011-02-14 Thread Shawn Milochik
You can always use pickle to serialize something. What do you mean by a "many to many relationship," though? -- 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

Re: Django Mutlisite Setup

2011-02-13 Thread Shawn Milochik
It doesn't work that way with Django. You run each Django project on a different port, and your Web server (nginx, apache, whatever) forwards incoming traffic to the correct port. Your Python code (all Django is Python) should never be accessible via your Web server. Your Django app will run as a

Re: inline formset validation error

2011-02-13 Thread Shawn Milochik
You can iterate through the forms in your formset and call is_valid() (and optionally save()) on them based on your needs. Since your definition of "left blank" and "invalid" could vary based on what you're doing, it's better that you make those decisions explicit. If Django tried to decide for

Re: Override Method on DB get / filter / all

2011-02-13 Thread Shawn Milochik
You can make a custom manager. http://docs.djangoproject.com/en/dev/topics/db/managers/#custom-managers-and-model-inheritance You probably don't realize it from normal use, but the 'objects' property you're using on your models is an instance of models.Manager, not an internal part of the

Re: How to access a form attribute? (For HTML sanitization)

2011-02-12 Thread Shawn Milochik
You're welcome. What are you trying to do? Django cleans the user input to prevent SQL-injection attacks, and it also cleans it by default if you display it in a template. Why do you need this separate sanitization? Shawn -- You received this message because you are subscribed to the Google

Re: How to access a form attribute? (For HTML sanitization)

2011-02-12 Thread Shawn Milochik
What are you trying to do? If you just want access to the value passed in, try accessing form.cleaned_data['explanation']. The field objects are not directly accessible via form_name.field_name -- they're in form.fields, like form_name.fields['explanation']. Shawn -- You received this message

Google App Engine supports Django 1.2!

2011-02-11 Thread Shawn Milochik
http://code.google.com/p/googleappengine/wiki/SdkReleaseNotes Almost in time for Django 1.3's release. ;o) -- 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

Re: Need to combine 2 QuerySets without losing ability to order_by foreign key afterwards

2011-02-11 Thread Shawn Milochik
On Fri, Feb 11, 2011 at 4:15 PM, Tom Evans wrote: > > Have a read of this: > > http://www.secnetix.de/olli/Python/lambda_functions.hawk > That's funny -- I did a quick Google search and that's one I found also. I chose to give a quick sample instead of sending the link

Re: Need to combine 2 QuerySets without losing ability to order_by foreign key afterwards

2011-02-11 Thread Shawn Milochik
On Fri, Feb 11, 2011 at 4:06 PM, kyleduncan wrote: > I dont understand what the x is, but thank you so much for fixing this > for me in a matter of minutes! > You're welcome. The 'key' kwarg to the sort function expects a value. Instead of giving it a single value,

Re: Need to combine 2 QuerySets without losing ability to order_by foreign key afterwards

2011-02-11 Thread Shawn Milochik
On Fri, Feb 11, 2011 at 3:59 PM, kyleduncan wrote: > Thank you! Not sure how to work it just yet though. do I replace x > with user?  i tried this: > > results = results.sort(key=lambda x: x.last_login, reverse=True) > > and got an error  that the Profile object

Re: Need to combine 2 QuerySets without losing ability to order_by foreign key afterwards

2011-02-11 Thread Shawn Milochik
Something like this: key = lambda x: x.last_login -- 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: Django dynamic form with additional meta data

2011-02-11 Thread Shawn Milochik
You could be missing something, but I don't have enough to go on. Did you add the field to your template? What do your view and template 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

Re: Newbie problems with "get"

2011-02-11 Thread Shawn Milochik
Without testing it, I suspect the period in your 'request.GET' is the problem. Try replacing it with request_get and see what happens. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Newbie problems with "get"

2011-02-11 Thread Shawn Milochik
Would you post your urls.py? It looks like the problem is in there. -- 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: compiled regex as attribute

2011-02-11 Thread Shawn Milochik
You're forgetting the pickle part. That's what the getter and setter are for in my previous description. import re import pickle pattern = re.compile(r'^\w{3}\s+\d{3}') x = pickle.dumps(pattern) type(x) If you store 'x' in your database you won't have any difficulty with fixtures. Shawn --

Re: Templatetag - using date and join together?

2011-02-11 Thread Shawn Milochik
If you don't find a better solution, and you're going to need this feature frequently, you can always make a custom template tag. It's not too much work. http://docs.djangoproject.com/en/1.2/howto/custom-template-tags/ -- You received this message because you are subscribed to the Google Groups

Re: Help on displaying related-object details on ModelForm

2011-02-11 Thread Shawn Milochik
You can change the form's label to contain self.instance.promotion.description. -- 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: compiled regex as attribute

2011-02-11 Thread Shawn Milochik
The picklefield stores strings. So when you say "regexes can't be stored in fixtures," it implies that you're dealing with something other than strings at that point. Have you tried the pickle field? As I understand it, it's equivalent to this manual process: Create a normal text field.

Re: custom media just doesnt work

2011-02-11 Thread Shawn Milochik
The feature works -- you just don't understand it. You probably know what, but be aware that e-mailing a list and suggesting that their software is fundamentally broken is not the best way to get friendly help. Have a look at the docs for settings.py:

Re: Integrating existing soap based applications

2011-02-11 Thread Shawn Milochik
Start by searching Google for Django and SOAP. If you can't figure out what the prevailing solution is, name them specifically on this list and ask if anyone suggests one over the others. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: Stuck with foreign keys

2011-02-11 Thread Shawn Milochik
Enclose the name of the foreign key class in quotes. This way the file will validate. -- 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

Re: Django dynamic form with additional meta data

2011-02-11 Thread Shawn Milochik
This is pretty easy. Instead of thinking about making dynamic forms, think about making dynamic fields. You'll have one form. When you initialize it, you'll pass it information about the tickets available. In the __init__ of your form you will dynamically add field objects to the form by

Re: AW: Current user

2011-02-10 Thread Shawn Milochik
If you have the contrib.auth and session middleware installed (which you do by default) then that will be available in you views without any additional imports. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Current user

2011-02-10 Thread Shawn Milochik
Set the field value to request.user.id. -- 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: Best forum/group for Django Help

2011-02-09 Thread Shawn Milochik
On 02/09/2011 04:06 PM, SimpleDimple wrote: Guys, Need to know which is the best forum/group for Django help ? I thought this is the one but I don't see much activity here despite of the fact that there are 19000+ members...where do you go for discussing your django issues with people ? Is

Re: standalone server

2011-02-09 Thread Shawn Milochik
It sounds like you might be looking for Twisted instead of Django. http://twistedmatrix.com/trac/ Shawn -- 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

Re: auth_user

2011-02-09 Thread Shawn Milochik
This is how you store additional information about users if you're using the contrib.auth User. http://docs.djangoproject.com/en/1.2/topics/auth/#storing-additional-information-about-users Shawn -- You received this message because you are subscribed to the Google Groups "Django users"

<    2   3   4   5   6   7   8   9   10   11   >