Re: Formset and Classes with ForeignKeys

2008-12-20 Thread stormlifter
Think I found an answer here: http://www.djangosnippets.org/snippets/1248/ --~--~-~--~~~---~--~~ 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: Need help writing file to specific directory

2008-12-20 Thread Brandon Taylor
solved: os.chdir(path) Hope that helps someone! On Dec 20, 10:13 pm, Brandon Taylor wrote: > Hi everyone, > > I'm unpacking files in a .zip and need to save each file into a > particular directory, but I can't seem to find a way to set the > directory to save into.

Using FormSet to deal with ForeignKey

2008-12-20 Thread stormlifter
Here's what my models.py class Person(models.Model): first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30) # employer = models.CharField(max_length=100) # position = models.CharField(max_length=50) email = models.EmailField()

Formset and Classes with ForeignKeys

2008-12-20 Thread stormlifter
Here are what my models look like == # Standard Header for application models from django.db import models from django.forms import ModelForm #imported for use of "USPhoneNumberField" and "USStateField" from

Need help writing file to specific directory

2008-12-20 Thread Brandon Taylor
Hi everyone, I'm unpacking files in a .zip and need to save each file into a particular directory, but I can't seem to find a way to set the directory to save into. Here is part of my code where I'm opening the .zip and iterating over the files: thumb_zip_file =

Re: cross table querying

2008-12-20 Thread Malcolm Tredinnick
On Fri, 2008-12-19 at 19:58 -0800, Shuge Lee wrote: [...] It's not really necessary to post all that SQL and Python, since you're only really asking about a couple of the models. If you can reduce your example to the smallest case possible, it's easier for everybody to read (just a tip). > how

Re: reverse foreign key lookup in extra()

2008-12-20 Thread Malcolm Tredinnick
On Fri, 2008-12-19 at 11:10 -0800, Fereshteh wrote: > Hi, > I am trying to add a filtering functionality to my web application. I > create a WHERE clouse text in the client side as text and post it to > the server. > > My Django modele lookes like this: > class Projects(models.Model): > id =

Re: Admin formatting

2008-12-20 Thread Graham Dumpleton
On Dec 21, 12:54 pm, Jeff Anderson wrote: > MS wrote: > > I am learning Django under Windows Vista. > > > I am using Python 2.5 and Wamp5. The document root for Apache is set > > to c:/wamp/www/ > > > I have a project under c:/wamp/www/DjangoProjects/mysite > > Don't

Re: image uploading, validation by using form

2008-12-20 Thread Brandon Taylor
Hi, You can do validation on images by using a custom form for your admin Model. This example validates that a thumbnail image is a specific dimension, file type and file size, from django.core.files.images import get_image_dimensions class MyModelAdminForm(forms.ModelForm): model =

image uploading, validation by using form

2008-12-20 Thread Chuck22
Here is my model: class Book(models.Model): title = models.CharField(max_length=150) category = models.CharField(max_length=50) description = models.CharField(max_length=2000) image1 = models.ImageField(upload_to='img/bk', blank=True) image2 =

Re: "Building you first Django app, Part 1" example not working

2008-12-20 Thread Jeff Anderson
Chris wrote: > When I'm in the command line, and run the command django-admin.py > startproject mysite, I don't get an error, but nothing happens... as > far as I can tell! Did you check to see if the 'mysite' directory was created? Here's what it looks like on my osx terminal:

Re: Admin formatting

2008-12-20 Thread Jeff Anderson
MS wrote: > I am learning Django under Windows Vista. > > I am using Python 2.5 and Wamp5. The document root for Apache is set > to c:/wamp/www/ > > I have a project under c:/wamp/www/DjangoProjects/mysite > Don't do that. You don't need your python code in the document root, and it's a bad

custom templatetags and problem with importing photologue.models - namespace collision?

2008-12-20 Thread Bartek
Hi all I've experienced problems with import photologue.models into my templatetag module. When I loop over sys.modules in templatetags/pobierz.py there's django.templatetags.photologue, so probably that's why "from photologue.models import Gallery" throws ImportException - there's not models

Re: Can anyone explain why reverse() never seems to work?

2008-12-20 Thread James Bennett
On Sat, Dec 20, 2008 at 3:02 PM, Bradley Wright wrote: > Given the following code, can anyone explain why Django can't reverse > this, because I'm of the opinion that reverse is the flakiest function > ever: The permalink decorator is a shortcut which will, on its own, apply

Can anyone explain why reverse() never seems to work?

2008-12-20 Thread Bradley Wright
Given the following code, can anyone explain why Django can't reverse this, because I'm of the opinion that reverse is the flakiest function ever: << models.py >> class Post(models.Model): """created is a datetime object""" @permalink def get_absolute_url(self): params =

Re: Django model filter

2008-12-20 Thread Fridrik Mar Jonsson
Hi Kev, > Im a bit confused with django model api and cannot seem to figure out > how to do: > > SQL WHERE (user == username AND friend == friend) OR (user == friend > AND friend == user). Please see the following piece of documentation:

Django model filter

2008-12-20 Thread kev
Hello, Im a bit confused with django model api and cannot seem to figure out how to do: SQL WHERE (user == username AND friend == friend) OR (user == friend AND friend == user). How would django model api write that code? Thanks, Kevin --~--~-~--~~~---~--~~ You

Re: Restricting add in the admin

2008-12-20 Thread Peter
> Very relevant, don't forgot to overload the save method to set > other is_active to 0! > > Regards, James. Ah - yes that would seem a good idea :-). P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Advanced Permissions and States

2008-12-20 Thread makkalot
Hi i'm developing an e-commerce site with Django, and have situations like this : - A user can execute different operations in different time-intervals if he has the right privileges. Ex : A user can edit only his products Ex : A user can edit only his orders when he has bought

Re: urls.py password reset view.

2008-12-20 Thread kev
Thank you! :) Kevin On Dec 20, 12:54 pm, Jeff FW wrote: > That error is occuring because you don't have a URL defined for > password_reset_done, which, presumably, is being referred to in your > forgotpassword.html in a {% url %} tag.  Check out this brief > tutorial, it's

Re: mod_wsgi // Stack trace does not show in log files or gets sent by email

2008-12-20 Thread Stefan Wallner
So I spent the last few days debugging and was able to solve half the problem, i.e. the mails-not-getting-sent one: Turns out that the mail server I was told to use does swallow messages containing a stack trace, presumably due to spam filtering. The nice thing was that a) the sys admin told me

Re: template inheritance miff

2008-12-20 Thread bruno desthuilliers
On 20 déc, 18:48, "Milan Andric" wrote: > Hello, > > I have two templates in this example, > page_base.htmlhttp://dpaste.com/101058/and intro.html > http://dpaste.com/101059/. > intro.html inherits from page_base.html, but the content_head block > does not get inherited.

Admin formatting

2008-12-20 Thread MS
I am learning Django under Windows Vista. I am using Python 2.5 and Wamp5. The document root for Apache is set to c:/wamp/www/ I have a project under c:/wamp/www/DjangoProjects/mysite If I run it using the Django built-in server it works fine. If I run it using Apache and wsgi-python the

Re: Restricting add in the admin

2008-12-20 Thread James PIC
On Sat, Dec 20, 2008 at 3:17 PM, Peter wrote: > > > > On Dec 20, 1:03 pm, felix wrote: >> just a thought: >> >> you might consider allowing multiple front page objects and having a way to >> select the current one. >> this could come in handy to

Re: SyncDB failure

2008-12-20 Thread James PIC
>> Just for kidding: >> class Lot(Mandat, Bien, PourLocation, PourVente, LotAddresse, >> AvecEquipementsAnnexes, Textes, Immeuble): >> It was that, or models with thousands of similar fields, high WTF/hour :) > > just be thankful you aren't coding in german :) It's very

Re: urls.py password reset view.

2008-12-20 Thread Jeff FW
That error is occuring because you don't have a URL defined for password_reset_done, which, presumably, is being referred to in your forgotpassword.html in a {% url %} tag. Check out this brief tutorial, it's rather handy: http://www.rkblog.rk.edu.pl/w/p/password-reset-django-10/ -Jeff On Dec

template inheritance miff

2008-12-20 Thread Milan Andric
Hello, I have two templates in this example, page_base.html http://dpaste.com/101058/ and intro.html http://dpaste.com/101059/ . intro.html inherits from page_base.html, but the content_head block does not get inherited. what am i doing wrong or mis-understanding? Thanks for your help,

urls.py password reset view.

2008-12-20 Thread kev
Hello, I have the following entry in urls.py file: (r'^forgotpassword/$', password_reset, { 'template_name': 'users/forgotpassword.html', 'email_template_name': 'users/forgotpassword_template.html' }), Whenever i try to load it, i get: Reverse for

Re: del session variables

2008-12-20 Thread Jeff FW
Wow, you're right. I've been programming Python for years, and I somehow never noticed that. I'll be quiet not :-) On Dec 17, 6:33 pm, Malcolm Tredinnick wrote: > On Wed, 2008-12-17 at 15:09 -0800, Jeff FW wrote: > > You've got a space in between

Re: newie, django and apache, somethings are not working

2008-12-20 Thread Jeff FW
> the last line of the error is > > * > OperationalError: unable to open database file > ** > > NOtes: I have put the complete path for the DB /home/XXX/djangoProys/ > mysite2/DBmysite2, and I tried change permissions for database file Make sure that apache can read and write the

Re: Django Session Variables

2008-12-20 Thread Jeff FW
Looking at http://code.djangoproject.com/browser/django/trunk/django/contrib/auth/__init__.py#L46 it doesn't look like it clears the session. It *does* generate a new key, but that shouldn't affect anything. It should only take you about two minutes to test it though--just try it out. -Jeff

Re: Help with batch processing

2008-12-20 Thread Jeff FW
Check out: http://www.doughellmann.com/PyMOTW/contents.html He's got tutorials on quite a lot of the python stdlib--very handy resource. csv and zipfile are on there. -Jeff On Dec 19, 9:40 pm, Brandon Taylor wrote: > I've been looking at the methods from those libs.

Re: admin: datetime field as date (not date and time)

2008-12-20 Thread Fridrik Mar Jonsson
Hi Mel, Have you considered switching to a ``DateField``? Regards, Friðrik Már On Dec 20, 11:05 am, Mel wrote: > Is it possible to configure the admin site to render datetime fields > as a date only? I have no need of the time at all, in this instance.

Re: Admin Site

2008-12-20 Thread samira
You are right, I find that by mistake I user active account. thanks alot On Dec 20, 5:55 pm, Fridrik Mar Jonsson wrote: > Hi Samira! > > On Dec 17, 5:34 pm, samira wrote: > > > Caught an exception while rendering: Tried activateAccount in module > >

Re: database sqlite3

2008-12-20 Thread CodeBandit
I too have this error... Windows XP... Django 1.0.2... Sqllite3 (as it comes with Python 2.5). The sqlite3.dll file was also installed with Firefox. I wonder if that has something to do with this. C:\Django\mysite>manage.py dbshell Error: You appear not to have the 'sqlite3' program installed or

admin: datetime field as date (not date and time)

2008-12-20 Thread Mel
Is it possible to configure the admin site to render datetime fields as a date only? I have no need of the time at all, in this instance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: Admin Site

2008-12-20 Thread Fridrik Mar Jonsson
Hi Samira! On Dec 17, 5:34 pm, samira wrote: > Caught an exception while rendering: Tried activateAccount in module > mywebSite.mywebSite_app.views. Error was: 'module' object has no > attribute > 'activateAccount' > > can anu body knows about activeAccount attribute? As

Re: Admin Site

2008-12-20 Thread samira
This is what I done for activate my admin site: in Urls.py I write this: from django.contrib import admin admin.autodiscover() urlpatterns += patterns('', (r'^' + PROJECT_URL + '/media/(?P.*)$', 'django.views.static.serve',{'document_root': settings.MEDIA_ROOT}), (r'^' + PROJECT_URL +

Re: Restricting add in the admin

2008-12-20 Thread Peter
On Dec 20, 1:03 pm, felix wrote: > just a thought: > > you might consider allowing multiple front page objects and having a way to > select the current one. > this could come in handy to switch what is currently the front page (or to > audition the new front page). >

Re: Admin Site

2008-12-20 Thread samira
I checked my source code alot, but nothing is wrong in it. Also as I mentioned it is work on my local.Shall I set something on site for it? On Dec 17, 8:43 pm, "Jeremy Dunck" wrote: > On Wed, Dec 17, 2008 at 11:34 AM, samira wrote: > > > I

Re: SyncDB failure

2008-12-20 Thread felix
here's the exact ticket you are looking for: http://code.djangoproject.com/ticket/1820 On Sat, Dec 20, 2008 at 2:19 PM, felix wrote: > > On Fri, Dec 19, 2008 at 2:29 PM, James PIC wrote: > >> >> On 12/17/08, Russell Keith-Magee

Re: SyncDB failure

2008-12-20 Thread felix
On Fri, Dec 19, 2008 at 2:29 PM, James PIC wrote: > > On 12/17/08, Russell Keith-Magee wrote: > > > > > A better solution would be to come up with a name munging scheme that > > guaranteed to give unique permission names that will always fit into

Re: Restricting add in the admin

2008-12-20 Thread felix
just a thought: you might consider allowing multiple front page objects and having a way to select the current one. this could come in handy to switch what is currently the front page (or to audition the new front page). otherwise : create one using initial_data so that your application

Re: MySpace clone using Django? Is it possible?

2008-12-20 Thread felix
oh for that you will need to use Fusebox On Fri, Dec 19, 2008 at 7:41 PM, lekvar...@gmail.com wrote: > > Hi, I wanna know wich of the well known frameworks is the best choice > for myspace-clone community website. > > CakePHP ? Zend Framework? Symfony? > Django :)? >

Saving a query set to a model

2008-12-20 Thread mtnpaul
Any thoughts or ideas on doing this? Can I just pickle the query set to a string and save it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Delete multiple items from an admin change list

2008-12-20 Thread bcurtu
Thanks, that's it On 19 dic, 18:04, Jeff Kowalczyk wrote: > On Dec 19, 6:15 am, bcurtu wrote: > > > Is it possible to get the admin item list with a kind of checkboxes in > > order to select multiple items and delete them all together? > >

Re: cross table querying

2008-12-20 Thread Daniel Roseman
On Dec 20, 3:58 am, Shuge Lee wrote: > how to do following querying in Django 1.0 ? > > mysql> select product.name, os.name from product inner join os where > product.id = os.id ; > +-+-+ > | name| name| > +-+-+ > | MS

Re: Limiting HTTP request size

2008-12-20 Thread Graham Dumpleton
On Dec 20, 9:19 pm, Andreas Gustafsson wrote: > On Dec 19, 11:45 pm, Graham Dumpleton > wrote: > > > It hasn't got anything to do with LimitRequestBody. That this but > > exists in current versions of mod_python and can crop up at random > > times is

Re: Limiting HTTP request size

2008-12-20 Thread Andreas Gustafsson
On Dec 19, 11:45 pm, Graham Dumpleton wrote: > It hasn't got anything to do with LimitRequestBody. That this but > exists in current versions of mod_python and can crop up at random > times is a good reason why you don't want to be using mod_python. I've never seen

Re: MySpace clone using Django? Is it possible?

2008-12-20 Thread Antoni Aloy
A clone lot of sense if is very specific. That is, you can have a Facebook/MyEspace/whatever clone for example in your own company (think in a company with 1000+ employees in diferent locations) where you can provide an interface that some people could be familiar with. This was once a time

"Building you first Django app, Part 1" example not working

2008-12-20 Thread Chris
When I'm in the command line, and run the command django-admin.py startproject mysite, I don't get an error, but nothing happens... as far as I can tell! When I cd'd into the directory I'm working in, I did exactly what the tut said – I'm on OS X Leopard with Python 2.5, if that helps anyone help