Re: can't clear form data in runserver (works in shell)

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 23:05 -0800, Mark Jones wrote: > I have a form that is working well. However I want to allow them to > reuse the form multiple times. Each time they submit the form, I will > send up to 6 emails. Then, if an email is sent successfully, Right there you have your first

Re: EmptyResultSet exception

2009-02-02 Thread omat
I am using a recent svn checkout. I opened a ticket for the issue: http://code.djangoproject.com/ticket/10181 Best. On Feb 3, 5:03 am, Malcolm Tredinnick wrote: > On Mon, 2009-02-02 at 03:23 -0800,omatwrote: > > Hi, > > > I am receiving an EmptyResultSet exception

Re: object_detail 404 (queryset outdated?)

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 22:32 -0800, Simon Westphahl wrote: > On 3 Feb., 03:54, Malcolm Tredinnick wrote: > > Have you verified that an object exists for whatever the slug value is > > that you're passing in? Using Django's debug page, you should be able to > > see the

can't clear form data in runserver (works in shell)

2009-02-02 Thread Mark Jones
I have a form that is working well. However I want to allow them to reuse the form multiple times. Each time they submit the form, I will send up to 6 emails. Then, if an email is sent successfully, I want to remove that email address from the form that I present to them. If the email isn't

Re: Can't create a record with a Foreign Key: IntegrityError: (1048, "Column 'user_id' cannot be null")

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 22:22 -0800, Theme Park Photo, LLC wrote: > I can't get anything with Foreign keys to work. I trimmed everything > down to the simplest example: > > from django.db import models > from django.contrib.auth.models import User > > class Ranking(models.Model): > user =

Re: Django session

2009-02-02 Thread Malcolm Tredinnick
On Tue, 2009-02-03 at 13:26 +0700, Harryanto Ie wrote: > thx, but i didn't get what i need for, how to create > session using request.session[] with multi value. You got most of what you needed, though. I attempt to answer the broader problem people ask, particularly when there's confusion

Re: object_detail 404 (queryset outdated?)

2009-02-02 Thread Simon Westphahl
On 3 Feb., 03:54, Malcolm Tredinnick wrote: > Have you verified that an object exists for whatever the slug value is > that you're passing in? Using Django's debug page, you should be able to > see the slug value and try it out at a Python prompt. That would be the >

Re: Django session

2009-02-02 Thread Harryanto Ie
thx, but i didn't get what i need for, how to create session using request.session[] with multi value. On Tue, 03 Feb 2009 17:07:36 +1100 Malcolm Tredinnick wrote: > > On Tue, 2009-02-03 at 12:55 +0700, Harryanto Ie wrote: >> i.e def login is called with the

Can't create a record with a Foreign Key: IntegrityError: (1048, "Column 'user_id' cannot be null")

2009-02-02 Thread Theme Park Photo, LLC
I can't get anything with Foreign keys to work. I trimmed everything down to the simplest example: from django.db import models from django.contrib.auth.models import User class Ranking(models.Model): user = models.ForeignKey(User) score = models.IntegerField() def

Re: Django session

2009-02-02 Thread Malcolm Tredinnick
On Tue, 2009-02-03 at 12:55 +0700, Harryanto Ie wrote: > i.e def login is called with the login template, The code you have posted only passes "request" to the login() function. If you passed anything else, it would fail, since your login() function only expects one parameter. > example > the

Re: Django session

2009-02-02 Thread Harryanto Ie
i.e def login is called with the login template, example the first client's username is JOHN and the second is DAPH JOHN's module template is moduleA and DAPH's module template is moduleB. when JOHN login the session has create with username JOHN (request.session['userlogin'] = login.name)

Re: Displaying Data from Multiple Tables

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 21:37 -0800, Alexiski wrote: > > > On Mon, 2009-02-02 at 21:21 -0800, Alexiski wrote: > > > Hi Malcolm, > > > > > Thanks for your response, but I'm not quite sure how to iterate using > > > obj.query.all to get all the instances I'm after. > > > > > Could you please provide

Difficulty with filtering a queryset using the "in" method

2009-02-02 Thread Brandon Taylor
Hi everyone, I need to return a queryset using the "in" statement. My IDs are in an array of int values. vehicle_ids = [1, 2, 3] If I do: vehicles = VehiclePhoto.objects.filter(vehicle__id__in= [vehicle_ids]) I get a type error: sequence item 0, expected string, int found. I've tried just

Re: NetBeans IDE for Python

2009-02-02 Thread mrsixcount
Can't seem to get the auto complete to work when I import django.db.models as models. Shows models when I start typing but after the . nothing in the django model section comes up. Shows the master list of python options. IntegerField isn't in there nor could I find any of the other ones. Oh

openlayers TemplateSyntaxError

2009-02-02 Thread Waruna de Silva
Hi , I'm newbie to django as well as geodjango. I tried out first tutorial in geodjango docs using world data. When i tried to add new entry or tying to modified existing entry i get following errors.

Re: Displaying Data from Multiple Tables

2009-02-02 Thread Alexiski
> On Mon, 2009-02-02 at 21:21 -0800, Alexiski wrote: > > Hi Malcolm, > > > Thanks for your response, but I'm not quite sure how to iterate using > > obj.query.all to get all the instances I'm after. > > > Could you please provide a code snippet or direct me to a relevant > > page? > > Iteration

Re: newbie: printing a date in a template

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 10:08 -0800, KJ wrote: > On Feb 2, 7:11 pm, Christian Joergensen wrote: > > > > Is `todaysdate` listed in your context? > > > > This is my return line for the view, the locals() part should add all > the local variables to the template context right? > >

Re: Displaying Data from Multiple Tables

2009-02-02 Thread Malcolm Tredinnick
On Tue, 2009-02-03 at 16:28 +1100, Malcolm Tredinnick wrote: > On Mon, 2009-02-02 at 21:21 -0800, Alexiski wrote: > > Hi Malcolm, > > > > Thanks for your response, but I'm not quite sure how to iterate using > > obj.query.all to get all the instances I'm after. > > > > Could you please provide

Re: Displaying Data from Multiple Tables

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 21:21 -0800, Alexiski wrote: > Hi Malcolm, > > Thanks for your response, but I'm not quite sure how to iterate using > obj.query.all to get all the instances I'm after. > > Could you please provide a code snippet or direct me to a relevant > page? Iteration in templates

Re: Django session

2009-02-02 Thread Malcolm Tredinnick
On Tue, 2009-02-03 at 12:17 +0700, Harryanto Ie wrote: > hmm... i have createed the server, and i have 2 client > site. each client has different module to access and there > are separated when login section. > > i'm doing now is : > i.e : > > def login(request) : >login = >

Re: Displaying Data from Multiple Tables

2009-02-02 Thread Alexiski
Hi Malcolm, Thanks for your response, but I'm not quite sure how to iterate using obj.query.all to get all the instances I'm after. Could you please provide a code snippet or direct me to a relevant page? Thanks again, Alex On Feb 3, 4:04 pm, Malcolm Tredinnick

Re: Django session

2009-02-02 Thread Harryanto Ie
hmm... i have createed the server, and i have 2 client site. each client has different module to access and there are separated when login section. i'm doing now is : i.e : def login(request) : login = User.objects.get(username=request.POST['uname']) request.session['userlogin'] =

Re: Integrating raw SQL and model objects

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 23:56 -0500, Jack Orenstein wrote: > Hello, I am new to Django, and trying to figure out how best to use > it. My immediate problem is that I'm trying to figure out how to use > raw SQL in combination with the model layer. Here are the issues I've > run into: > > 1)

Re: Displaying Data from Multiple Tables

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 20:52 -0800, Alexiski wrote: > Hi all, > This is a difficulty related to me being new to Django/Python I > assume, so I hope you can forgive my ignorance and help me out :) > > I have 4 tables - User(overriding the user object), Copy, Query, > QueryClassification. The main

Re: newbie: printing a date in a template

2009-02-02 Thread Harryanto Ie
i think you must put like this : return render_to_response('items/browse.html', locals(), context_instance=RequestContext(request), {'todaysdate':todaysdate}) On Mon, 2 Feb 2009 10:08:37 -0800 (PST) KJ wrote: > > On Feb 2, 7:11 pm, Christian Joergensen

Integrating raw SQL and model objects

2009-02-02 Thread Jack Orenstein
Hello, I am new to Django, and trying to figure out how best to use it. My immediate problem is that I'm trying to figure out how to use raw SQL in combination with the model layer. Here are the issues I've run into: 1) How do I turn a row into a model object? There is some discussion of

Displaying Data from Multiple Tables

2009-02-02 Thread Alexiski
Hi all, This is a difficulty related to me being new to Django/Python I assume, so I hope you can forgive my ignorance and help me out :) I have 4 tables - User(overriding the user object), Copy, Query, QueryClassification. The main tables are Copy and Query. There can be many Queries for each

Re: django sqlite autoincrement bug

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 23:16 -0500, alexander lind wrote: > > On Feb 2, 2009, at 10:05 PM, Malcolm Tredinnick wrote: > > > I always make my auto-inc fields primary as well, so no argument > > > there. > > > I tried using the AutoField when I noticed django didn't create > > > the > > >

Re: django sqlite autoincrement bug

2009-02-02 Thread alexander lind
On Feb 2, 2009, at 10:05 PM, Malcolm Tredinnick wrote: >> I always make my auto-inc fields primary as well, so no argument >> there. >> I tried using the AutoField when I noticed django didn't create the >> auto-incrementing fields correctly by itself in sqlite, but that >> didn't work either

Re: select_related and OneToOneField

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 14:40 -0500, Michael Hrivnak wrote: > Does select_related work for OneToOneField relationships? Yes. This wasn't something you could have just tried out and seen for yourself? > If so, does it work > in both directions? No. Probably will in 1.1, but not yet. Regards,

Re: Can I control contents of SELECT in queryset?

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 09:50 -0800, phoebebright wrote: > After replicating you test and it still failing and various other > experiments I downloaded the latest django trunk and it works fine! > Always check the version first Phoebe! > > Sorry for the run around. > > For the record here are the

Re: django sqlite autoincrement bug

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 09:42 -0500, alexander lind wrote: > >>> Shows how infrequently AutoField's are really used in practice. > >>> They're > >>> generally just not that useful to specify. > >> > >> > >> What else do people use for specifying autoinc fields? > > > > Auto-increment fields

Re: EmptyResultSet exception

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 03:23 -0800, omat wrote: > Hi, > > I am receiving an EmptyResultSet exception in 'in' lookups, if the > lookup is against an empty ValuesListQuerySet. > > Here is the case: > > >>> ids = Tag.objects.filter(id__in=[]).values_list(id, flat=True) > > Now the ids is an empty

Re: problem with admin in a .90 site

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 14:36 +0530, Kenneth Gonsalves wrote: > hi, > I have an old site running on revision 2486 - had not touched it for years > and > since it wasnt broken nor needed new features, I did not upgrade it. A new > model was required, so I added it, but it was not appearing in

Re: Session Variables as Default Form Values

2009-02-02 Thread Ty
Ah, DURR. I just had to put "initial=" before the dictionary. Now it all makes sense! On Feb 2, 9:48 pm, Ty wrote: > Yes, but that would bound the data to the form and the data would try > to be validated on page load. I'm looking to pass default values to an > unbound

Re: object_detail 404 (queryset outdated?)

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 00:16 -0800, Simon Westphahl wrote: > Hi, > > I'm getting the following 404 when accessing an objects detail page. > > ### > Page not found (404) > Request Method: GET > Request URL: http://127.0.0.1:8000/offers/service/testservice/ > > No found > matching the query Hmm

Re: how to check manytomany field in filter?

2009-02-02 Thread garagefan
well... that worked... to be 100% honest... i didn't expect it to. Guess i'm still underestimating the framework thanks :) On Feb 2, 9:28 pm, Martin Conte Mac Donell wrote: > On Tue, Feb 3, 2009 at 12:21 AM, garagefan wrote: > > > Trying to test a

Re: Session Variables as Default Form Values

2009-02-02 Thread Ty
Yes, but that would bound the data to the form and the data would try to be validated on page load. I'm looking to pass default values to an unbound form. On Jan 30, 7:13 pm, "Todd O'Bryan" wrote: > You can pass data to a form class as a dictionary, so just save a >

Re: Making fields conditionally required based on another field's state

2009-02-02 Thread Martin Conte Mac Donell
On Mon, Feb 2, 2009 at 7:21 PM, wotaskd wrote: > > Hello everyone, a quick (and I guess easy) one: > > Is there any way, on the admin site, to make a field for a model > mandatory, if another one is blank and vice-versa? Yeap, you need to write your own form class, subclass

Re: how to check manytomany field in filter?

2009-02-02 Thread Martin Conte Mac Donell
On Tue, Feb 3, 2009 at 12:21 AM, garagefan wrote: > > Trying to test a manytomany field in a model that will be user names. > Building that is simple enough in the model, and so is selecting the > users in the admin. > > the problem is filtering a query to test the

how to check manytomany field in filter?

2009-02-02 Thread garagefan
Trying to test a manytomany field in a model that will be user names. Building that is simple enough in the model, and so is selecting the users in the admin. the problem is filtering a query to test the current logged in user with the manytomany field to ensure they are listed. ie:

Re: forms not valid

2009-02-02 Thread Martin Conte Mac Donell
On Mon, Feb 2, 2009 at 11:35 PM, vierda wrote: > > Hi all, I have three forms and none of these forms pass is_valid() > test when I test in intrepeter. kindly help for point out what's > problem with my forms. thank you. > > from django.contrib.auth.models import User > from

Re: Custom Aggregate Objects

2009-02-02 Thread alex.gay...@gmail.com
On Feb 2, 9:05 pm, nsitarz wrote: > Hey, > > Back when the ORM aggregate support was a patch in trac I used to > create custom aggregate objects that looked like this: > > class Date(Aggregate): >     pass > > class DateHour(Aggregate): >     def __init__(self, lookup): >    

Custom Aggregate Objects

2009-02-02 Thread nsitarz
Hey, Back when the ORM aggregate support was a patch in trac I used to create custom aggregate objects that looked like this: class Date(Aggregate): pass class DateHour(Aggregate): def __init__(self, lookup): super(DateHour, self).__init__(lookup) self.sql_template =

Re: Filter by ForeignKey reference??

2009-02-02 Thread Martin Conte Mac Donell
On Mon, Feb 2, 2009 at 11:59 PM, Martin Conte Mac Donell wrote: > If you need country_id/country_name: > Profile.objects.values('country__id', 'country__name').select_related('country').distinct() > [{'country__name': u'Country1', 'country__id': 1},

Re: Filter by ForeignKey reference??

2009-02-02 Thread Martin Conte Mac Donell
On Mon, Feb 2, 2009 at 10:11 PM, Markus T. wrote: > > Hi, > > I have two simple models: > > class Country(models.Model): > name = models.CharField(_("Name"), max_length=50, > unique=True) > > class Profile(models.Model): > name =

Re: Non-typical Install - limited ftp access

2009-02-02 Thread Tim Johnson
On Monday 02 February 2009, elithrar wrote: > Whilst you could technically 'upload' django to the webspace that > you're jailed into, without the package being on the PYTHONPATH you > won't be able to import django into your scripts - you'll need to SSH > in and install the package (via either

forms not valid

2009-02-02 Thread vierda
Hi all, I have three forms and none of these forms pass is_valid() test when I test in intrepeter. kindly help for point out what's problem with my forms. thank you. from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm from django import forms from

Re: Non-typical Install - limited ftp access

2009-02-02 Thread elithrar
Whilst you could technically 'upload' django to the webspace that you're jailed into, without the package being on the PYTHONPATH you won't be able to import django into your scripts - you'll need to SSH in and install the package (via either yum/apt or using the svn checkout) first.

Re: Error saving a Model with a custom image field

2009-02-02 Thread Louis Sayers
I think it must be something that I'm not doing. It all works when I'm using a ModelForm, so there must be a difference between what I'm doing manually, and what the ModelForm does for me. The culprit must be my code: new_image = ImageWithThumbsField(images_to_save[image],

Non-typical Install - limited ftp access

2009-02-02 Thread Tim Johnson
I do not currently use django. I am an experienced web programmer. I've developed my own frameworks, but have a small project to do that I'd like to use as a way of learning and testing django. To the best of my knowledge, here are the circumstances: A virtual domain on a linux redhat or ubuntu

Re: Admin view - merge two tables? (potentially bad db design)

2009-02-02 Thread Carl Meyer
On Feb 2, 6:44 pm, Zbigniew Braniecki wrote: > How can I overwrite the way Questions are selected so that when they > are returned by Question.objects.get('x') or Question.objects.filter() > or Question.objects.all() they are already joined with > QuestionProperties

ifequal and DateQuerySet objects

2009-02-02 Thread Bret W
I've run into a problem with ifequal in one of my templates. I'm using date-based generic view to display all objects for a given year. urls.py: (r'^taken/(?P\d{4})/$' ... Part of the extra_context I pass is a DateQuerySet object: months = Photo.objects.dates('date_taken', 'month',

Re: problem with simple shopping cart

2009-02-02 Thread Andrew Ingram
lnysrogh wrote: > Hello. I'm new to Django (and web development in general), and this is > my first post here. Hope someone can help me. > > I'm trying to build a shopping cart, and my idea is to store the > product information (id and quantity) in a session when I add the > product to the

Filter by ForeignKey reference??

2009-02-02 Thread Markus T.
Hi, I have two simple models: class Country(models.Model): name = models.CharField(_("Name"), max_length=50, unique=True) class Profile(models.Model): name = models.CharField(_("Name"), max_length=50, unique=True) country = models.ForeignKey(Country) If I want

Re: Error saving a Model with a custom image field

2009-02-02 Thread Louis Sayers
I'm running the official release of django 1.02 Do you think there'd be any problems with this version? I've only been using django for the last 2 months, so I'm fairly new to it, and haven't investigated different revisions etc On Feb 3, 12:58 pm, Andrew Ingram wrote: >

Re: Error saving a Model with a custom image field

2009-02-02 Thread Andrew Ingram
Louis Sayers wrote: > I have an Image model: > ... > Exception Type: AttributeError at /listings/add/ > Exception Value: 'ImageWithThumbsField' object has no attribute 'find' > > > I'm really struggling with this error, if anyone has any ideas, I'll > be glad to hear them :) > > Thanks What

problem with simple shopping cart

2009-02-02 Thread lnysrogh
Hello. I'm new to Django (and web development in general), and this is my first post here. Hope someone can help me. I'm trying to build a shopping cart, and my idea is to store the product information (id and quantity) in a session when I add the product to the shopping cart, and retrieve it to

Re: Customized model methods

2009-02-02 Thread Alex Jonsson
On Feb 2, 9:50 pm, Daniel Roseman wrote: > You can define as many methods on a model as you like. Models are just > Python classes, and you can do anything with them that you would do > with a normal class. > > def MyModel(models.Model): >     ... field definitions

Re: How do I add a Custom ID Field that increments?

2009-02-02 Thread Will Hardy
There's no easy solution without saving the object to the database. Auto incrementing fields (AutoField or just id) get their value from the database, so they wont have one until you save. This is good because it prevents multiple objects ever having the same value. One way to do what you want is

Re: Admin view - merge two tables? (potentially bad db design)

2009-02-02 Thread Zbigniew Braniecki
On Feb 2, 7:24 am, Carl Meyer wrote: (...) > The other downside is the extra administration complexity, which is > the meat of your question.  Fortunately Django's admin can help you > out, and it's quite easy: look into inlines[1]. > >

Error saving a Model with a custom image field

2009-02-02 Thread Louis Sayers
I have an Image model: class Image(models.Model): photo = ImageWithThumbsField( upload_to=image_upload_location, sizes=((thumb_widths,thumb_heights),)) The ImageWithThumbsField is something I got from http://code.google.com/p/django-thumbs/ It seems to work fine

Re: FormWizard accessing previous fields data

2009-02-02 Thread lbologn...@gmail.com
On Feb 3, 12:17 am, Johan Liseborn wrote: > Thus, you could do something like (no changes to get_template): > > class EnrollWizard(FormWizard): >     def process_step(self, request, form, step): >        if step == 0: >           self.extra_context['foo'] =

Re: "invalid reference to FROM-clause" for nested annotate query

2009-02-02 Thread Russell Keith-Magee
On Mon, Feb 2, 2009 at 4:46 PM, omat wrote: > > I just remembered that the above error occured when running on > Postgresql 8.2. Sorry for the misinformation about SQLite. > > Then to give it a try with SQLite, I built a fresh database with > syncdb on SQLite. > > This time, at

Re: FormWizard accessing previous fields data

2009-02-02 Thread Johan Liseborn
On Feb 2, 2009, at 23:32, lbologn...@gmail.com wrote: > On Feb 1, 2:38 am, "mattimust...@gmail.com" > wrote: > >> I never understood the logic of it either. I also expected to be able >> to do something like {{previous_fields.firstname }}. > > Found it! > > class

Re: Model Save with Updated Foreign Key

2009-02-02 Thread Jeff
Nevermind. I had overriden the get_query_set with a custom manager that only returned a subset of the CEOs. Word to the wise. On Feb 2, 1:04 pm, Jeff wrote: > So I have two models a CEO model: > class Ceo (models.Model): >     first_name =

Re: FileField and moving or updating files

2009-02-02 Thread felix
I was just learning/dealing with this now. example: class Mix(models.Model): mp3 = models.FileField(upload_to="mixes",blank=True) # let's say the mix object already exists mix = Mix.objects.get( etc ) # however you get a file file = request.FILES[u'Filedata'] # swfupload

Re: simple record output

2009-02-02 Thread John M
BRILLIANT, that's what I was looking for , thanks Jake! On Feb 2, 2:19 pm, Jake Elliott wrote: > hi john - > > you can use the 'spaceless' tag in your > template:http://docs.djangoproject.com/en/dev/ref/templates/builtins/#spaceless > > to filter out spaces & carriage

Re: FormWizard accessing previous fields data

2009-02-02 Thread lbologn...@gmail.com
On Feb 1, 2:38 am, "mattimust...@gmail.com" wrote: > I never understood the logic of it either. I also expected to be able > to do  something like {{previous_fields.firstname }}. Found it! class EnrollWizard(FormWizard): def get_template(self, step):

Re: Wierd FileField behavior

2009-02-02 Thread timc3
Show us the code for your view. But are you sending through the files in the POST each time? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: FileField and moving or updating files

2009-02-02 Thread timc3
So I take it that there is no way of doing this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this

Re: simple record output

2009-02-02 Thread Jake Elliott
hi john - you can use the 'spaceless' tag in your template: http://docs.djangoproject.com/en/dev/ref/templates/builtins/#spaceless to filter out spaces & carriage returns. -jake On Mon, Feb 2, 2009 at 3:41 PM, John M wrote: > > Grrr, I answered my own quesiton, if I

Re: simple record output

2009-02-02 Thread John M
Grrr, I answered my own quesiton, if I remove all the CR's from the template, then it's OK. So changing the template to {% if object_list %}{% for obj in object_list %}{{ obj.name }}{% endfor %}{% endif %} Works like I want. But now, how can I not have the CR's in the template effect my

Making fields conditionally required based on another field's state

2009-02-02 Thread wotaskd
Hello everyone, a quick (and I guess easy) one: Is there any way, on the admin site, to make a field for a model mandatory, if another one is blank and vice-versa? Ex: let's pretend that I have two fields, SSN and ID. The customer has to fill out at least one of the two, any of them, but can't

simple record output

2009-02-02 Thread John M
I'm trying to use the generic views and templates to get a very simple text output of records. I don't want HTML, but need them available from a command line (via curl). Here's my URL setup. newhosts_dict = { 'queryset' : unixhost.objects.all().filter(hostsetting__userlist = False)

Re: Customized model methods

2009-02-02 Thread Daniel Roseman
On Feb 2, 8:39 pm, Alex Jonsson wrote: > Dave, > > Thank you for your answer. Thing is, I already use django-tagging. > > I was a bit unclear: I'd like the function to return True or False, so > that I can run some logic on it based on that. When I use django- > tagging

Re: Displaying the names of executed tests

2009-02-02 Thread Julien Phalip
On Feb 3, 2:47 am, Alex Koshelev wrote: > Look at the `--verbosity` test command option Thanks Alex, I should have thought of that. Cheers, Julien --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Customized model methods

2009-02-02 Thread Alex Jonsson
Dave, Thank you for your answer. Thing is, I already use django-tagging. I was a bit unclear: I'd like the function to return True or False, so that I can run some logic on it based on that. When I use django- tagging today the closest I can get to check if a tag is included in an object is to

Re: Autogenerate a Model on Save

2009-02-02 Thread Will Matos
The downside to putting it in the form is that the form should only be used for presentation. Putting this logic in the form is pushing programatic decisions to the presentation layer. I believe the better approach is defining a view method that can be shared by multiple urls.

Re: Auction app

2009-02-02 Thread bobhaugen
http://code.google.com/p/django-swaps/ is not an auction app, it's a swapping app (trade anything for anything between registered users of a django site, initially developed for pinax). But it might be useful as a starting point for an auction app if you can't find anything fully tailored.

Re: Autogenerate a Model on Save

2009-02-02 Thread felix
the view is the first, and most easily understandable place to put it. the form logic may make your head hurt more at first, but eventually you'll feel more comfortable putting it there. nothing wrong with coding it in the view but OTOH you will get the same functionality if you use the form in

Re: Autogenerate a Model on Save

2009-02-02 Thread Will Matos
Agreed. Your class is being saved in a view method. Upon successful saves create a new one. From: django-users@googlegroups.com To: django-users@googlegroups.com Sent: Mon Feb 02 15:07:48 2009 Subject: Re: Autogenerate a Model on Save generally you should

Re: Autogenerate a Model on Save

2009-02-02 Thread felix
generally you should keep this type of business logic out of the model the place to put it is either in the Form or the view class OrderModelForm(forms.ModelForm): class Meta: model = Order def save_model(self, request, obj, form, change): """ Given a model

Autogenerate a Model on Save

2009-02-02 Thread Alfonso
I'm full of queries today!...This one seems a simple notion that I can't get my head around...How would I get django to auto-generate a new Invoice record and populate with some values when a user saves a new Order record? A custom def save(self) method? Thanks

How do I add a Custom ID Field that increments?

2009-02-02 Thread Alfonso
Hey, I want to add a field to an invoice model that contains a custom auto- incrementing value in the format - 'INV01" which increments... INV02 (obviously!). Anyone have a simple way I can build that into the model when a user clicks 'Add New Invoice'? I've written custom save methods

select_related and OneToOneField

2009-02-02 Thread Michael Hrivnak
Does select_related work for OneToOneField relationships? If so, does it work in both directions? Thanks, Michael --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: object_detail 404 (queryset outdated?)

2009-02-02 Thread Simon Westphahl
I finally got it to work! I wrapped the object_detail view with a view that calls the manager method as suggested by Carl. Thank you! On 2 Feb., 16:38, Carl Meyer wrote: > I think you've got the right idea of what's going wrong, but you're > looking for the problem in

Re: docs: Problem with 'make html'

2009-02-02 Thread Benjamin Buch
Thanks for ointing me in the right direction! I had the sphinx version from macports installes, which was something about 0.1.6 or something... Installed 0.5.1 via easy_install (which didn't work quite well, but did...) Now it works. benjamin Am 01.02.2009 um 12:40 schrieb Ramiro Morales:

Re: Missing REFERENCES... in SQL of models.ForeignKey('LaterDefinedModel')

2009-02-02 Thread mucisland
On Jan 31, 2:31 am, Malcolm Tredinnick wrote: > On Sat, 2009-01-31 at 12:20 +1100, Malcolm Tredinnick wrote: > > On Fri, 2009-01-30 at 09:49 -0800, mucisland wrote: > > > Hi all. > > > > If I specify the ForeignKey target model as a string because it is not > > > yet

Re: Problem with contenttype/renaming of an app

2009-02-02 Thread Benjamin Buch
I think I've got it now. I didn't dump the data of the seperate apps, but everything. So I dumped some auth tables too. Strangely, some tables of 'stanza' were not installed, but ./manage.py syncdb fixed this. Got to get accustomed to SQL some more... ;-) benjamin Am 24.01.2009 um 21:38

Re: newbie: printing a date in a template

2009-02-02 Thread KJ
On Feb 2, 7:11 pm, Christian Joergensen wrote: > > Is `todaysdate` listed in your context? > This is my return line for the view, the locals() part should add all the local variables to the template context right? return render_to_response('items/browse.html', locals(),

Model Save with Updated Foreign Key

2009-02-02 Thread Jeff
So I have two models a CEO model: class Ceo (models.Model): first_name = models.CharField(max_length=63) last_name = models.CharField(max_length=63) website = models.URLField() company_name = models.CharField(max_length=63, unique=False) company_address =

Re: Apache ImportError: Could not import settings

2009-02-02 Thread Bradley Wright
I had the following vhost.conf, which worked for me (before I switched to WSGI): NameVirtualHost 127.0.0.1 # dynamic Django site ServerAdmin myem...@mysite.com ServerName mysite.com SetHandler python-program PythonHandler django.core.handlers.modpython PythonDebug Off

Re: Can I control contents of SELECT in queryset?

2009-02-02 Thread phoebebright
After replicating you test and it still failing and various other experiments I downloaded the latest django trunk and it works fine! Always check the version first Phoebe! Sorry for the run around. For the record here are the two queries - correct one first, the difference is in the SELECT

Re: object_detail 404 (queryset outdated?)

2009-02-02 Thread Daniel Roseman
On Feb 2, 12:36 pm, Simon Westphahl wrote: > After some further investigation it seems this problem is related to > my custom manager. > > ### > class OfferManager(models.Manager): >     def get_query_set(self): >         return super(OfferManager,

Re: Displaying the names of executed tests

2009-02-02 Thread Alex Koshelev
Look at the `--verbosity` test command option On Mon, Feb 2, 2009 at 3:16 PM, Julien Phalip wrote: > > Hi, > > I'd find quite useful to have the names of all the tests displayed > after they have been executed. Instead of just having something like > 'Ran 3 tests 0.672s',

Re: object_detail 404 (queryset outdated?)

2009-02-02 Thread Carl Meyer
Hi Simon, On Feb 2, 7:36 am, Simon Westphahl wrote: > ### > class OfferManager(models.Manager): >     def get_query_set(self): >         return super(OfferManager, self).get_query_set().exclude > (start_date__gt=datetime.now).exclude(end_date__lt=datetime.now) > ### >

Re: Admin view - merge two tables? (potentially bad db design)

2009-02-02 Thread Carl Meyer
This database design will result in lots of joins, but it's perfectly normalized and very flexible. Fine if you expect low traffic and you need the flexibility. The other downside is the extra administration complexity, which is the meat of your question. Fortunately Django's admin can help

Re: Django session

2009-02-02 Thread Karen Tracey
FYI, you have 20+ lines of signature that look like spam to me because they are mostly in a language I cannot read. My first reaction to your post was to wonder how it got through moderation, then I saw you have this short question buried before the spammish signature: On Mon, Feb 2, 2009 at

Re: UserProfile with django-registration

2009-02-02 Thread Karen Tracey
On Mon, Feb 2, 2009 at 4:33 AM, Praveen wrote: > > I am trying to create UserProfile.i am using django-registration. > > [snip bunch of code that wraps badly in email, except a key bit] > regview.py > -- > def profile_callback(self, user): > [snip] if

  1   2   >