Re: Twitter API

2009-12-27 Thread Shawn Milochik
http://code.google.com/p/python-twitter/ -- 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.co

Re: Tutorial help

2009-12-31 Thread Shawn Milochik
You definitely need your Django code to be in a folder that is unavailable from the Internet. It shouldn't be accessed by your visitors or your server app (such as apache). When you run Django in a production environment, it listens on a specific port, and from there it serves the pages. Apache

Re: TemplateSyntaxError: 'if' statement improperly formatted

2010-01-02 Thread Shawn Milochik
The problem is that you're using Python syntax instead of template tags. http://docs.djangoproject.com/en/dev/ref/templates/builtins/ -- 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...@googlegroup

Re: TemplateSyntaxError: 'if' statement improperly formatted

2010-01-02 Thread Shawn Milochik
On Jan 2, 2010, at 8:54 PM, Ramiro Morales wrote: > On Sat, Jan 2, 2010 at 10:33 PM, dhruvg wrote: >> >> Could you elaborate? >> The documentation indicates that complex expressions follow Python >> exactly. > > I suspect you are using django 1.1.x and reading theDjango SVN trunk > documentati

Re: help about json

2010-01-04 Thread Shawn Milochik
Here you go: http://catb.org/~esr/faqs/smart-questions.html -- 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: Changing the database name by subdomain name

2010-01-04 Thread Shawn Milochik
It seems like you should have two instances of Django running. Each one will be listening on a different port, and run a different settings.py file. In short, copy your settings.py file, and change the copy to use the alternate database. Then, run two copies of Django, like this (may vary based

Re: Django-Admin filter on 'backwards' foreign key

2010-01-05 Thread Shawn Milochik
If you change this: media=models.ForeignKey(Media) to this: media=models.ForeignKey(Media, related_name = 'media_translations') in your MediaTranslations model, then you can filter your Media queryset by referring to its media_translations. Example: media.objects.filter(media_translations__la

Re: Django-Admin filter on 'backwards' foreign key

2010-01-05 Thread Shawn Milochik
Sorry, I completely missed the part of the question where you said you wanted to do it in the Django Admin. That I don't know about. 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...@google

Re: database password in settings.py

2010-01-05 Thread Shawn Milochik
Your settings.py file is only readable by people who have access to your server. If that's the case, they're either trusted or you have much bigger problems. The file should never be exposed to the Internet (or intranet, for that matter). Shawn -- You received this message because you are sub

Permissions (was: Namespace Security)

2010-01-11 Thread Shawn Milochik
This is something we've been thinking a lot about recently. The direction we are considering is something like this: http://github.com/paltman/django-logicaldelete This code, "logical delete," overrides the delete() method of models so that they are simply marked as deleted, and not returned in

Re: Permissions (was: Namespace Security)

2010-01-11 Thread Shawn Milochik
Tim, I think that if you replace the term "namespace" with "group," we can do what we both want with the same solution. Or, in other words, we're kind of saying the same thing but using different words. In my scenario, each user would be in one or more groups. Each user could read or write any

Re: Brief tutorial to get a django dev server up.

2010-01-11 Thread Shawn Milochik
Since you asked for comments: The Django core developers are looking to discontinue Python 2.3 support soon, so it's a good idea to recommend 2.4 as the minimum, or state which version of Django requires Python 2.3 or higher. Just a personal preference, but I wouldn't recommend downloading and

Re: multiple database on django please helpme..

2010-01-12 Thread Shawn Milochik
This will help you get help: http://catb.org/~esr/faqs/smart-questions.html -- 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 djang

Re: Namespace Security

2010-01-12 Thread Shawn Milochik
On Jan 12, 2010, at 8:04 AM, Gonzalo Delgado wrote: >> > > I'm facing similar requirements and came across this app: > >http://packages.python.org/django-authority/ > > but haven't tried it out yet. > > -- > Gonzalo Delgado > Thanks, I'm looking into it now. It looks like we won't hav

Re: Namespace Security

2010-01-12 Thread Shawn Milochik
On Jan 12, 2010, at 8:04 AM, Gonzalo Delgado wrote: > > I'm facing similar requirements and came across this app: > >http://packages.python.org/django-authority/ > > but haven't tried it out yet. > Well, I just read most of the docs, and it looks like this won't work for our requirements

Re: Namespace Security

2010-01-12 Thread Shawn Milochik
Tim, I look forward to seeing what you've put together. I'm not so much hung up on terminology (group versus namespace) as functionality. I mentioned the specifics in my last post, regarding not having to change the Django queryset syntax in every view in the application. Does your solution sup

Re: Text Search using Python

2010-01-14 Thread Shawn Milochik
On Jan 14, 2010, at 6:04 AM, Amit Sethi wrote: > Hi , I have a project with a few static html pages , I wish to search these > static html using a django search app . Most of the tutorials I saw are > focused on searching django models but none I could see concentrates on > indexing static ht

Re: decimal is not json serializable.

2010-01-14 Thread Shawn Milochik
You could always convert decimals to strings. There's probably a better solution out there, but this should at least be a quick-fix. 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...@googlegr

Re: Insert AUTOMATICALLY random string in username field

2010-01-14 Thread Shawn Milochik
There are a bunch of ways you can do it. As a previous poster said, you can take 10 digits of the current timestamp. However, be wary of daylight saving time changes (if you have them on your server), and the possibility of any conflict if you change servers, have a backup server, or ever expand

Re: Insert AUTOMATICALLY random string in username field

2010-01-14 Thread Shawn Milochik
Do a Google search on 'mysql' and 'sequences.' Also, have a look at MySQL's last_insert_id() function. Maybe that's all you need to use an autonumber as a sequence. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this grou

Re: Best way to track user presence

2010-01-14 Thread Shawn Milochik
Use the built-in session timeout. Probably a good idea in any case, to protect your data and user privacy. If they don't log out, they time out. If you trust your users to have scripting enabled, you can even put a JavaScript function on a timer to sent the browser to your logout URL. It's

Re: query related question

2010-01-14 Thread Shawn Milochik
Your couple_query returns a queryset. Even if there's only one result, you're not getting just the one woman, but a queryset object. I think you want something more like: woman = Woman.objects.get(lastname__exact = 'Test') couple = Couple.objects.get(couple = woman.couple) Note that this is mak

Re: query related question

2010-01-14 Thread Shawn Milochik
On Jan 14, 2010, at 11:53 PM, E. Hakan Duran wrote: > Thanks a lot for the quick response. > > On Thursday 14 January 2010 23:08:43 Shawn Milochik wrote: > >> ... >> woman = Woman.objects.get(lastname__exact = 'Test') >> couple = Couple.objects.get(coup

Re: Splitting tests.py

2010-01-18 Thread Shawn Milochik
Here's a fantastic resource. It's what I used to switch to this methodology. It talks you through exactly how to do this. http://ericholscher.com/blog/2008/nov/4/introduction-pythondjango-testing-basic-unit-tests/ Shawn-- You received this message because you are subscribed to the Google Groups

Re: Splitting tests.py

2010-01-18 Thread Shawn Milochik
On Jan 18, 2010, at 3:50 PM, Olivier Guilyardi wrote: > On 01/18/2010 08:59 PM, Shawn Milochik wrote: >> Here's a fantastic resource. It's what I used to switch to this methodology. >> It talks you through exactly how to do this. >> >> http://erichols

Re: Using the form field values in templates

2010-01-18 Thread Shawn Milochik
This is something I've run into as well. If it's a forms.ModelForm, and you instantiated it by passing an instance, you can access it like this: {{ person_form.instance.last_name }} Shawn-- You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: how to do a form with elements drawn from database (not hard-wired in forms.py)?

2010-01-18 Thread Shawn Milochik
In your form's __init__ function, you can dynamically add items to its self.fields. You can dynamically supply the label value as well, so what is shown on-screen will be properly labeled. So, you'd pull from your database, then create (in code) a field (such as a forms.CharField or forms.Boole

Re: Entire site requires login

2010-01-18 Thread Shawn Milochik
I did it with middleware. Here's my code. http://pastebin.com/f52e6ef04 Make sure you provide exceptions for the login page, password reset, static content, etc. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: What is the best method to load a page?

2010-01-19 Thread Shawn Milochik
Please complete the tutorial: http://docs.djangoproject.com/en/dev/intro/tutorial01/ Then read this, then provide more information about your question. http://catb.org/~esr/faqs/smart-questions.html Shawn -- You received this message because you are subscribed to the Google Groups "Django user

Re: problems getting the development version running on Leopard

2010-01-19 Thread Shawn Milochik
> The first one trying to rum django-admin.py command not found This means that the directory containing django-admin.py is not on your PATH. You can add it, or just type the full path to django-admin.py. However, if your Django installation isn't on your PYTHONPATH, you may have a differe

Re: ChoiceField

2010-01-20 Thread Shawn Milochik
If this kind of thing isn't clear from the documentation at docs.djangoproject.com, I recommend throwing some print/debug statements into your views to explore the objects. Take advantage of Python's introspection. For example, before you return the response in your view, try some of these thin

Re: ChoiceField

2010-01-21 Thread Shawn Milochik
What did you try? I found it easily. First: print dir(myform) #I found that myform has a 'fields' attribute. Second: print dir(myform.fields['choicefieldname']) #found myform.fields['choicefieldname'].choices Third: print myform.fields['choicefieldname'].choices #got all the nice options I wa

Re: ChoiceField

2010-01-21 Thread Shawn Milochik
>> > > I think there might be a terminology issue here. I suspect the OP is > looking for all the possible value of a model field with `choices` > set. Which, is not easily possible from a template (although you can > do it in Python: MyModel._meta.get_field_by_name('myfield') > [0].choices) > --

Re: Remove items from queryset?

2010-01-22 Thread Shawn Milochik
How about creating a Python list, which you populate from chosen items of your queryset? You might even be able to do it with a list comprehension, depending on how complex your filtering is. The contents of a queryset are just model instances. Nothing magical you can't pull out and manipulate w

Re: Scammer / Job fraud rehash - Do NOT perform any business with Eike Post

2010-01-24 Thread Shawn Milochik
Please take this conversation off-list. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com

Re: Scammer / Job fraud rehash - Do NOT perform any business with Eike Post

2010-01-24 Thread Shawn Milochik
this conversation off the list? Thanks! Eike On Jan 24, 9:22 pm, Shawn Milochik wrote: Please take this conversation off-list. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googl

Re: Google maps routes in geodjango

2010-01-25 Thread Shawn Milochik
When you use the Google Maps API and request a driving route, what comes back in the 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...@googlegroups.com. To unsubscribe from this group

Re: Grouping data by month

2010-01-25 Thread Shawn Milochik
If this is something you're going to need a lot, I suggest adding a month field, then overriding the model's save() method to populate it from the date_time field. It would certainly save a lot of hassle, and could be a major performance boost. Alternatively, depending on what kind of data this

Re: Django evolution issue

2010-01-28 Thread Shawn Milochik
The author of Django-evolution has stated (including at DjangoCon 2009) that South is the best solution for this problem. Django-evolution is unsupported and not under active development (unless someone has forked it and I'm unaware). http://south.aeracode.org/ I'd be happy to help you get South

Re: Brief tutorial to get a django dev server up.

2010-01-28 Thread Shawn Milochik
Try typing 'python' (or the full path to your Python executable) before django-admin.py. I'm guessing you're using Windows, and it's associating .py files with a text editor instead of the Python interpreter. Shawn -- You received this message because you are subscribed to the Google Groups

Django Model Audit Log

2010-01-29 Thread Shawn Milochik
I need to implement auditing for my models. The current plan is to listen for the post_save() signal and dump the current values of the instance to an external database. The only problem is that I need to store the request.user with this data, and I don't see any way to capture that, since it

Re: Django 1.1 features covered in book.

2010-01-29 Thread Shawn Milochik
"The Definitive Guide to Django," Second Edition by Adrian Holovaty and Jacob Kaplan-Moss covers Django 1.1. I have a copy sitting on my desk right now. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: Django Model Audit Log

2010-01-29 Thread Shawn Milochik
Awesome! Thanks, that does exactly what I need. Shawn On Jan 29, 2010, at 12:08 PM, tom wrote: > maybe that middleware can help you out with getting the username > http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser -- You received this message because you are subscribed to the Goo

Re: Generic templates

2010-01-30 Thread Shawn Milochik
I think you've missed context processors, which is easy to do. I'm assuming that your issue is that you want to have something passed in the context on every page load to do something like decide which menu items are available based upon whether the user is logged in, their privileges, or whatev

urlresolvers.py error when using postgres, but not sqlite3

2010-01-30 Thread Shawn Milochik
I tried to switch an existing Django app from sqlite3 to Postgres. I know the database stuff is working because I can run syncdb and South migrations, as well as external scripts that use my models. However, when I actually try to load any of the pages in the browser, I get the error below. If I

Re: urlresolvers.py error when using postgres, but not sqlite3

2010-01-30 Thread Shawn Milochik
Karen, Perfect, thanks! I didn't know that attempting the import in './manage.py shell' would give me more information than I was getting from the standard traceback. It led me immediately to the flaw in my code, which was in a forms.Form used in the view. That little trick will probably come i

Re: postgres exception

2010-02-01 Thread Shawn Milochik
Do you have any messages coming from prior to that? The error you're receiving comes when something else has blown up with your database transaction, and then your code tries to execute something else against the database while your transaction is already 'broken.' So, the problem is probably no

Re: Best way to handle "this obj relates to one of these three types of objects" ?

2010-02-01 Thread Shawn Milochik
Poof, magic! http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1 Django has this baked-in. 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: Rebuild admin site after dropping field from models.py?

2010-02-01 Thread Shawn Milochik
Running syncdb on an already-existing model won't make the changes in the database. For that, you should employ the fine services of South. south.aeracode.org/ At this point, you might be best served by the following procedures: 1. Put the field back in your model. 2. Install South, add it to in

Re: Default Selection in ChoiceField

2010-02-01 Thread Shawn Milochik
You can do it in your view after creating the form, if you like. form = SomeForm() form.fields['meal_pref'].initial = 2 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. T

Re: where can i see the tables created in sqlite database

2010-02-02 Thread Shawn Milochik
If you have sqlite3 installed on your system, enter this at the command prompt: sqlite3 your_database_file You will be placed at a sqlite prompt. Type: .help (notice leading period) You will see the cool features of sqlite3. One of them is .schema, which will show you the database layout. S

Re: How to except a TranslationError

2010-02-02 Thread Shawn Milochik
This isn't really a Django question; perhaps you should try the excellent Python mailing list: http://mail.python.org/mailman/listinfo/python-list That said, they're probably going to want more information. What are you trying to accomplish? I can't imagine you wanting a recursive function whic

Re: Added-value over PHP?

2010-02-02 Thread Shawn Milochik
There is much to say on this topic. I suggest doing some Google searching on "Django versus PHP" and read until you know the answer to your question. My brief summary is that Django lets you do everything you can do in PHP, and much better and faster because it has all the mundane and repetitive

Re: Wanted: someone to customize shipping module in Satchmo

2010-02-02 Thread Shawn Milochik
#1: Post this on DjangoGigs #2: Asking for a time estimate with no requirements can not produce useful responses. -- 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 unsubscrib

Re: help with Django model and 'choices'

2010-02-02 Thread Shawn Milochik
If you post the ModelForm we might be able to help more, but I'll venture a guess. Do you have any templates where you use this ModelForm but do not show the grades for editing? If so, and someone does an update, you're saving those fields with empty values unless you explicitly exclude them in

Re: help with Django model and 'choices'

2010-02-02 Thread Shawn Milochik
Okay. Sorry, I don't see anything in the model or ModelForm that seem like they might cause this behavior. How about the view(s) that instantiate the ModelForm? Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: help with Django model and 'choices'

2010-02-02 Thread Shawn Milochik
On Feb 2, 2010, at 10:40 AM, Chris McComas wrote: > Here's my view: > > http://dpaste.com/153735/ > > One thing I just thought of, is it a problem that the data for > ha_grade and hp_grade are saved in the db as 4.3300 or 4. or > 3.6700 but in the on my form they're like this: 4.33 or 4.0

Re: help with Django model and 'choices'

2010-02-02 Thread Shawn Milochik
On Feb 2, 2010, at 11:49 AM, Chris McComas wrote: > Shawn -> thnx for your help, that "hacky" fix isn't working tho... Sorry 'bout that. I didn't really test it. But in the loop, do some creative print or log.debug statements with the values in scope and see what you can figure out. Maybe you

Re: help with Django model and 'choices'

2010-02-02 Thread Shawn Milochik
On Feb 2, 2010, at 12:48 PM, Chris McComas wrote: > Like this? > > http://dpaste.com/153790/ Yeah. Does that help with the pre-population in your form? Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: looping through non-null fields

2010-02-03 Thread Shawn Milochik
How about using the key/value pairs in self.__dict__ that have a value? Alternately, have a look at the help of instance._meta and see if that has anything useful for you. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Help with math functions...

2010-02-03 Thread Shawn Milochik
It doesn't work because an instance of the Decimal object can't be used for mathematical calculations (such as division and multiplication) with floats or integers. If you replace this: 100 / 25 with: Decimal(str(100 / 25)) or: Decimal("4") It should work. Shawn -- You received this m

Re: Problem with text encoding MS SQL Server 2005

2010-02-03 Thread Shawn Milochik
On Feb 3, 2010, at 1:30 PM, Filip Gruszczyński wrote: > OK, we managed to solve this ourselves. > It would be nice if you mentioned what the cause was in detail, and what the fix was. Just in case someone finds your posts many months from now and is trying to solve the same problem. Shawn

Re: whereis localhost on filesystem under python 2.6 windows 7

2010-02-03 Thread Shawn Milochik
The localhost isn't a place in your filesystem. It's an alias for the IP address of your own computer, A.K.A. 127.0.0.1. When you say that 'Python has installed a webserver,' that's not accurate. Django comes with a Web server which you invoke when you run './manage.py runserver,' but it's not

Re: If query field equals text...

2010-02-03 Thread Shawn Milochik
On Feb 3, 2010, at 2:52 PM, Chris McComas wrote: > I'm trying to run this IF in my views, it's throwing an index out of > range error. > > http://dpaste.com/154249/ > > What have I done wrong? > Not reading this, mostly: http://catb.org/~esr/faqs/smart-questions.html To be slightly more spec

Re: If query field equals text...

2010-02-03 Thread Shawn Milochik
Well, the IndexError narrows down the source of the problem to any time you're trying to access something by index. What is lor.rating_recommendation? Is it a field? If so, what type? If it's a function, what is it doing internally? Also, exactly what line of what file is throwing that error? L

Re: You're seeing this error because you have DEBUG = True in your Django settings file.

2010-02-03 Thread Shawn Milochik
http://catb.org/~esr/faqs/smart-questions.html -- 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...@googlegrou

Re: kss with django

2010-02-04 Thread Shawn Milochik
> > Does somebody know which AJAX is the best for Django - jQuery, JSON or > something similar (KSS not any more?). > So I can search for instructions. > > Best regards > Ogi Neither jQuery nor JSON are AJAX. JSON is JavaScript Object notation -- the object type in JavaScript. If you're doing

Re: django_evolution evolve not found

2010-02-05 Thread Shawn Milochik
Django evolution has been discontinued. People use South instead. http://south.aeracode.org/ If you need help with it, I'd be glad to help. 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: django_evolution evolve not found

2010-02-06 Thread Shawn Milochik
No, I have no connection to South other than using and loving it. I used to do all my DB work manually, so having the Django ORM and South is like someone recognizing that and saying "Good work; we'll take it from here." Shawn -- You received this message because you are subscribed to the

Re: Sub-classing users something else

2010-02-08 Thread Shawn Milochik
ALJ, I think you'd greatly benefit from just using this: http://docs.djangoproject.com/en/1.1/topics/auth/#storing-additional-information-about-users You can create a model to store all your info, and use the built-in settings.py option AUTH_PROFILE_MODULE. Essentially you're adding fields to t

Re: Javascript Modal Window

2010-02-08 Thread Shawn Milochik
You can use a jQuery UI Dialog. It can be modal, and you can easily use some jQuery AJAX to submit your login view and receive the 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 django-us..

Re: Page not found for password_reset_confirm

2010-02-08 Thread Shawn Milochik
Go into the admin and edit the entry in the Sites application for your site. It's using example.com as a placeholder. 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

Re: Page not found for password_reset_confirm

2010-02-08 Thread Shawn Milochik
Check the actual URL you're receiving in your e-mail. See if it matches any of the patterns in your urls.py. One thing that looks odd to me is that your pattern for forgot-password ends with '?$," which doesn't look right to me. But it seems like you're saying the problem is after that point. I

Re: What hosting companies do you use for django hosting?

2010-02-09 Thread Shawn Milochik
This is about the oldest FAQ. Here you go: http://djangofriendly.com/hosts/ Having said that, I use Slicehost and Webfaction for my personal projects, and at work we use Softlayer, but will probably move. Shawn -- You received this message because you are subscribed to the Google Groups "Dj

Re: Tutorial 1: AttributeError at /time/ 'module' object has no attribute 'now'

2010-02-09 Thread Shawn Milochik
Perhaps replace the bare 'now' with a tuple: Before: > html = "It is now %s." % now After: > html = "It is now %s." % (now,) 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.

Re: Tutorial 1: AttributeError at /time/ 'module' object has no attribute 'now'

2010-02-09 Thread Shawn Milochik
On Feb 9, 2010, at 5:24 PM, Mike Ramirez wrote: > On Tuesday 09 February 2010 14:19:17 Nick Mellor wrote: >> Thanks Shaun, >> >> I renamed the "now" variable as "dt" but it didn't help. I've also >> tried your 1-tuple idea-- no change. >> >> Note that the offending line isn't the html assignmen

Re: Questions about Django suitability

2010-02-09 Thread Shawn Milochik
You could do this in Django. Creating and editing the XML in JavaScript sounds like masochism. Why not just use Python? I agree with Brice's comment -- can you make things easier on yourself and use JSON instead of XML? Also, if you can use JSON, you might have a natural fit using MongoDB, which

Re: Problem while creating database tables through the models.

2010-02-11 Thread Shawn Milochik
Try changing the database to sqlite3 and see if it works. If so, you know the problem is with Postgres. If not, it's probably something you did. Also, Postges 7.4 is way out of date -- the current is 8.4. It could be that the psycopg2 interface has a problem with a version that old. Shawn --

Re: Middleware for models

2010-02-12 Thread Shawn Milochik
It looks like you might want to create a custom Manager class. As you alluded to, you definitely don't want to have to assume that every function that touches your models is doing all the required checking. http://docs.djangoproject.com/en/1.1/topics/db/managers/ I didn't really know what a Man

Re: Middleware for models

2010-02-13 Thread Shawn Milochik
Karol, Check this out: http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser I used this so I could get the current user anywhere. My use for this is to know the request.user when the post_save signal fires so I can log the attributes of a model each time it's saved and know who did it

Re: AJAX Autocompletion Field

2010-02-13 Thread Shawn Milochik
I don't know of any cons regarding jQuery, unless the others who you work with or communicate with all use something else. Here's a fully-working example (from which you can easily create yours). It's not exactly a tutorial, but it should be all you need. http://docs.jquery.com/Plugins/Autocomp

Re: Django 1.2 and Python 3.X ?

2010-02-14 Thread Shawn Milochik
No: http://docs.djangoproject.com/en/dev/faq/install/#can-i-use-django-with-python-3 A lot of third-party modules have to be updated first. And when it doest happen, it'll be big enough news that you'll probably hear about it. When in doubt, check docs.djangoproject.com -- the answer is usually

Re: URLs and Regex Question for passing email address?

2010-02-15 Thread Shawn Milochik
It sounds like this might be a good case for a GET (querystring). As in: http://localhost:8000/contact/?email=ronald.ninnis%40cdu.edu.au/ Then use something like request.GET.get('email', '') to get the value. That seems easier and cleaner than trying to have a URL pattern regex match every val

Re: strange 404 on favicon.ico in the admin

2010-02-15 Thread Shawn Milochik
The browser looks for a favicon (the little image that appears in the address bar next to the URL). I got those errors on my WebFaction account until I created a favico.ico file and added its location to the Apache config. A quick Google search will find various Web sites which will take an imag

Extra model attributes.

2010-02-15 Thread Shawn Milochik
My application stores information about clinical trial and patients. We have a model for the patient which has the usual fields, such as name, date of birth, etc. One of the fields is patient_id, which is optional and is used by some of our clients but not others. As such, the ModelForm will val

Re: Downloadable CSV file of Survey?

2010-02-17 Thread Shawn Milochik
Note: Your "novice Django skills" are irrelevant -- working with CSV files in Django is nothing more than Python. Just check out the docs and examples on the Python CSV module. You'll enjoy working with Python (and Django) a lot more if you take the time to read a book or two, do tutorials, and

Re: Fine-grained object level permissions

2010-02-18 Thread Shawn Milochik
On Feb 18, 2010, at 9:29 AM, Jacek Furmankiewicz wrote: > Is it possible to intercept the QuerySets that Django generates? Yes, make a custom manager: http://docs.djangoproject.com/en/dev/topics/db/managers/ Brief: When you use 'objects' (as in MyModel.objects), you're using the default m

Re: Making a User Registration form

2010-02-19 Thread Shawn Milochik
http://bitbucket.org/ubernostrum/django-registration/ -- 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...@goo

Re: Making a User Registration form

2010-02-20 Thread Shawn Milochik
On Feb 20, 2010, at 10:11 AM, Wiiboy wrote: > Wait, but do profile fields get displayed as part of the form? This is Django. It can do whatever you want it to. Django-registration was specifically written to be reusable so that, for example, templates can be overridden with your own. Shawn -

Re: Django CMS

2010-02-20 Thread Shawn Milochik
I used the same comparison you did, and I ended up going with Django-CMS. I like it a lot. As for importing the content, that should be pretty easy. Once you see how Django-CMS works you'll just need to make a simple HTML template and then transfer the data from your old database into the appr

Re: Treat two fields as one in a queryset

2010-02-20 Thread Shawn Milochik
If you know how to do it in SQL, just make your own manager. http://docs.djangoproject.com/en/1.1/topics/db/managers/ Yay for Django! 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: How to Create models with columns not corresponding to database.

2010-02-21 Thread Shawn Milochik
From your question, it is clear that you don't understand what the admin app is. At least do the Django tutorial before you start asking how to do things. Your question is like asking how to use PHPMyAdmin to create this report. Shawn -- You received this message because you are subs

Re: Othogonal aspects to models

2010-02-21 Thread Shawn Milochik
Check out James Bennett's DjangoCon 2008 talk on reusable apps. He goes into some detail on how he made django-registration in such a way that it wasn't necessary to require a specific model in order for it to work. I haven't implemented anything this reusable myself so I can't really give you m

Re: what is up with InternalError current transaction is aborted, commands ignored until end of transaction block

2010-02-22 Thread Shawn Milochik
The problems is that some part of your code is screwing up something with your database connection. Then, some other part of your code tries to use the database and it can't, so it breaks. Find out where the error is coming from (from your traceback), then figure out what code executes before th

Re: weird problem with django admin models and webfaction

2010-02-22 Thread Shawn Milochik
Did you manually restart the Apache instance for this app? I had a similar problem, and it turned out that I had a bit of code in one of my model that was pulling from a table that was no longer defined. Check for that as well. -- You received this message because you are subscribed to the Go

Re: Problem with DateField (Rooky)

2010-02-22 Thread Shawn Milochik
DEFAULT_DATE_INPUT_FORMATS is on the deprecation timeline, just FYI. The formatting options are for the way data can be input into a form object. Django always stores dates the same way (per database backend). Are you using Django with an already-existing database full of data? Also, your code

Re: usage of conditional blocks

2010-02-23 Thread Shawn Milochik
Okay. If your point is that you understand the way it's meant to work and you don't agree with it, then the answer to your question is that you can't do it that way in Django's templating system. I don't know why the Django developers made that decision, but I'd bet it makes template validatio

Re: question regarding blocks in templates

2010-02-23 Thread Shawn Milochik
Both forks are not being executed within the 'if' block. The template is validated before being rendered, and it fails validation so it's not even getting that far. So just put the block tags outside the 'if' block and you will be fine. I'm not clear on what you were getting at in the 'BUT, I a

Re: schema migration

2010-02-24 Thread Shawn Milochik
+1 on South Shawn On Feb 24, 2010, at 7:20 AM, Gonzalo Delgado wrote: > El 24/02/10 09:16, dj_vishal escribió: >> plz suggest me which is the better one for the schema >> migration for django apps >> > > http://south.aeracode.org/ > > -- > Gonzalo Delgado > > -- > You received this messag

Re: Django in the enterprise?

2010-02-24 Thread Shawn Milochik
What do you mean by '...a good replacement for Java EE..."? Python is a language. Django is a framework written in Python. You can make any kind of site at all with them. My company's Web applications do things like fund debit cards, communicate with bank APIs, calculate driving reimbursement a

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