Re: Basic Django Support

2011-05-15 Thread Shawn Milochik
Would you paste in your database settings from settings.py? -- 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.

Re: How to migrate user submitted data to new table upon approval

2011-05-15 Thread Shawn Milochik
If you want help you'll need to provide us information we can work with. What error message are you getting? Have you checked to see if the application generates any logs? What changed from when it was working until now? Was anything on the server removed or upgraded? If there's any documen

Re: flushing correctly the db

2011-05-15 Thread Shawn Milochik
On 05/15/2011 05:00 PM, manaus wrote: Hello, I had to change one of the models, did flush and syncdb, but still the view returns 'integrity error, myapp_user.town_id may not be NULL, the field seems to be still there. What can I do? (using sqlite3) Thanks! 1. syncdb doesn't do anything to exi

Re: how to list all model classes within admin that extends another model?

2011-05-15 Thread Shawn Milochik
Try this: http://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin -- 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

Re: django problem in creating server

2011-05-15 Thread Shawn Milochik
On 05/15/2011 08:16 PM, MOHAK R wrote: while creating a django server i am getting import receiver not found... i have followed all the installation process properly as mentioned in documentation. and my os is mac osx. Traceback or it didn't happen. ;o) -- You received this message because you

Re: Overide error messages in models

2011-05-15 Thread Shawn Milochik
On 05/15/2011 08:03 PM, Daniel França wrote: I don't know if I understood, but the example you posted is about forms, right? That's the point, I don't wanna need to write forms to modify error messages. Yeah, it looks like the link I posted was about forms. I got a bit turned around after look

Re: Custom Managers and Q() Objects

2011-05-16 Thread Shawn Milochik
On 05/16/2011 02:48 PM, Marc Aymerich wrote: Hi, my question is, How can I define a custom manager that can handle Q objects? Thanks! A custom manager, being a subclass of models.Manager, can already handle Q objects in the built-in methods, such as filter and get. What error are you getting?

Re: Set ModelMultipleChoiceField selected in clean()?

2011-05-16 Thread Shawn Milochik
Try putting logging statements at strategic points and see when your expectations aren't met. -- 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, se

Re: create a database

2011-05-18 Thread Shawn Milochik
Sure, you can do this. Just write a Python script that imports settings (it should be on your PYTHONPATH) and read the database config info, and do your thing. The Django settings file is just a Python script, and all the settings in it are just Python objects (dictionaries, tuples, etc.) -

Re: how transfer password hashes between old and new mysql databases for django app?

2011-05-18 Thread Shawn Milochik
Just copying them should work. The hashed password contains the hash type and salt, so it shouldn't make a difference. -- 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 uns

Re: currval of sequence "sample_id_seq" is not yet defined in this session

2011-05-18 Thread Shawn Milochik
You have three choices. 1. Use South. #1 recommendation by me. http://south.aeracode.org/ 2. Delete your entire database and do another syncdb. 3. Write SQL manually to fix your database (don't do this). The reason is that, once you do syncdb and a table is created, running syncdb will never

Re: currval of sequence "sample_id_seq" is not yet defined in this session

2011-05-18 Thread Shawn Milochik
Making manual changes to the database won't make a difference, as South just checks your Python models and not the database itself. In this case I'd set 'null = True, blank = True' in the model and run the migration. Then, if this really is a required field, then you should create a datamigr

Re: django deployment

2011-05-19 Thread Shawn Milochik
There are a lot of options for this. One way is as you described. Another would be to serve the images from another server entirely, like Amazon's S3. It depends on how you want to do it and what resources you have available. If you specifically want to know whether there are additional advan

Re: django deployment

2011-05-19 Thread Shawn Milochik
Eric, What I like about deploying with gunicorn is this: It only takes one line in an nginx config: proxy_pass http://127.0.0.1:9876; And you run it as simply as running the dev server: ./manage.py run_gunicorn 127.0.0.1:9876 That's it. You can deploy in production. No Apache config,

Re: learning Django after a break -- site tutorials, examples

2011-05-19 Thread Shawn Milochik
I don't think either of the things you're asking for samples of are related to Django. Do you have a specific Django-related question? If not, try w3schools for their tutorials on Web design. -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: Problem reversing urls when calling templates from another project

2011-05-20 Thread Shawn Milochik
Does this help? http://docs.djangoproject.com/en/1.3/topics/http/urls/#topics-http-reversing-url-namespaces I found it here (where a usage example is given): http://docs.djangoproject.com/en/1.3/ref/templates/builtins/#url -- You received this message because you are subscribed to the Google G

Re: Is there an HTML editor that's Django-aware

2011-05-20 Thread Shawn Milochik
+1 on Komodo Edit (I use the free one for almost all of my coding). I don't know exactly to what extent it handles Django template tags in HTML, but it's never tripped me up, which is something, anyway. Shawn -- You received this message because you are subscribed to the Google Groups "Djang

Re: multiple instances of form (with distinctive identifiction) on same page?

2011-05-20 Thread Shawn Milochik
http://docs.djangoproject.com/en/1.3/topics/forms/formsets/ There you go. -- 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-

Re: Is there an HTML editor that's Django-aware

2011-05-23 Thread Shawn Milochik
I also used TextMate for a couple of years then switched to Komodo Edit. I like it a lot more. Now I'm using Ubuntu full-time at home & work, so it's also nice to have a cross-platform tool as well. As someone mentioned last week, it's possible to write macros for Komodo in Python, which is ni

Re: Implement su (i.e. substitute user) in Django

2011-05-23 Thread Shawn Milochik
from django.contrib.auth import login (in view) login(request, user) -- 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-use

Re: Implement su (i.e. substitute user) in Django

2011-05-23 Thread Shawn Milochik
Before the login call: user.backend = 'django.contrib.auth.backends.ModelBackend' Sorry. I copied & pasted the previous and didn't think this part was necessary. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send ema

Re: Example uses of Celery

2011-05-24 Thread Shawn Milochik
We use Celery & RabbitMQ for the following: Scheduling SMS & e-mail for times in the future based on appointments. Making deposits on debit cards. Regularly-scheduled report e-mail notifications. Async e-mail & sms alerts to users when certain activity occurs. Compiling re

Re: Experiences with virtualenv + Django?

2011-05-24 Thread Shawn Milochik
1. You can compile Python 2.6 (or 2.7) in your home directory and use that to create your virtualenvs. 2. I do 100% of my Python work with virtualenv, and would never do otherwise. 3. It is not a nightmare AT ALL, and is wonderful. 4. With pip install, pip freeze, and pip install -r it's sup

Re: Experiences with virtualenv + Django?

2011-05-24 Thread Shawn Milochik
On 05/24/2011 09:53 AM, Brian Bouterse wrote: Python is embedded so deeply into operating systems these days that not using virtualenv is a bad idea. Here is what happened to me once: 1. I went to pip intall a python package without virtualenv 2. The installation failed leaving my python sys

Re: Logging SQL queries

2011-05-24 Thread Shawn Milochik
I recommend logging to a file. Here's a handler: 'django_log_file': { 'level': 'DEBUG', 'class': 'logging.handlers.RotatingFileHandler', 'filename': '/tmp/myproject_django.log', 'formatter': 'verbose', 'backupCount': 50,

Re: Experiences with virtualenv + Django?

2011-05-24 Thread Shawn Milochik
I create a folder called 'pyenv' in the root of my 'home' directory and put all of my virtualenvs there. I don't use the root user or the root home folder for anything, and you probably shouldn't either. If you're going to have multiple projects running on the same server, here's what I do.

Re: Dynamic Forms

2011-05-24 Thread Shawn Milochik
You can add fields dynamically in the __init__ of your form by processing the info passed in as the 'data' kwarg. Parse the info and just append fields to self.fields, something like this: self.fields['dynamic_field_' + field_num] = forms.CharField(max_length = 10) -- You received this

Re: CRUD Tutorial

2011-05-24 Thread Shawn Milochik
On 05/24/2011 02:38 PM, Mike Wisniewski wrote: Yup, that is correct. I'm starting to pull my hair out because I can't find a decent one. Most of them that I've seen either use the generic view or don't really go into explanation. There are also lots of tutorials, many of them use the admin inte

Re: Logging SQL queries

2011-05-24 Thread Shawn Milochik
On 05/24/2011 03:25 PM, candlerb wrote: Thank you. I tried this and it still didn't log my SQL queries. Then I went through the documentation again, and found that I should have configured "django.db.backends" instead of "django.db.backend". It's working now. Sorry for the noise - it would have

Re: How do you organize your deployment enviroment

2011-05-25 Thread Shawn Milochik
On 05/25/2011 01:22 PM, DrBloodmoney wrote: On Wed, May 25, 2011 at 9:31 AM, DK wrote: 100% south migration :) This. I know that they have said that they weren't going to be putting South into django (contrib?), but I wish they would. Most django devs should be using it. This isn't entirely

Re: Is there an HTML editor that's Django-aware

2011-05-26 Thread Shawn Milochik
On 05/26/2011 04:05 PM, AJ wrote: I'd like to know why people really like Vim if it is "a piece of shit" ? Just want to know because I try to learn it everytime and I hear great things about it. Ignore that comment. It's ignorant flame-bait. Don't drag that conversation on. Try anything

Re: OperationalError: no connection to the server using Django and gunicorn

2011-05-26 Thread Shawn Milochik
What's the command you're using to run it? Are you in screen? Are you using supervisor or anything like that? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe fr

Re: Django development with iPad as target platform?

2011-05-27 Thread Shawn Milochik
On 05/27/2011 10:21 AM, Thomas Weholt wrote: I just got my hands on an iPad and was wondering if anybody has done any django development where the iPad was the target platform/browser/client? Thanks in advance and expect some django-app aimed at ipad in the near future ;-). As someone who had a

Re: Seeking a Django 1.3 and syslog configuration example

2011-06-01 Thread Shawn Milochik
This should help out. It's for a file, not SysLogHandler, but the idea is the same. Just take any arguments you would normally pass to the handler if you were creating it programmatically and add them as keys to the dictionary: 'log_file': { 'level': 'DEBUG', '

Re: Question about using imports within functions/methods

2011-06-02 Thread Shawn Milochik
On 06/02/2011 11:09 AM, Cal Leeming [Simplicity Media Ltd] wrote: Pretty shameful that after almost 6 years of (fairly advanced) Python coding, I still finding myself not knowing some of the basic 101 stuff.. Slightly off topic but, does anyone else have that issue when coding? (i.e. doing re

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread Shawn Milochik
On 06/03/2011 04:16 PM, Amanjeev Sethi wrote: Linode looks nice plus it will teach me some administration side too. If I try using linode, what is the best setup (Linux Distro, web server support, modules like mod_wsgi? etc ) for Django websites on linode? Use whatever distro you like and

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread Shawn Milochik
On 06/03/2011 04:50 PM, AJ wrote: Well even if I do my Python stuff in virtualenv for development on a linode box, I'd like to know how to separate development/test environment to live/production. Is the only solution "/...//IP whitelisting to block only those who you want to have access.../"

Re: Django Development Environments

2011-06-05 Thread Shawn Milochik
On 06/05/2011 12:38 PM, Xavier Ordoquy wrote: For production: Ubuntu (10.x for now) buildout nginx + gunicorn stack Regards, Xavier. +1 for gunicorn & nginx -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: Making a login/create user interface

2011-06-06 Thread Shawn Milochik
Most of the info you need is here: https://docs.djangoproject.com/en/1.3/topics/auth/#authentication-in-web-requests If you get stuck understanding any specific points in the docs then let us know (be as descriptive as possible) and you'll probably get help. -- You received this message becau

Re: Users not logging out

2011-06-07 Thread Shawn Milochik
On 06/07/2011 09:20 AM, jayhalleaux wrote: I have the django auth system set correctly, my only problem is that is if the user does not use the logout and just closes the browser, they are still logged in. Any suggestions? Any suggestions for how to accomplish what? -- You received this messa

Re: Django daemon

2011-06-09 Thread Shawn Milochik
Here's one idea: When you retrieve the files from the remote server, put them in your local temp directory named with a datestamp. Then, just ensure you process them in order, and you won't have to worry about the out-of-order insertions. -- You received this message because you are subscr

Re: Django daemon

2011-06-09 Thread Shawn Milochik
On 06/09/2011 07:50 AM, Sherif Shehab Aldin wrote: Actually that's what am doing, am saving the files with timestamp, The question is, do I create a daemon to check the dir and process new files in order, and if that's the best practice, how do I use Django environment in the daemon so I can im

Re: Boolean field, unexpected behavior

2011-06-09 Thread Shawn Milochik
You have two problems: 1. You're assigning a string to a boolean. The string will evaluate to true. 2. You're not re-querying the database after the first save, so your 'm' instance still retains the string 'False.' Here's some sample output with commentary which will illustrate. #get an obj

Re: Boolean field, unexpected behavior

2011-06-09 Thread Shawn Milochik
On 06/09/2011 03:42 PM, elliot wrote: to my great annoyance, not specifying active has lead to the objects being created as I wanted. But I cannot rely on this. Seems like m.active is true if either true or false is specified, and is false if it is never initialized. See my previous e-mail. I

Re: Multiple UserProfile

2011-06-11 Thread Shawn Milochik
Just make your models for the customer and seller profiles, and attach them to users with a OneToOne field. You can only specify one to be used with User.get_profile(), but I've learned from discussions among core developers that get_profile() is something many consider useless. It's even been

Re: Multiple UserProfile

2011-06-11 Thread Shawn Milochik
Oops, correction: You'd use user.seller_profile and user.customer_profile if you've set it up as a OneToOneField -- the get() is unnecessary (and won't work). You'd use get() if you used a ForeignKey with unique = True, but that's silly because a OneToOneField does exactly that but more explici

Re: views without forms

2011-06-13 Thread Shawn Milochik
Kenneth, I think your impressions are sound. It is definitely possible (even easy) to use Django forms and modelforms with AJAX. Any system which does validation client-side only is deeply flawed. Shawn -- You received this message because you are subscribed to the Google Groups "Django use

GET vs POST for read-only views

2011-06-13 Thread Shawn Milochik
Is there a consensus in the community that GET should be used for requests that don't write to the database? As a specific example, let's say there's a report form that allows a user to select a start and end date, and maybe some other search fields. What would you use for this, and why? I use PO

Re: How to create a single data view from multiple data sources

2011-06-14 Thread Shawn Milochik
On 06/14/2011 10:42 AM, rohan wrote: I have two tables in my database with one common field. Is it possible to write a web app to create views using django? Any help would be greatly appreciated. Thank you Yes, it is. Do the tutorial and then re-do it using your own data. https://docs.djan

Re: How to catch and log exceptions?

2011-06-14 Thread Shawn Milochik
Yes, you can access the traceback from the middleware. Just call logger.exception() instead of something like logger.debug() and you'll get the output in your log. Here's my middleware: import logging logger = logging.getLogger(__name__) class RequestExceptionMiddleware(object): """

Re: How to create a single data view from multiple data sources

2011-06-14 Thread Shawn Milochik
On 06/14/2011 12:20 PM, rohan wrote: Can you please be a bit more specific? The link you provided is for Django tutorials. It would be great if you could guide me to the specific page. Try searching Google. You'll probably get the answer faster. If you can ask a more specific question about h

Re: How do I link one template with another template ?

2011-06-15 Thread Shawn Milochik
Use a named URL, then the {% url %} template tag. https://docs.djangoproject.com/en/1.3/topics/http/urls/#naming-url-patterns See the example and explanation in the docs. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, s

Re: How do I link one template with another template ?

2011-06-15 Thread Shawn Milochik
On 06/15/2011 05:48 PM, Satyajit Sarangi wrote: Can you show it in an html tag ? As in in a template , on click of the url Thanks for the help Sure. Example from docs: {% url arch-summary 1945 %} In an HTML tag: Summary for 1945 -- You received this message because you are subscribed

Re: Single auth database for multiple (different) django projects

2011-06-16 Thread Shawn Milochik
How about Celery & RabbitMQ? Use Django's signaling functionality to kick off a Celery task, use Celery to make it async and nearly real-time, then transfer the info securely. I recommend *not* allowing the data to be serialized in the RabbitMQ message (for security & performance), but rathe

Re: IOError

2011-06-16 Thread Shawn Milochik
On 06/16/2011 03:00 PM, vivek kumar bagaria wrote: IOError at /search/ The path to your Whoosh index 'search/engine' is not writable for the current user/group" it will be very helpful if you could help me regarding this error thanks in advance This is not a Django issue but a Linux/UNIX

Re: Newbie questions about models / databases

2011-06-16 Thread Shawn Milochik
On 06/16/2011 02:26 PM, Dan Stromberg wrote: 1. How does syncdb decide what to write to the sqlite file, and what not to? Does it only write info for a given application once? 2. If I set up a model, syncdb it, change the model, and syncdb again - will any changes be seen in

Re: How do I access a field's verbose_name?

2011-06-20 Thread Shawn Milochik
On 06/20/2011 11:54 AM, Jeff Blaine wrote: I'd like to make use of a field's verbose_name in some code instead of duplicating that sort of info. Can someone show me how? your_object._meta.verbose_name Check out _meta in manage.py shell -- lots of good stuff in there. -- You received this me

Re: How do I access a field's verbose_name?

2011-06-20 Thread Shawn Milochik
On 06/20/2011 01:36 PM, Jeff Blaine wrote: On Monday, June 20, 2011 11:56:00 AM UTC-4, Shawn Milochik wrote: On 06/20/2011 11:54 AM, Jeff Blaine wrote: > I'd like to make use of a field's verbose_name in some code instead of > duplicating that sort of info. Can

Possible bug in form validation

2011-06-20 Thread Shawn Milochik
I know that, whenever someone finds a "bug" in Django they're usually doing something incorrectly. Hopefully someone will point out what I need to do to make this work. However, this is looking like a legitimate bug to me. http://dpaste.com/hold/556603/ Environment: Django: (1, 3, 0, 'fin

Re: Social Networking basics? -Raj

2011-06-20 Thread Shawn Milochik
Is it just me or are we having a sudden spurt of e-mail that goes like this: Q: How do I A: You do X. Q: How do I do X? A: You use Y. Q: How do I use Y? I'm convinced that these people are either trolls or inherently "un-helpable," unless you want to write their code for

Re: Dynamic Models for CSV Importing

2011-06-20 Thread Shawn Milochik
I don't see where Django comes in -- at least not for the core of the app. Python certainly, with the xlwt and xlrd modules being incredibly helpful. Secondly, I'd use MongoDB (via pymongo) to store the temporary data, because I wouldn't bet a nickel that you'll get data in a consistent forma

Re: Possible bug in form validation

2011-06-21 Thread Shawn Milochik
On 06/21/2011 12:17 AM, Ian Clelland wrote: On Mon, Jun 20, 2011 at 1:49 PM, Shawn Milochik <mailto:sh...@milochik.com>> wrote: I know that, whenever someone finds a "bug" in Django they're usually doing something incorrectly. Hopefully someone will point

Re: how to display form data with original values after validation failure?

2011-06-21 Thread Shawn Milochik
One good way is to just use AJAX: If it's a 'get' request, return your rendered template as normal. If it's a 'post' request, return a JSON response that has a success/failure status and confirmation/error messages (form.errors.as_text()). I'm doing this using jquery-notify to tell the user th

Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Shawn Milochik
Cal, That sounds awesome. I wish you could present it at DjangoCon US too. :o/ 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 set up user profile in django-registration ?

2011-06-22 Thread Shawn Milochik
On 06/22/2011 11:21 AM, Satyajit Sarangi wrote: These are my steps . 1. Not using django-profile 2. Create my own view to show the profile by using user.get_profile() 3. Created my own view and also a model in django-registration to view the profile . 4 . Did changes to urls.py url(r'^profile/

Re: how to set up user profile in django-registration ?

2011-06-22 Thread Shawn Milochik
On 06/22/2011 11:25 AM, Satyajit Sarangi wrote: Traceback: 60. url(r'^profile/$',UserProfile,name='UserProfile'), Exception Type: NameError at /accounts/profile/ Exception Value: name 'UserProfile' is not defined It appears that you have a view named UserProfile in

Re: django page loads forever

2011-06-22 Thread Shawn Milochik
On 06/22/2011 11:26 AM, jay K. wrote: Hello, everyone I have a django page which loads indefinitely some of the javascript that is supposed to come up does not appear on the screen (while the page is still loading), but i checked with firebugs and there are no error messages at all any advice

Re: how to set up user profile in django-registration ?

2011-06-22 Thread Shawn Milochik
On 06/22/2011 11:41 AM, Satyajit Sarangi wrote: Now I get a database error relation "registration_userprofile" does not exist LINE 1: ..."."id", "registration_userprofile"."user_id" FROM "registrat... That looks like a migration/syncdb issue. Either you added a field to an already-synced mod

Re: django page loads forever

2011-06-23 Thread Shawn Milochik
On 06/23/2011 05:05 AM, Nikhil Somaru wrote: for a quick fix you could also import pdb pdb.set_trace() that will drop a shell in your "runserver" window and let you explore the value of variables in the context +1 on pdb http://www.doughellmann.com/PyMOTW/pdb/ -- You received this messa

Re: create_inactive_user() got an unexpected keyword argument 'profile_callback' Error in django registration . What can be the error ?

2011-06-23 Thread Shawn Milochik
It looks like you added an extra kwarg named profile_callback to a function call to use in your overridden version, then passed *kwargs on to the original version. Before you call the super() version you have to pop off your kwarg because it is an invalid parameter for the original version.

Re: Social Networking basics? -Raj

2011-06-23 Thread Shawn Milochik
On 06/23/2011 12:36 PM, Cal Leeming [Simplicity Media Ltd] wrote: The perfect link to refer these users to: http://www.catb.org/~esr/faqs/smart-questions.html (props to harryr for finding this) Yeah. I used to post that link pretty fre

Re: Importing file to Models - Temporary store to allow confirming?

2011-06-26 Thread Shawn Milochik
If you're using Django 1.2 or higher you can take advantage of the multi-database support by adding the 'using' kwarg to your model.save(). This will allow you to ensure that the model saves successfully (is valid) in the 'holding' database, and move it to your 'live' database later. You could

Re: Serving static/dynamic files under same suburl

2011-06-27 Thread Shawn Milochik
This can (and probably should) be handled by your Web server. For example, in nginx you may be serving the Django app with something like this: location / { proxy_pass http://127.0.0.1:8400; } And for static content nginx may direct the request elsewhere. This example directs

Re: Importing file to Models - Temporary store to allow confirming?

2011-06-28 Thread Shawn Milochik
On 06/28/2011 02:43 AM, Victor Hooi wrote: Shawn, Thanks for the quick reply =). If we go with the third approach, what advantages are there to persisting the models in MongoDB (or something similar like Redid.or Cassandra), as opposed to a traditional RDBMS? (I just want to get a good hand

Re: Implementing a User Search Feature

2011-06-30 Thread Shawn Milochik
On 06/30/2011 02:23 PM, raj wrote: Tried googling but couldn't come up with much. How do I implement a User Search feature? Where an individual can type in the first and/or last name of user and come up with results? I saw some things about how to search through a site, but I think this is a litt

Re: Django AJAX polling: Best practice?

2011-06-30 Thread Shawn Milochik
This isn't a job for AJAX -- it's a job for Comet, which is tailor-made for your exact needs. Check out Hookbox. Here's a tutorial which can definitely get you started. I was able to learn enough from it to get a small sample working. http://charlesleifer.com/blog/writing-a-real-time-chat-app-

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

2011-06-30 Thread Shawn Milochik
On 06/30/2011 04:33 PM, Cal Leeming [Simplicity Media Ltd] wrote: Spawned a new thread for this, as the old one was getting rather off topic. KG had created a new wiki page to start putting some ideas into, of which people have been contributing to: https://code.djangoproject.com/wiki/UsingTh

Re: Django AJAX polling: Best practice?

2011-07-02 Thread Shawn Milochik
On 07/01/2011 05:05 PM, Andreas Pfrengle wrote: Thanks so far for showing me that I was on the completely wrong track ;-) I found that there is really not much official information available about Hookbox:. That doesn't make an easy decision for Hookbox. Has anyone experienc

Re: Dynamic Form Fields in Django using JavaScript

2011-07-03 Thread Shawn Milochik
As long as, when you instantiate your Django forms.Form instance when the HTML form is posted, you create the fields passed in the form data and instantiate the fields to match you should be fine. Just go ahead and do it, and if you run into any snags post to the forum. Shawn -- You received

Re: Dreamhost Virtualenv Question

2011-07-05 Thread Shawn Milochik
On Tue, Jul 5, 2011 at 2:10 PM, Jeremy wrote: > Hello, I'm completely new to Django and the concept of virtualenv. > I'm trying to set up a web site and add in third party applications > such as the zinnia blogging app, but having some issues.  I believe > that I've set up the virtualenv correctly

Re: Help-Multiple Databases

2011-07-05 Thread Shawn Milochik
On Tue, Jul 5, 2011 at 2:57 PM, Lycan wrote: > Hello, > I am kind of new to Django and am trying to understand multi-db. Does > anyone know where i can download a complete working example of django > project implementing multi-db? > > Thanks > Check github and bitbucket. You can search by keyword

Re: ImportError: No module named sh_csv_importer

2011-07-06 Thread Shawn Milochik
If you can't find it then search the server where the application is/was running. It's likely a module that the previous developer wrote themselves. It's even possible that you have it already in the codebase, but that you'll have to edit your PYTHONPATH setting so Python will import it. If all el

Re: Django vs Sproutcore

2011-07-06 Thread Shawn Milochik
I think that if your app needs to have data then you need server-side validation. My limited understanding of Sproutcore is that it isn't an alternative to a Web framework, but more a way to create pretty front ends for your Web applications. So instead of writing a lot of jQuery and AJAX and thi

Re: Some thoughts on a package/stack compile system for easy distribution of webapps..

2011-07-06 Thread Shawn Milochik
It definitely sounds interesting. I'd like to hear more about it as it develops. The only quibble I'd add is to not limit it to Ubuntu. I use and love Ubuntu, but I suspect that a lot of people who would want the ability to obfuscate code and deploy easily to client servers would be using RHEL or C

Re: Any Polling/Survey Examples?

2011-07-07 Thread Shawn Milochik
Hi Gagiel, I'm happy that you're getting interested in Django. You'll find a lot of smart people here willing to help you out as you get started, but it would help us a lot if you customize your approach to the list a bit to help us help you. Please check this out: https://code.djangoproject.com/

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

2011-07-07 Thread Shawn Milochik
On Thu, Jul 7, 2011 at 10:41 AM, Kevin Monceaux wrote: > On Wed, Jul 06, 2011 at 08:38:42PM -0300, Andre Terra wrote: > >> If we could move the questions to a specific site, everyone would >> benefit. > > Not everyone.  I much prefer mailing lists to any of the other options > mentioned.  With a t

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

2011-07-07 Thread Shawn Milochik
On 07/07/2011 11:12 AM, Andre Terra wrote: So basically, if SO emailed you new questions tagged as 'django' and your replies were posted as answers, you would be okay? Cheers, André I think my answer to that is 'yes.' It might be even better that way, because of the ability to vote questions

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

2011-07-07 Thread Shawn Milochik
On 07/07/2011 11:21 AM, Kevin Monceaux wrote: On Thu, Jul 07, 2011 at 10:46:47AM -0400, Shawn Milochik wrote: If I even filter a mailing list so it doesn't go into my inbox I end up falling behind and deleting all the messages unread. The only way I actively participate in this list is be

Re: KeyError in UnitTests

2011-07-07 Thread Shawn Milochik
If you want to mess with 'country' then you write a clean_country(self) function. If you want to mess with 'document' you write a clean_document(self) function. If you want to do something with one and be sure the other is also available, you write a clean(self) function, which executes after

Re: KeyError in UnitTests

2011-07-07 Thread Shawn Milochik
You should be able to use pdb and then examine variables in scope. Aren't you getting a pdb prompt? Are you redirecting your output? You can also using logging and put a bunch of debug statements in to narrow down where the problem lies. If you can make a bare-bones copy of your app that dupl

Re: KeyError in UnitTests

2011-07-07 Thread Shawn Milochik
On 07/07/2011 10:44 PM, Daniel França wrote: I changed the test runner to default and the error message is a lot more clear. I got a DatabaseError: no such table: cadastroav_country but this should be created by tests, right? I'm using South, maybe it's a problem? The problem could be with y

Re: KeyError in UnitTests

2011-07-07 Thread Shawn Milochik
Could it be because the test is passing 'Brasil' instead of 'BR'? I'm assuming 'BR' is a valid choice and 'Brasil' is invalid. That's why you're passing 'PR' instead of 'Paraná' in your data dictionary. If the field isn't a required field, then your form.is_valid() would be true, but there wou

Re: User based objects

2011-07-08 Thread Shawn Milochik
You can certainly pass request.user to the form from your view. -- 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+unsub

Re: User based objects

2011-07-08 Thread Shawn Milochik
On Fri, Jul 8, 2011 at 10:28 AM, Praveen Krishna R wrote: > Thank you, Shawn, I didn't knew that! I'm trying on that way now! > You're welcome. The one 'gotcha' is that you're going to have to remove the user from the kwargs before you call the __init__ of the superclass. Otherwise you'll get an

Re: Manytoone Form

2011-07-08 Thread Shawn Milochik
Add the field in your ModelForm, just as you would with a form. You're allowed to do that. Override the __init__ of your ModelForm subclass and populate the choices. Override the clean and clean_field functions (if necessary). Override the save() to populate the field in the other model from you

Re: Using Jinja2

2011-07-08 Thread Shawn Milochik
Did you guys know that Armin Ronacher (the author of Jinja2) is actively working on this for Google Summer of Code? https://www.djangoproject.com/weblog/2011/apr/25/gsoc/ If you're interested in the development of Django it's very informative to subscribe to django-developers and lurk. You can

throttling login attempts to avoid brute force attacks

2011-07-08 Thread Shawn Milochik
This topic came up on the list a few months back, and I just wanted to share the solution I've put into place. Short version: 1. Ensure that my Web server (nginx) passes the user's real IP address in the request. 2. For POST requests to the login URL only (to avoid any performance side-effe

Re: throttling login attempts to avoid brute force attacks

2011-07-08 Thread Shawn Milochik
I'm not familiar with shm, so I can't answer that. I don't share the in-memory db with anything else; we have a very small user-base for our commercial application, and only need one Django instance. If I wanted to trigger other activity based on this I'd probably use ZeroMQ. Sorry I can't be mor

Re: throttling login attempts to avoid brute force attacks

2011-07-08 Thread Shawn Milochik
On Fri, Jul 8, 2011 at 12:32 PM, Cal Leeming [Simplicity Media Ltd] wrote: > > > Have you considered using an atomic caching server for storing the state of > an IPs 'throttle' count? > It has the added benefit of giving you future support for distributed use, > wouldn't be as performance heavy as

Re: throttling login attempts to avoid brute force attacks

2011-07-08 Thread Shawn Milochik
On 07/08/2011 12:53 PM, Jacob Kaplan-Moss wrote: Hi folks -- Also see http://simonwillison.net/2009/Jan/7/ratelimitcache/ for a discussion of a similar technique built on top of memcached. Jacob Thanks for that link. There's some really good stuff in the comments. I'm seriously considering

<    4   5   6   7   8   9   10   11   12   13   >