Re: first steps with django

2013-03-24 Thread Shawn Milochik
You should develop locally, because you are guaranteed to make mistakes that will crash the app and expose debug information you don't want exposed during development. If your hosting provider provides a one-click installation, it will probably set up its environment different than the one on

Re: Python inside Django

2013-03-23 Thread Shawn Milochik
You can completely eliminate Django from your thinking about the problem. This is a pure Python question. A Python file being within a Django project changes nothing about how Python imports code. Either you're importing something on your Python path or you're doing a relative import. If your

Andrew Godwin to add native migrations to Django's core

2013-03-22 Thread Shawn Milochik
http://www.kickstarter.com/projects/andrewgodwin/schema-migrations-for-django I've been using South for a long time and have met Andrew a few times. He's a genuinely nice guy and has put years of free work into open-source software. I encourage anyone who appreciates his work to throw in a few

Re: PostgresSQL or MySql with django?

2013-03-21 Thread Shawn Milochik
On Thu, Mar 21, 2013 at 3:44 PM, Lachlan Musicman wrote: > Frocco, > > No, he's saying you can have two databases set up at the same time. > You can have X databases (I presume). > > Cheers > L. > > On 22 March 2013 01:13, frocco wrote: >> Hi Alan, >> >> so

Re: Authentication with Email

2013-03-19 Thread Shawn Milochik
Your timing is just about perfect. Django 1.5 was just released, with a customizable user model. So use that. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: PostgresSQL or MySql with django?

2013-03-18 Thread Shawn Milochik
Postgres. Just from conversations I've seen in the community, MySQL has a thousand edge-cases which cause problems. From previous conversations on thsi topic, I think more people use Postgres. -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Session values (occasionally) not being persisted

2013-03-18 Thread Shawn Milochik
Do you have SESSION_SAVE_EVERY_REQUEST enabled? https://docs.djangoproject.com/en/1.4/topics/http/sessions/#session-save-every-request -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails

Re: Problems install/download Django 1.5

2013-03-16 Thread Shawn Milochik
On Sat, Mar 16, 2013 at 9:25 AM, wrote: > Secondly, python 2.7 being "highly recommended" for Dj 1.5 can not be used > in debian stable. > Installing a virtualenv again undermines package management control. Using virtualenv does not undermine package management and is the

Re: plugin for selecting files

2013-03-14 Thread Shawn Milochik
On Thu, Mar 14, 2013 at 6:03 PM, Larry Martell wrote: > > I have been googing this for 2 days and trying lots of different > things, without success. I really appreciate your help - I've made > more progress in the last hour when in the previous 48. Glad I could help,

Re: plugin for selecting files

2013-03-14 Thread Shawn Milochik
You can certainly upload a file, then parse it or whatever. I'm just saying you can't just grab a directory listing from the user. To upload multiple files, you may be able to just add "multiple" to your file upload element. A quick Google search found this:

Re: plugin for selecting files

2013-03-14 Thread Shawn Milochik
On Thu, Mar 14, 2013 at 4:54 PM, Larry Martell <larry.mart...@gmail.com> wrote: > On Thu, Mar 14, 2013 at 3:43 PM, Shawn Milochik <sh...@milochik.com> wrote: >> If you have an HTML file input field in your template you get one >> automatically from your browser.

Re: Can anyone give me a suggestion or a recommendation as to how I can access the current user's username in the models.py?

2013-03-14 Thread Shawn Milochik
bviously, because you can not rewrite every third-party app to support this (among other reasons). There was a good tutorial for using threadlocals on the official Django wiki but someone deleted it in a fit of spite a few years ago. If you search for "audit user shawn milochik" in this Google Gro

Re: Problems install/download Django 1.5

2013-03-14 Thread Shawn Milochik
On Thu, Mar 14, 2013 at 3:51 PM, wrote: > Sorry can't find a message from you in this newsgroup with any virtualinv > instructions. > https://groups.google.com/d/msg/django-users/aRfuUHY21CU/L9UukI7CmxoJ -- You received this message because you are subscribed to the Google

Re: plugin for selecting files

2013-03-14 Thread Shawn Milochik
If you have an HTML file input field in your template you get one automatically from your browser. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: Profiling django apps using Python 3? No hotspot module.

2013-03-14 Thread Shawn Milochik
I use this and it's great. I haven't tried it with Python 3, but it's all standard library stuff. I tweaked mine a bit so it dumps the profile files to my temp folder instead of the way it works by default. That's because I wanted to profile AJAX calls, keep multiple runs for the same sites for

Re: Problems install/download Django 1.5

2013-03-14 Thread Shawn Milochik
Check out the post I made on this forum about five minutes ago. I put in pretty detailed virtualenv instructions. That should be all you need to get going. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

Re: Novice 101 here

2013-03-14 Thread Shawn Milochik
Download virtualenv and create a virtualenv by manually typing the path to your Python 2.7 executable. Something like this (path will probably be different on your Mac, type "which python2.7" to find it: /usr/bin/python2.7 virtualenv.py /home/user/my_virtualenv Then activate your virtualenv:

Re: How can my JQuery Sliderbar pass a value to the Veiw and cause the View to execute?

2013-03-13 Thread Shawn Milochik
I'm guessing that the POST vs. GET issue was due to a missing CSRF token. I'm glad you got it working, though. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: Problems install/download Django 1.5

2013-03-13 Thread Shawn Milochik
On Wed, Mar 13, 2013 at 12:55 PM, wrote: > Okay - now I directly get server errors, so the Django error handler is > passed by... > It helps if you post the errors. -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Problems install/download Django 1.5

2013-03-13 Thread Shawn Milochik
Delete all your .pyc files in your virtualenv. find /path/to/virtualenv -name '*.pyc' -exec rm -f {} \; If that doesn't fix it, manually delete all Django folders from your virtualenv. Go to the "lib/python2.7/site-packages/" folder in your virtualenv and look around. -- You received

Re: Installing current Django on current Debian with current Python

2013-03-13 Thread Shawn Milochik
On Wed, Mar 13, 2013 at 6:08 AM, wrote: > > Question remains how to get current releases of Debian, Python and Django > running together. > As I said in the earlier e-mail, use virtualenv: https://pypi.python.org/pypi/virtualenv -- You received this message because you are

Re: Problems install/download Django 1.5

2013-03-12 Thread Shawn Milochik
You can just download the tarball and "pip install filename." -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post

Re: Installing current Django on current Debian with current Python

2013-03-12 Thread Shawn Milochik
The best solution is to use a virtualenv. The decision to purge Python2.6 was a very, very bad one. You should never mess with the version Python that comes with your OS. Lots of software on the system relies on it. You could try to use aptitude to restore it. Hopefully that will work.

Re: MultipleFileField

2013-03-10 Thread Shawn Milochik
https://docs.djangoproject.com/en/1.5/topics/forms/modelforms/#inline-formsets -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: Template inheritance

2013-03-09 Thread Shawn Milochik
If the refresh is the only thing in your "extrahead" block, then just don't add block.super to extrahead in your change form, and you can eliminate the "if" statement from it in your base template. -- You received this message because you are subscribed to the Google Groups "Django users"

Re: How can my JQuery Sliderbar pass a value to the Veiw and cause the View to execute?

2013-03-08 Thread Shawn Milochik
You'll need to attach something to the "change" event of your slider to execute a JavaScript function. The function would contain something like this: // $.ajax({ // url: your_url, // cache: 'false', // success:

Re: how to automatically create userprofile when user is created from admin

2013-03-08 Thread Shawn Milochik
Yes. Use a post-save signal. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to

Re: How can my JQuery Sliderbar pass a value to the Veiw and cause the View to execute?

2013-03-08 Thread Shawn Milochik
I think we've come all the way around to where my response is now appropriate. :o) https://groups.google.com/d/msg/django-users/kB27nmftPng/btPKtxvoumYJ Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and

Re: RSS combinator

2013-03-07 Thread Shawn Milochik
I doubt there's a Django app for that -- it's not a problem for a Web framework. You may be able to find a project that does this on Github or Bitbucket. RSS feeds are just XML files. You need something that will parse the XML from multiple files, then re-write one XML file containing the items

Re: I screwed up my django site using touch

2013-03-07 Thread Shawn Milochik
On Thu, Mar 7, 2013 at 10:38 AM, frocco wrote: > Thanks you, I think I will only use Pycharm now to help prevent this issue > again. > I hope future versions will offer better trace. Even better, use version control, such as git. Then your editor will be irrelevant and it

Re: Changing SECRET_KEY for a project that was already launched

2013-03-06 Thread Shawn Milochik
Are you using it as the key for any encrypted fields, or anything other than the built-in stuff Django does with session cookies? If not, I don't think you'll have a problem. Of course, back up your database first as a precaution, and use version control on your code so you can revert if

Re: Setting Django to not quote table names

2013-03-05 Thread Shawn Milochik
On Tue, Mar 5, 2013 at 5:41 PM, Johan ter Beest wrote: > Not an Oracle expert at all but maybe this SO answer explains some things?: > > http://stackoverflow.com/questions/563090/oracle-what-exactly-do-quotation-marks-around-the-table-name-do > So if it's down to

Re: Setting Django to not quote table names

2013-03-05 Thread Shawn Milochik
This works for me in Postgres as well. This script: from django.contrib.auth.models import User qs = User.objects.filter(username='smilochik') print qs.query.sql_with_params() returns this output: ('SELECT "auth_user"."id", "auth_user"."username", "auth_user"."first_name",

Re: Setting Django to not quote table names

2013-03-05 Thread Shawn Milochik
I'm taking a look at this as someone pretty unfamiliar with the ORM. Hopefully someone more knowledgeable will jump in. However, in the meantime (if you're feeling adventurous), you could look in django/db/backends/oracle/base.py and have a look at function quote_name. A naive look at it makes me

Re: Extending the base file depending on User type

2013-03-05 Thread Shawn Milochik
Instead of extends, you could use the "include" directive. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to

Re: Django admin - Insert into another table

2013-03-05 Thread Shawn Milochik
Sure. Just use the post-save signal: https://docs.djangoproject.com/en/1.5/ref/signals/#post-save -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: django DB optimization

2013-03-04 Thread Shawn Milochik
Rule #1: Measure first. Don't add any complexity to fix any bottlenecks until you know for a fact where they are. Once you know where one is, the solution will probably be fairly obvious. Caching, denormalization, etc. Come up with a way to stress-test your app and add measurements. -- You

Re: I need to play a wav file

2013-03-04 Thread Shawn Milochik
On Mon, Mar 4, 2013 at 3:35 PM, frocco wrote: > ok, I was thinking it was a python code thing. > No, you can't execute arbitrary Python code on the user's machine. People were playing wav files (hampster dance, anyone?) many years ago in HTML.

Re: I need to play a wav file

2013-03-04 Thread Shawn Milochik
This has nothing to do with Django. It's an HTML or maybe a JavaScript thing. Just do a Google search. Unless you're going to dynamically generate the WAV file and need help streaming it, I don't think list this is the best resource. -- You received this message because you are subscribed to

Re: Is there a way to list users that have logged in within the pass 30 minutes

2013-03-04 Thread Shawn Milochik
No, because that will just invalidate the cookie so that they'll have to log in again when they reopen their browser. It doesn't magically notify your Django app that the browser closed. -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Is there a way to list users that have logged in within the pass 30 minutes

2013-03-04 Thread Shawn Milochik
On Mon, Mar 4, 2013 at 2:05 PM, frocco wrote: > So are you saying the best I can do is show users that logged in xx minutes > ago, even through they may have logged off? Actually, yes. Because most users never log out. They just close their browsers. So even if you did look at

Re: How to pass a value from a Django View to a JQuery Slider bar.

2013-03-04 Thread Shawn Milochik
Probably consume the view with AJAX, doing a POST on the change event of the slider. http://api.jquery.com/category/ajax/ Put your result in a dictionary within your view and return it as JSON: return HttpResponse(json.dumps(result), mimetype="application/json") -- You received this message

Re: Is there a way to list users that have logged in within the pass 30 minutes

2013-03-04 Thread Shawn Milochik
On Mon, Mar 4, 2013 at 1:02 PM, frocco wrote: > ok, do you have a better idea on how I might do this? > user is used to seeing this from a PHP site that I am porting. > I use this at the shell sometimes: from django.contrib.auth.models import User for user in

Re: Django + Raspberry PI

2013-03-01 Thread Shawn Milochik
Yep, I got my full development environment for one of my company's applications running on it with almost no problem. The one exception was MongoDB, which is for x86 only, so I had to compile a fork, which took about 10 hours on the Pi. It was definitely pretty slow, but it works. Our stack

Re: Use variable in my template?

2013-02-28 Thread Shawn Milochik
On Thu, Feb 28, 2013 at 11:30 AM, Maria wrote: > Can you tell me where exactly to insert that Variable? Have a look at this page in the tutorial: https://docs.djangoproject.com/en/1.5/intro/tutorial03/ See how a variable in the view is added to the context? Exactly like

Re: Best practices for 1.5 configurable user model and profiles

2013-02-27 Thread Shawn Milochik
On Wed, Feb 27, 2013 at 12:46 PM, Doug wrote: > Thanks Shawn. So what is your take? Only authentication data in User? > Separate Profile model and app? I think Russell hit the main points well. Make User only what it needs to be for identification/authentication, and put other

Re: Best practices for 1.5 configurable user model and profiles

2013-02-27 Thread Shawn Milochik
Do a search on the history of the django-developers mailing list. There are many reasons, and they were discussed for literally years. Some of the main ones that come to mind: first_name/last_name is US-centric. e-mail address field length was too short. e-mail address could not be used as the

Re: ANNOUNCE: Django 1.5 released

2013-02-27 Thread Shawn Milochik
Ahh, the release of a new version of Django. Always a fantastic time to support the Django Software Foundation: https://www.djangoproject.com/foundation/donate/ The money goes to support sprints and other things -- see the donate page for more details. -- You received this message because you

Re: I need a form that allows users to select from a list of choices, or add a new choice.

2013-02-27 Thread Shawn Milochik
Remember, it's just Python. In the end, all you need is for the 'choices' of the field (which is just an iterable) to contain the value after the form's __init__ so that the form won't consider the value invalid. You could: 1. Have a pop-up form that allows the user to submit the new choice via

Re: strange DatabaseError by ForeignKey

2013-02-23 Thread Shawn Milochik
You probably need to run syncdb, or migrate if you're using South. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To

Re: Easiest Way to Deploy Django?

2013-02-22 Thread Shawn Milochik
To answer the original question, my vote is for nginx + gunicorn. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To

Re: a very simple beginners question

2012-05-02 Thread Shawn Milochik
On 05/02/2012 08:59 AM, alon wrote: running $python manager.py shell opens a python shell is there any way (a parameter) to make the manager run a python file with my commands?? thanks If you have iPython installed then running manage.py shell will run in iPython. Then, you can use

Re: Databases

2012-04-28 Thread Shawn Milochik
Assuming your PYTHONPATH is set up properly, and your DJANGO_SETTINGS_MODULE is correct or you import your settings file from your crawler, then you can just import and use the models. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: Edit-once object in admin?

2012-04-28 Thread Shawn Milochik
I think you have to change your model. Override the save() method to raise an exception if "self.id is not None." This won't prevent developers from using the 'update()' or 'delete()' methods of a queryset, but for a single instance it shouldn't be editable. It will still be able to be

Re: deploying django - including third party apps

2012-04-26 Thread Shawn Milochik
There's no reason a user couldn't run virtualenv, regardless of permissions. Download the virtualenv tarball and extract it. It contains a file named virtualenv.py. Done. Run python virtualenv.py some_path and it will work. -- You received this message because you are subscribed to the

Re: Django questions.

2012-04-25 Thread Shawn Milochik
On 04/25/2012 11:04 AM, Marcin Tustin wrote: Apologies, these are job application questions: https://www.odesk.com/jobs/Programmers-Python-Django-and-client-side-programming-MySQL_~~c7db577bb2246e77?tot=5000=4&_redirected

Re: New to Jdango - What IDE to use?

2012-04-21 Thread Shawn Milochik
There are eleventy bajillion discussions on this already. Please search the group history on Google Groups. -- 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 Caching with Redis

2012-04-20 Thread Shawn Milochik
For what it's worth, Redis itself allows you to set expiration at the millisecond level. That won't help you with Django's own caching, but if you need to write something custom using the Redis Python module then you can. -- You received this message because you are subscribed to the Google

Re: Question about threading a view[REPOSTED]

2012-04-09 Thread Shawn Milochik
The best solution for this, in my opinion and experience, is to use supervisord. It's easy, requires no root access, and allows you to control all your long-running processes (Django app, celery, Redis, MongoDB, etc.) from one place. -- You received this message because you are subscribed to

Re: Django 1.4: TypeError: get_db_prep_value() got an unexpected keyword argument 'connection'

2012-04-08 Thread Shawn Milochik
On 04/08/2012 11:25 AM, shacker wrote: alias delpyc='find . -name "*.pyc" -print0 | xargs -0 rm -rf' Then you safely run "delpyc" from the top level of your project at any time to remove them all, ensuring that whatever problem you're experiencing isn't a result of them. This is probably

Re: Django 1.4: TypeError: get_db_prep_value() got an unexpected keyword argument 'connection'

2012-04-07 Thread Shawn Milochik
On Sat, Apr 7, 2012 at 12:03 AM, xthepoet wrote: > This was working fine for my Ubuntu 10.04LTE system with Django > 1.3.1. It seems broken now in 1.4. > > In Django 1.4, I get this error TypeError: get_db_prep_value() got an > unexpected keyword argument 'connection'

Re: storing objects in session

2012-04-06 Thread Shawn Milochik
Try using pdb and/or logging statements to trace it. You will almost certainly find your problem that way. If not, you'll be able to ask a more specific question that will be easier for others to answer. On Apr 6, 2012 3:11 PM, "imgrey" wrote: > I'm trying to store temporary

Re: How to restrict values in admin input form?

2012-04-06 Thread Shawn Milochik
https://docs.djangoproject.com/en/1.4/ref/contrib/admin/#adding-custom-validation-to-the-admin Essentially, make a ModelForm exactly as you would normally, and add logic to it. You're going to want to change the queryset of the field(s) in question. For example: class

Re: Django/Python version compatibility

2012-03-19 Thread Shawn Milochik
Django won't support 3.x for a while. You can't go wrong with 2.7 for now. https://www.djangoproject.com/weblog/2012/mar/13/py3k/ 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: python manage.py syncdb Error: No module named messages

2012-03-16 Thread Shawn Milochik
Not a PATH issue, but a PYTHONPATH issue. Run "python manage.py shell" and try to import 'messages.' I suspect it's not where you think it is, or its location is not on your PYTHONPATH. -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: python manage.py syncdb Error: No module named messages

2012-03-16 Thread Shawn Milochik
Check your PYTHONPATH. Perhaps it's not set right on the CentOS machine. The Linux distro shouldn't make a difference, nor should the presence of Cpanel or MySQL. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Newbie Django queryset question

2012-03-15 Thread Shawn Milochik
On 03/15/2012 11:22 PM, Murilo Vicentini wrote: Uhmmm, thank you a lot. That was what I was looking for! Sorry for wasting your time. One last question, does this double-underscore notation work at my html template? Because after filtering I will want to display the information of the

Re: Query Set to search for a combination of model fields?

2012-03-15 Thread Shawn Milochik
Look at how the Q objects are being used in the example and it's clear why that is. It's using the pipe (|) to do an "or" query. If you want to change how the search works you'll have to add more code: 1. Split the search parameters on whitespace. 2. Create Q objects for searching in either or

Re: Newbie Django queryset question

2012-03-15 Thread Shawn Milochik
You can certainly use Q objects to query across models, just as you can in a normal QuerySet, by using the double-underscore notation. https://docs.djangoproject.com/en/1.3/topics/db/queries/#lookups-that-span-relationships -- You received this message because you are subscribed to the Google

Re: Newbie Django queryset question

2012-03-15 Thread Shawn Milochik
If you don't know which fields your users will be searching on in advance, you'll have to create Q objects and dynamically build your query in your view. https://docs.djangoproject.com/en/1.3/topics/db/queries/#complex-lookups-with-q-objects -- You received this message because you are

Re: "Dynamyc" modells

2012-03-12 Thread Shawn Milochik
On 03/12/2012 03:34 PM, Ervin Hegedüs wrote: The main problem is the PromoList is _dynamyc_ - it means all administrator on admin site should add new PromoList, without me :), so I can't derivate all subclass in code... You can't dynamically create database tables on the fly. That would

Re: "Dynamyc" modells

2012-03-12 Thread Shawn Milochik
First, I would avoid using the word 'list' for describing anything in your own data, since it's a Python built-in. Maybe CodeList or PromoList or something, if they're going to be promotion codes. Or maybe just Promo, since a model should be a singular name, and each instance of your model

Re: Batch processing in parallel (celery)

2012-03-12 Thread Shawn Milochik
You can just use Celery. It's very simple if you use django-celery and MongoDB as the broker. Next, you could make sure you're using the ORM effectively. Use select_related where possible, avoid doing any querying in loops, pre-pulling data from the database and storing it in memory (in a

Re: Multiple Choice Quiz

2012-03-11 Thread Shawn Milochik
I think I'd do this: Models: Question question text Answer question foreign key answer text correct (boolean) Guess user foreign key answer foreign key That should be all you need (along with the User model or your own method of

Re: Multiple Choice Quiz

2012-03-11 Thread Shawn Milochik
On 03/11/2012 02:13 PM, jbr3 wrote: I've gone through the tutorial. But I would just like to get a general idea of the best way to incorporate all these elements so I can save and reuse them. What have you tried, and what specific issues have you run into? If you ask a question and nobody

Re: signals

2012-03-10 Thread Shawn Milochik
You can do exactly that by specifying a sender: https://docs.djangoproject.com/en/1.3/topics/signals/#connecting-to-signals-sent-by-specific-senders Also, note that the sender is available in the receiver because it's always the first argument sent by the signal, so you can have a function

Re: What reason is Django administration

2012-03-08 Thread Shawn Milochik
On 03/08/2012 03:44 PM, Stone wrote: Dear users, I have developed some web pages and I have never used Django administration? Is there any control for controlling access of users? Do you have any examples? Thank you Petr https://docs.djangoproject.com/en/1.3/topics/auth/#permissions --

[SOLVED] Outputting JSON in Django logs (98% of the way there!)

2012-03-08 Thread Shawn Milochik
It turns out I was just missing quotes around the () for the custom formatter. I just wrote a blog post will a full working example in case anyone else is interested. http://shawnmilo.blogspot.com/2012/03/using-json-logging-in-django-and-python.html -- You received this message because you

Outputting JSON in Django logs (98% of the way there!)

2012-03-08 Thread Shawn Milochik
Hi everyone. I'm hoping someone has gotten this working and can point out whatever tiny thing I'm doing wrong here. I want to log JSON instead of the default. I found JsonFormatter here: https://github.com/madzak/python-json-logger It works great with a small script I created based on the

Re: Problems getting started

2012-03-07 Thread Shawn Milochik
On 03/07/2012 08:58 PM, Andres Reyes wrote: For me, the main reason to use virtualenv has nothing to do with security or anything like that, is the convenience of having different projects with different sets of requirements not interfering with each other It's really all about convenience.

Re: Problems getting started

2012-03-07 Thread Shawn Milochik
On 03/07/2012 05:21 PM, Andre Terra wrote: Again, don't install as root, use virtualenv. This will save you headaches in the future, and unless you have an inexcusable reason to have Django run as root, you shouldn't. Sincerely, AT +1. Also, there is no excusable reason to need to do it as

Re: Is it time to start sqlite3 DB from scratch?

2012-03-02 Thread Shawn Milochik
You're welcome. To clarify, South is wonderful. It's sqlite that is the problem. The migrations only fail because sqlite doesn't support all normal SQL commands. I love sqlite, but it's not always the best solution. -- You received this message because you are subscribed to the Google Groups

Re: Is it time to start sqlite3 DB from scratch?

2012-03-02 Thread Shawn Milochik
On 03/02/2012 09:55 PM, DF wrote: Thanks. Still not sure how to wipe the database before starting fresh with South. If it's a sqlite database you just delete the file. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Is it time to start sqlite3 DB from scratch?

2012-03-02 Thread Shawn Milochik
If it's dummy data then you can always wipe it and reset South. There are some issues with sqlite. Not all constraints are enforced and it doesn't support removing fields, for two biggies. So you can't delete a field from a model (the migration will fail), and you can't use the

Re: How do i view json data returned from django

2012-03-01 Thread Shawn Milochik
On 03/01/2012 07:48 AM, Stanwin Siow wrote: Hello, I want to view the actual json data from django view, is there anyway i can do that before i parse it into jQuery? Assuming that you have a dictionary named "return_data," this will do it: return

Re: Admin Module

2012-02-25 Thread Shawn Milochik
Check your code to find out what "get_notes_health" is and you'll be 99% of the way to your answer. It's something to do with that, and that's something in your code, not Django itself. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Saving Django User in Form

2012-02-24 Thread Shawn Milochik
Read the Django docs about ModelForms, then use the 'exclude' kwarg to exclude the author from your ModelForm. Then, use request.user to get the appropriate user in your view and pass that to the form save(), which you must override to accept the extra argument, and use that user in the save()

Re: Setup a webserver that handles user input

2012-02-24 Thread Shawn Milochik
Certainly. People do it all the time. https://github.com/ask/django-celery Celery is probably the main way to go, and django-celery makes it super-simple to set up. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: psycopg2, postgres9.1, Mac OS - problem with psycopg2

2012-02-22 Thread Shawn Milochik
You can either add the proper path of pg_config to your PATH, or just extract the psycopg2 and add the full path to pg_config into the config file it contains then run 'python setup.py install' on the setup.py in the package. -- You received this message because you are subscribed to the

Re: I am getting TypeError: coercing to Unicode: need string or buffer, long found. Please help.

2012-02-21 Thread Shawn Milochik
On Tue, Feb 21, 2012 at 12:18 PM, Daniel Marquez < daniel.marquez0...@gmail.com> wrote: > Wow, I should've caught that. Thanks guys. However, since I needed a > string, what I did was add "default=x" to the integer field as > follows: > > class Phone(models.Model): >phonenumber =

Re: About managing dependencies in a collaborative development team and good practices.

2012-02-21 Thread Shawn Milochik
On 02/21/2012 10:53 AM, Javier Guerra Giraldez wrote: i do exactly that. just a tip: to create and maintain the pip requirements file do: pip freeze> piprequirementsfile.txt +1 And it's checked into version control. Shawn -- You received this message because you are subscribed to the

Re: I am getting TypeError: coercing to Unicode: need string or buffer, long found. Please help.

2012-02-20 Thread Shawn Milochik
Read the error message in your subject line. Then look at the __unicode__ method of your Phone model. It appears that this is the problem, and not the Device model. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Associating Form Data with Users

2012-02-19 Thread Shawn Milochik
On 02/19/2012 09:29 PM, ds39 wrote: Thanks for your response. But, would you mind expanding on it a little bit ? How about you give it a try and see what you can figure out? In your view, request.user will return the currently logged-in user (or an AnonymousUser if they're not logged in).

Re: Associating Form Data with Users

2012-02-19 Thread Shawn Milochik
When you process the form in your view, you'll have access to request.user. Just use 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 from this group, send

Re: Related Objects

2012-02-19 Thread Shawn Milochik
I think what you're looking for is annotate(): https://docs.djangoproject.com/en/1.3/topics/db/aggregation/ -- 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: Script to call loaddata on multiple fixtures

2012-02-18 Thread Shawn Milochik
Why not just put all those manage.py commands in a shell script and run 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 from this group, send email to

Re: Testing: Fixtures vs Factories vs ???

2012-02-17 Thread Shawn Milochik
I don't think there's one true way. In other words, the answer is "all of the above," depending on your project and the needs of each individual test. It also depends on your code. If you've done TDD, and therefore made your code easier to test, you can probably do it the simplest way

Re: Populating a list in a form based on a relationship

2012-02-13 Thread Shawn Milochik
You override the __init__ of the form object and set the .choices property of the form field representing the items. -- 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: How can I know when the third multiple is reached in an arbitrarily long list

2012-02-13 Thread Shawn Milochik
You can use the divisibleby template tag in combination with a forloop.counter (both explained on this page): https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#divisibleby -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Custom constraints on User fields

2012-02-13 Thread Shawn Milochik
It's probably related to the 80/20 rule. No tool or framework is going to be 100% what you need. Use it for the 80%. When your needs can't be handled by the tool, you can choose to twist yourself into a pretzel within the constraints of the tool or break free and do it the "manual" way --

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