Re: Python 2.6 Decompile --- I lost my views.py but have the views.pyc

2009-12-17 Thread Shawn Milochik
This won't help you unless there's something you forgot about, but it could help you in the future. In addition to git, I also use JungleDisk. It backs up my entire projects folder every hour. Perhaps you have Carbonite, JungleDisk, Mozy, or one of those services and you might be able to recover

Re: Strange problem when starting project in Windows XP

2009-12-18 Thread Shawn Milochik
What happens when you type 'python django-admin.py'? If that doesn't work, try replacing 'python' there with the full path to your Python executable in Windows. I've never heard of this problem, but it sounds like it could be something odd in the environment. Shawn -- You received this messag

Re: Need help inserting pdf

2009-12-18 Thread Shawn Milochik
The difference between the PDF and JPG is that the JPG has to be an 'img' tag and the PDF has to be an 'href' tag. So instead of: Try: Download Important Stuff Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: how do you get recordcount?

2009-12-21 Thread Shawn Milochik
Add this line to that code: print dir(tms) I think you'll find a method of the recordset that will give you the count. I don't remember off of the top of my head. Why are you doing a direct SQL query instead of using a queryset from your model? Shawn -- You received this message because you

Re: Best way to handle class attribute as a space separated string?

2009-12-21 Thread Shawn Milochik
I'd use a dictionary or list. If it has to persist, use simplejson to serialize it and create a couple of functions to wrap the JSON stuff. Then you can use property() to simplify it further. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" gr

Re: Best way to keep populating database after creation?

2009-12-22 Thread Shawn Milochik
Fixtures sound like the way to go. You should get what you need from here: http://docs.djangoproject.com/en/dev/howto/initial-data/ 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-us...@googleg

Re: Best way to keep populating database after creation?

2009-12-22 Thread Shawn Milochik
Well, the data loaded by fixtures will remain, so if you need to add new data you'll just have to create and load a fixture with the new data. It's easy to convert data to JSON or whatever, especially if your input isn't going to change. However, it seems like maybe you want something else alto

Re: Running multiple versions of Django on the same machine

2009-12-22 Thread Shawn Milochik
Use virtualenv. All the cool kids are doing it. You will love it -- it does what you want and more, and I use it on my Mac with no worries. Shawn Sent from my iPhone On Dec 22, 2009, at 6:42 PM, Alex Fink wrote: > Hi all, > > I'm developing for several different Django projects, one of whic

Re: Premature end of script headers

2009-12-23 Thread Shawn Milochik
Can you post your view? It's illegal for us to hack into your computer and look at your code to figure out the problem. I'm assuming that you have an if statement that checks for a POST. In that block, is there anything *not* done that's done during the GET? Shawn -- You received this message

Re: New to Django

2009-12-23 Thread Shawn Milochik
What's wrong with the official tutorial? Or have you already done it and are looking for something new? If the latter, why not do a project you invent, and post here for help when you get stuck. Yes, you can maintain sessions and all that. I don't think there's anything you can do with PHP that

Re: New to Django

2009-12-23 Thread Shawn Milochik
On Dec 23, 2009, at 7:43 PM, Dattatreya M wrote: > 1. @Shawn, Thanks for the reply. I appreciate you taking time to answer. > > 2. I am going through the Django tutI was wondering if there is something > else that would save me hours of 're-inventing' the wheel (with regards to > designing

Re: Skype me if you want to help a newb.

2009-12-23 Thread Shawn Milochik
I can do even better than that. Here's a great tutorial: http://docs.djangoproject.com/en/dev/intro/tutorial01/ Once you work through that (or get stuck) and have specific questions, people will be glad to help you out. Shawn -- You received this message because you are subscribed to the Goo

Re: how to install django in ubuntu .........

2010-04-15 Thread Shawn Milochik
On Apr 15, 2010, at 9:30 AM, Jagdeep Singh Malhi wrote: > how to install django in ubuntu ? > > Please Replywith full instruction > Full instruction, as requested: Go to google.com and search for "install django in ubuntu." Read and learn. The End -- You received

Re: why wordpress

2010-04-15 Thread Shawn Milochik
There are probably a thousand blogging apps done in Django, because it seems that a lot of people make one when they discover Django. However, I think you should give them the Wordpress they asked for, because it's maintained for security by a large organization for free. Unless you plan to co

Re: I need django open-source project to newspaper

2010-04-18 Thread Shawn Milochik
Try Google. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit th

Re: why am i getting this error?

2010-04-18 Thread Shawn Milochik
This is a simple Python dictionary exception; it has nothing to do with Django. > Stuff.objects.create(title=self.cleaned_data['title'], > > Exception Type: KeyError at /add_stuff/ > Exception Value: title You're asking for the value of the dictionary in key 'title,' but there's no such thing.

Re: manipulate header before sending response

2010-04-19 Thread Shawn Milochik
You can create your own middleware. http://docs.djangoproject.com/en/1.1/topics/http/middleware/ 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-us...@googlegroups.com. To unsubscribe from this

Re: look at about-to-be-run query

2010-04-20 Thread Shawn Milochik
I'm sure there's a better answer than this, but if you need it immediately this get you what you're asking for. Create a custom manager for your class and just define filter() as below: class MyCustomManager(models.Manager): def filter(self, *args, **kwargs): queryset = super(

Re: Email Field

2010-04-20 Thread Shawn Milochik
http://code.djangoproject.com/browser/django/trunk/django/db/models/fields/__init__.py If it's in models (django.db.models) then it's not in django.contrib, just FYI. As for overriding it, you can subclass it, for a start. Shawn On Apr 20, 2010, at 11:00 AM, CrabbyPete wrote: > Where in th

Re: Is South 0.7.1 ready for django1.2?

2010-04-21 Thread Shawn Milochik
On Apr 21, 2010, at 4:35 AM, Massimiliano della Rovere wrote: > I found nowhere information about compliancy of South 0.7.1 to the > multiDB support of django 1.2 > > Did I overlook anything? > If by "overlook" you mean "not read the release notes," then yes. http://south.aeracode.org/docs/re

Re: app inheriting from others app's models.py

2010-04-21 Thread Shawn Milochik
You may want to use an abstract base class. If you're inheriting something from another application then they're probably not defined in that way, although it might be possible to subclass them as abstract in your own models.py and then subclass those. But the ORM nicely hides all of this from y

Re: add permission to new model instances

2010-04-21 Thread Shawn Milochik
This can easily be done with signals. http://docs.djangoproject.com/en/1.1/topics/signals/ And, it (rightly) won't be done in the view, because that leaves open the very likely chance of a problem if someone writes a new view and forgets to call your extra code. The only sticky problem at the

Re: overriding model save(), is an instance available?

2010-04-21 Thread Shawn Milochik
One way: Override __init__ and setting self.old_title to be self.title. Then, in your save(), you can see if self.title != self.old_title. 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-us...

Re: overriding model save(), is an instance available?

2010-04-21 Thread Shawn Milochik
You should probably call that super __init__ first thing. Otherwise the object won't really know how to behave like a Django model. 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-us...@googleg

Re: Good examples or references

2010-04-22 Thread Shawn Milochik
Is there any reason you specifically want references external to the official Django documentation? I think you will find that the official documentation is by far the best. Also, there are a bunch of re-usable apps shipped with Django that have working examples of the functionality you'll need.

Re: danjgo authentification

2010-04-22 Thread Shawn Milochik
Everything you need is here: http://docs.djangoproject.com/en/1.1/topics/auth/#authentication-in-web-requests This will tell you exactly, in detail, how to create your own login page to tie into the built-in authentication. Also, (sorry, couldn't resist), it's spelled "authentication." Shawn

Re: add permission to new model instances

2010-04-22 Thread Shawn Milochik
What you're describing is more of a row-level permissions system. The permissions system that ships with contrib.auth is table-level, not row-level. There has been some talk on this list about ways to go about it, but I don't think there's an out-of-the-box solution for it yet. Off of the top

Re: Altering Model instance before returning it to the caller?

2010-04-23 Thread Shawn Milochik
This is pretty standard behavior in Django. Have something like this in your models.py: LOG_CODES = ( ('Input', 1), ('Output', 2), ) Then, the model field should have this in its definition: choices = LOG_CODES If you name that field name, say, _transaction_type, then yo

Re: how to display only one instance of an object returned by a query.

2010-04-26 Thread Shawn Milochik
> my queryset is bringing back all of the photos and the for loop writes > them all out. currently the photos come back in order of addition, > since all i've got to sort them on is added_date. (i tried ordering > the photos by the FK which is car.name but that didn't work). Why doesn't this wo

Re: Adding unique_together attribute after database is created

2010-04-26 Thread Shawn Milochik
Assuming that none of the old data violates your unique_together rule it will work. However, your database will not be configured correctly, and that could lead to problems. After your initial syncdb which created that table, Django will not make any changes to the database. The best thing to

Re: make a timeline on Django

2010-04-26 Thread Shawn Milochik
On Apr 26, 2010, at 12:23 PM, alivad wrote: > how to make a Timeline in Django, something like: > http://newstimeline.googlelabs.com/ > > Thanks you. > > -- How to search Google? Thanks you. -- You received this message because you are subscribed to the Google Groups "Django users" gro

Re: I think I will need some more help concerning forms in django

2010-04-26 Thread Shawn Milochik
It sounds like a case for formsets. http://docs.djangoproject.com/en/1.1/topics/forms/formsets/ Assuming you have models for these shopping cart items, you can use a formset of those items. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" grou

Re: I need django-evolution app

2010-04-27 Thread Shawn Milochik
The newly-released South 0.70 does. 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.c

usage of TIME_ZONE and zone-to-zone conversion

2010-04-27 Thread Shawn Milochik
Given a date/time value and a value that is valid for the TIME_ZONE setting in settings.py, how do I convert that date/time to the time zone defined in settings.py? Example: settings.py contains: TIME_ZONE = 'America/New_York' Input contains: date

Re: I need django-evolution app

2010-04-27 Thread Shawn Milochik
On Apr 27, 2010, at 3:10 PM, Anand Agarwal wrote: > How does it work if i want to run the schema changes for various database > instances? > In my scenario each account has different database instance & there are > hundreds of them. I want to update schema changes in all the databases in one >

Re: Run external script with Django cron

2010-04-27 Thread Shawn Milochik
I don't understand what the problem is. What error message are you getting? Are you confusing PATH and PYTHONPATH? 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-us...@googlegroups.com. To uns

Re: Run external script with Django cron

2010-04-27 Thread Shawn Milochik
> > And what is difference between PATH and PYTHONPATH? Appending to your environment's PATH means you'll be able to execute files without specifying the full path. For example, instead of having to do ./filename.py you can just use filename.py to call a Python script. This is just a *nix thin

Re: usage of TIME_ZONE and zone-to-zone conversion

2010-04-27 Thread Shawn Milochik
On Apr 27, 2010, at 3:36 PM, Peter Herndon wrote: > Hi Shawn, > > http://pytz.sourceforge.net/ looks like it would be useful for converting > time zone strings. > > The one thing I keep hearing, though, whenever anyone brings up time zones > here on django-users is: "*ALWAYS* store dates in

Re: Variable-length forms

2010-05-03 Thread Shawn Milochik
http://docs.djangoproject.com/en/1.1/topics/forms/formsets/ That ought to help out. 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-us...@googlegroups.com. To unsubscribe from this group, sen

Re: change an object from parent to child

2010-05-04 Thread Shawn Milochik
You can't subclass an instance, just a class/object. Maybe you want a foreign key to place in restaurant. What are you trying to 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-us...@goog

Re: Password reset email not sent

2010-05-04 Thread Shawn Milochik
I don't know why your e-mail isn't being sent, but I know that if multiple User instances have the same e-mail address, then that e-mail address will receive one message per User. Each one will specify the username, so it's easy to reset the correct password. Shawn -- You received this messa

Re: Password reset email sent several times

2010-05-06 Thread Shawn Milochik
You have five different users in your database with the same e-mail address. If you look at the e-mail messages, you'll notice that each one specifies a different value for username. Just make sure you click the right one for the password you want to reset. Shawn -- You received this message

Re: Quotas for Django models

2010-05-09 Thread Shawn Milochik
See the notes about "commit = False" and its effects on many-to-many tables. http://docs.djangoproject.com/en/1.1/topics/forms/modelforms/#the-save-method Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: New User Stuck on Tutorial Part 2

2010-05-10 Thread Shawn Milochik
Exactly what directory is your copied template in? It's most likely not in the right place. Ensure that you have a template dir that your settings knows about, and that template dir has a subdirectory called 'admin' where that file is placed. Shawn -- You received this message because you are

Re: processing page

2010-05-11 Thread Shawn Milochik
This was recently discussed on this list: http://groups.google.com/group/django-users/browse_thread/thread/7cefcb64dd423ef2/ 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-us...@googlegroups.c

Re: Help me- with the Database

2010-05-13 Thread Shawn Milochik
On May 13, 2010, at 4:43 AM, francisgan9 wrote: > Hi, > I need help how to get pass the installation of the database part. - > tutorial 1 > trying to use sqlite > >self.connection = Database.connect(**kwargs) > pysqlite2.dbapi2.OperationalError: unable to open database file Evidently it

Re: Form Validation question

2010-05-13 Thread Shawn Milochik
"Also, a model form instance bound to a model object will contain a self.instance attribute that gives model form methods access to that specific model instance." From: http://docs.djangoproject.com/en/1.1/topics/forms/modelforms/ So you can refer to self.instance in your validation code, assu

Re: Python Database Framework

2010-05-14 Thread Shawn Milochik
There's SQLAlchemy, but it's not nearly as simple as the Django ORM. However, nobody's stopping you from using the Django ORM (or the templates) in other projects that don't use the rest of Django. You will have to make a minimum settings.py or make certain values available in the scope of your

Re: File/Folder permissions for deploying Django app

2010-05-19 Thread Shawn Milochik
To some extent it doesn't matter. Just make sure your code is as secure as any private information you wouldn't want others to have access to. When Django is running in a production environment, there is a Python instance listening on a port on your system. Your Web server (Apache, nginx, whatev

Re: more complex queries

2010-05-20 Thread Shawn Milochik
You could create your own manager and have it do whatever you want -- even run the SQL query you already want to write and still return a queryset. http://docs.djangoproject.com/en/1.1/topics/db/managers/#id2 Shawn -- You received this message because you are subscribed to the Google Groups "

Re: Admin site - unticking a field stores date in model

2010-05-22 Thread Shawn Milochik
Sure. Just create the datetime field in your model and override the save() function of the model to do what you want. To facilitate this, just override __init__() of the model to store the value of the boolean field upon instantiation so that, in save(), you know whether it has changed. Don't

Re: makeing a foreign key optional

2010-05-28 Thread Shawn Milochik
Had you already run syncdb when you made the field optional? If so, you need to use a migration tool -- syncdb doesn't change existing tables, only creates new ones. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group

Re: Newbie having problems with django project tutorial setup - errors with psycopg2

2010-05-28 Thread Shawn Milochik
If you're in a terrible rush, you could switch to sqlite3 during development until you're ready to go to production. It sounds like either psycopg2 didn't install properly, or your Django instance is running under a different version or installation of Python than the one where you installed th

Re: What would be the best way to implement a login audit?

2010-05-29 Thread Shawn Milochik
It would be nice if contrib.auth threw signals for auth attempts. I don't think a custom auth backend would be the best solution, because a custom auth backend as described in the documentation doesn't receive the request object, which is where the stuff you want (such as IP address) can be acc

Re: delete file or image after deleting model item

2010-05-29 Thread Shawn Milochik
You can override the delete function of your model to take care of this. Alternatively, if you want to do this for a bunch of different models, it might be cleaner to use signals. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: Django 1.2.1 install in Ubuntu 10.04 via Synaptic?

2010-05-30 Thread Shawn Milochik
On May 30, 2010, at 10:07 PM, AD wrote: > Thanks for replying. > > I do understand that i can install it manually. I'm just wondering > whether it's worth doing now or waiting for a package update. From > what I gather, Ubuntu installs Django in different locations than the > straight Django ins

Re: Empty QueryDict on POST

2010-05-31 Thread Shawn Milochik
Try using django-debug-toolbar. It will show the POST and GET values. Also, you can use request.POST.get('formID') instead, which will return None (or the second, optional argument) if it's empty. What is your json_response middleware doing? Could it have anything to do with this? What if you

Authentication lost one page-load after login.

2010-06-02 Thread Shawn Milochik
I'm having an extremely weird problem which I've been unable to solve for weeks. It's entirely possible that there's something odd I've done somewhere in the system, but I thought I'd throw it out there in case someone has seen this already. Background: User must be logged in to view a page or

*Immediate* session expiration problem/bug in IE

2010-06-04 Thread Shawn Milochik
I've been having an infuriating problem. Less than 1% of our users, all on IE, had this symptom: 1. They log in. 2. They are redirected to the main screen (logged in successfully). 3. They click any link or refresh, and they're redirected to the login page because Django sees request.user as Ano

Re: Latest wisdom on 'small migrations'

2010-06-06 Thread Shawn Milochik
On Jun 6, 2010, at 9:18 AM, Andy Kelley wrote: > Use south. The overhead is worth it. +1 on South. Especially because this "just this once" scenario is going to happen again and again if your project lives long enough. Shawn -- You received this message because you are subscribed to the Goo

Re: how to eliminate duplicates

2010-06-17 Thread Shawn Milochik
Use South data migrations. Sent from my iPad, in accordance with the prophesy. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to

Re: reloading in shell

2010-06-24 Thread Shawn Milochik
Install ipython. It has a lot of great features, including retaining history. If it's installed, Django will use it by default if you run manage.py shell. Shawn Sent from my iPhone 4, for which I waited in line for six hours like a fool on release day. -- You received this message becaus

Re: Cant find django

2010-07-05 Thread Shawn Milochik
The easiest solution I've found is to just install it with pip. Download the tarball for the version you want then run pip install filename. Of course you'll need to prefix that with sudo if you're installing it system-wide, but I recommend virtualenv. I use a Mac for development full-time an

Free (legal) jQuery book, from Novice to Ninja for 24 hours.

2010-07-11 Thread Shawn Milochik
Yes, this is slightly off-topic, but all the Django developers I know use jQuery in their projects. The publisher is giving away the e-book as promotional stunt related to the World Cup. http://sale.sitepoint.com/ The download includes PDF, .mobi, and .epub versions! Shawn Disclaimer: None.

A simple use-case for adding Celery to a Django project without RabbitMQ.

2010-07-11 Thread Shawn Milochik
Here's a little blog post I just wrote. It provides instructions for what I think is the simplest possible way to add Celery to your Django project. Feedback (including critical) is always welcome. http://shawnmilo.blogspot.com/2010/07/simple-celery-with-django-how-to.html Shawn -- You receiv

Re: Django on Mac OS X

2010-07-18 Thread Shawn Milochik
This is a known (and common) problem. Here's an easy fix that I've used many times. http://shawnmilo.blogspot.com/2009/11/psycopg2-on-snow-leopard.html Incidentally, you can replace "make install" with "make altinstall" to add Python 2.7 to your system without replacing the default Python. Sha

Re: Import Confusion? Forms Confusion? Or just Confusion?

2010-07-19 Thread Shawn Milochik
> > > When I comment out the import views above, it gives me the following > error: > > Exception Type: NameError at /QC_THISSS_01/samples/create/ > Exception Value: name 'request' is not defined > > > This is because when you import the file it attempts to actually execute the line "addSample = sa

Re: Which Python are people using on OSX?

2010-07-19 Thread Shawn Milochik
I definitely prefer to compile and altinstall Python or install it somewhere in my home directory, then use virtualenv for all my Django and Python projects. I'm currently using 2.6.5 and 2.7 for my Django projects, without interfering with any OS X defaults. As has been mentioned you'll need Xco

Re: Free web-hosting sites that support Django ?

2010-07-21 Thread Shawn Milochik
http://code.djangoproject.com/wiki/DjangoFriendlyWebHosts -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...

Re: iPython and Django issue

2010-07-21 Thread Shawn Milochik
Evidently the function you are trying to call has been moved. http://docs.python.org/library/commands.html Try subprocess instead of commands. 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-u

Re: Plese guide to solve this

2010-07-21 Thread Shawn Milochik
> > > TypeError: __init__() got an unexpected keyword argument 'maxlength' > > Your error is right there, at the bottom of your stack trace. The keyword maxlength is not valid. You probably meant max_length. In the future, please actually read the error message output. It is usually very helpful.

Re: iPython and Django issue

2010-07-21 Thread Shawn Milochik
Are you using the default version of Python that came with Snow Leopard? If so, try a virtualenv. I did some searching on Google and saw similar errors reported but it seems that bugs which would cause them have been patched in current versions. I do all my development in virtualenvs with official

Re: Help and Training

2010-07-21 Thread Shawn Milochik
This list and the Python mailing list[1] are both great for that. Of course, both are forums where you get the best assistance by showing that you've tried and failed before you asked others for their time. Shawn 1. http://mail.python.org/mailman/listinfo/python-list -- You received this messag

Re: filter users by full name

2010-07-22 Thread Shawn Milochik
To expand on what Scott said, you could do something like this: #if a name was passed if name and len(name): name_q = Q() for token in name.split(): name_q = name_q & (Q(first_name__icontains=token) | Q(last_name__icontains=token)) This wou

Re: filter users by full name

2010-07-22 Thread Shawn Milochik
On Thu, Jul 22, 2010 at 5:20 PM, Ryan LeTulle wrote: > Why wouldn't you simply? > > User.objects.filter(firstname="John", lastname="Doe") > > > Because the OP wants to accept a string containing full (both first and last) name, and you can't reliably split that into "first name" and "last name"

Re: finding current url

2010-07-22 Thread Shawn Milochik
Have a look at request.META, particularly HTTP_HOST. Search this page for "HttpRequest.META": http://docs.djangoproject.com/en/dev/ref/request-response/ 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: formset question?

2010-07-22 Thread Shawn Milochik
The docs explain how to add your own fields to formsets. You could insert your labels that way. http://docs.djangoproject.com/en/1.2/topics/forms/formsets/ Also, since you're in a template 'for' loop, you could just use the forloop.counter0 to access the value of your index list that corresponds

Re: URL DID NOT MATCH ANY OF THESE! Error!!

2010-07-23 Thread Shawn Milochik
You have three regular expressions. Two of them require digits, and one requires *only* /record/, with no additional arguments. So /record/john/ does not match any of those. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: "TypeError iteration over non-sequence" after deploying

2010-07-27 Thread Shawn Milochik
There's your error. The value of model_or_iterable is not iterable. Perhaps it's a model (based on your naming convention). Try logging the value of model_or_iterable right before that line to see what it contains. Once you've done that, figure out why it contains that instead of something that's

Re: Using sqlite3 to test locally

2010-07-28 Thread Shawn Milochik
Did you run ./manage.py syncdb? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For mor

Re: through/unique_together usage

2010-07-29 Thread Shawn Milochik
Are you using sqlite3? It doesn't support the unique_together constraint. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-u

Re: Python/Django hosting

2010-07-30 Thread Shawn Milochik
On Thu, Jul 29, 2010 at 1:22 PM, kostia wrote: > Thanks, I already know about webfraction. Great site. > > If anyone can provide cheaper solution, hosted in Europe, please write > me. > > -- http://lmgtfy.com/?q=django+hosting+europe&l=1 -- You received this message because you are subscribed t

Re: How to record users ip address every-time user logs in

2010-08-05 Thread Shawn Milochik
Maybe a combination of these two things will get you going. 1. A way to store additional information about users (such as IP addresses). http://docs.djangoproject.com/en/dev/topics/auth/?from=olddocs#storing-additional-information-about-users 2. Get the IP address from the META attribute of the r

Re: how to make readonly in change but editable in add?

2010-08-05 Thread Shawn Milochik
You can do this very easily by tweaking your model as follows: 1. Override __init__() and store the value of that field in a temporary value, such as self.old_status. 2. Override save() and before you call the super() save, check if self.pk (meaning the instance is not new). If so, and self.old_s

Re: how to make readonly in change but editable in add?

2010-08-05 Thread Shawn Milochik
On Thu, Aug 5, 2010 at 12:31 PM, shmengie <1st...@gmail.com> wrote: > I think it's better to let the user know the fields exist and may not > be changed, than to present them with editable fields that may not. > I agree. That's not incompatible with my solution. I would expect the user to be infor

Re: Problem with dumpdata and loaddata in python format

2010-08-12 Thread Shawn Milochik
Good question. According to the dumpdata docs, the available formats are here: http://docs.djangoproject.com/en/1.2/topics/serialization/#serialization-formats And 'python' does indeed show in that list. However, that page does mention that the 'python' version serves as a base for other formats

Re: generating random keys/passwords

2010-08-13 Thread Shawn Milochik
The auth module in contrib uses the make_token method of default_token_generator in django.contrib.auth.tokens for the standard password reset, so that sounds like a good choice. Another good way to get a unique, random string is uuid.uuid4(). Shawn -- You received this message because you are

Re: Django psycopg2 installation issue

2010-08-15 Thread Shawn Milochik
The Python version that ships with Snow Leopard is compiled for 64-bit. Unfortunately, the latest psycopg2 does not work properly, and you'll have to recompile Python for yourself in 32-bit. Here are the instructions: http://shawnmilo.blogspot.com/2009/11/psycopg2-on-snow-leopard.html Incidentall

Re: Using sqlite :memory: database for development.

2010-08-17 Thread Shawn Milochik
Middleware executes with each request, so it's probably not the best place for such a thing. It seems like it would be a lot easier to use a normal sqlite3 database and just delete it after each run. Also, if you have test data you'd like to reload regularly, I recommend using a regular database,

Re: Using sqlite :memory: database for development.

2010-08-17 Thread Shawn Milochik
Try --NOINPUT http://docs.djangoproject.com/en/1.2/ref/django-admin/#syncdb 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-us...@googlegroups.com. To unsubscribe from this group, send email to

Re: passing parameter from view to template

2010-08-17 Thread Shawn Milochik
In addition to what Steve said, I'd recommend putting something like this in your template as a test: zxc is: '{{ zxc }}' comm.id is: '{{ comm.id }}' This may save you some time if something you don't expect is happening. Shawn -- You received this message because you are subscribed to the Goo

Re: Fixtures for Groups and Permissions

2010-08-19 Thread Shawn Milochik
It sounds like a job for natural keys. http://docs.djangoproject.com/en/dev/releases/1.2-alpha-1/#natural-keys-in-fixtures 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-us...@googlegroups.com

Re: Path mess

2010-08-20 Thread Shawn Milochik
If you set your environment variable DJANGO_SETTINGS_MODULE in the environment your script is running in, you need only add this line to your script (in addition to your model imports, of course). from django.conf import settings Otherwise you'll need to import the OS module in your script and ad

Re: Custom clean() method

2010-08-24 Thread Shawn Milochik
Your version automatically gets called during the cleaning process (assuming it's named properly). You don't need to call it explicitly. The default cleaning of the field will happen automatically. All you have to do is get the value from cleaned_data and make sure you return the value in your func

Re: Notification of Model Changes

2010-08-24 Thread Shawn Milochik
If you override __init__() and store the value of that field in a temporary value, such as self.old_status, then the instance will have both self.status and self.old_status for comparison later. I hope this fits your use-case. Shawn -- You received this message because you are subscribed to the

Re: Notification of Model Changes

2010-08-24 Thread Shawn Milochik
On Tue, Aug 24, 2010 at 3:33 PM, Almost George wrote: > > When overriding __init__, what does that function definition need to > look like to make sure everything else works as usual? > Nothing special, as long as you call the __init__ of super. Example: super(YourModelName, self).__init__(*arg

Re: virtualenv and standalone scripts

2010-08-24 Thread Shawn Milochik
I have my .bashrc set to source the virtualenv, and I source .bashrc in any shell scripts that need to run via cron. That works out well for me, and was even seamless when I upgraded our server to Python 2.7 last weekend -- I didn't have to change a thing in any script, and just one line in .bashrc

Re: App for Registration/Authorization which is Email & Password based (not username)

2010-08-26 Thread Shawn Milochik
If you still want to use the contrib.auth app, you can just add your own backend to the user authentication. It's very easy to do. http://docs.djangoproject.com/en/dev/topics/auth/#writing-an-authentication-backend There are some very smart people who prefer not to use contrib.auth for a variety

Re: urlencode in Django

2010-08-30 Thread Shawn Milochik
This a Python question, not a Django question. import urllib urllib.quote("+ ñ ó") '%2B%20%C3%B1%20%C3%B3' 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-us...@googlegroups.com. To unsubscribe

Re: Multiple authentication sources to one database

2010-09-02 Thread Shawn Milochik
You can use multiple authentication backends in the same Django project. All you have to do is write/install a backend that supports your alternative method, and add it to AUTHENTICATION_BACKENDS in your settings file. The info here should help a lot: http://docs.djangoproject.com/en/dev/topics/au

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