Re: Why INSERT instead of UPDATE?

2010-11-08 Thread Torbjörn Lundquist
SOLVED! It was a typo, the action attribute was pointing to the wrong view. Thanks a lot for the help! /Torbjörn 2010/11/8 Knut Ivar Nesheim > Look at the HTML for the form. The 'action' attribute tells the > browser where to submit the post. The view responsible for that URL is > the one you

django-registration 0.7 or 0.8

2010-11-08 Thread Oivvio Polite
What version of django-registration do you folks recommend? A plain "pip install" gave me 0.7, but some discussions on the intarwebs seem to indicate that people are using the yet unreleased 0.8. oivvio -- http://pipedreams.polite.se/about/ -- You received this message because you are subscr

Using Django's auth for Trac too

2010-11-08 Thread Torsten Bronger
Hallöchen! I know that my question has a strong Apache component, but can anybody here give me hints for how to use Django's auth system for a Trac installation running on the same Apache? I.e., iff someone is logged in in Django, it is also authenticated in Trac. I already have my own Django au

hello xD

2010-11-08 Thread Daniel Lathrop
hello: I have good news for you. Last week I have Order china 25 Products Apple Macbook Pro 2.8 GHz 15 MB986LL/A 4GB I completed bank transfer payments,I have received the product! w e b: tooaomo.com It's amazing! The item is original, brand new and has high quality, but it's muc cheaper. I'm ple

Re: Total in a django template

2010-11-08 Thread Gath
Try using custom tags Create a folder called "templatetags" in your application folder, in there create two files __init__.py customtags.py# this will have your custom tags/filters, please note it can be any name. Open your customtags.py file and drop the following lines and save. from dja

Re: Adding in more sort mechanisms

2010-11-08 Thread David Cramer
Google seems to have deemed it a good idea to rename this thread title. This is regarding Sentry (aka django-sentry), a 3rd party Django app. On Nov 8, 8:12 pm, David Cramer wrote: > I'm looking for feedback regarding something I want to implement in > Sentry [1]. > > Currently we allow sorting b

[Sentry] Adding in more sort mechanisms

2010-11-08 Thread David Cramer
I'm looking for feedback regarding something I want to implement in Sentry [1]. Currently we allow sorting by a few things, but its mostly based around the "times_seen" value. Times seen is useful, and always available, but there are many use cases where log messages would be better to group by so

Re: Exclude form field when calling form from view

2010-11-08 Thread Ed
I can fall back on the subclassing suggestion. But I'd like to give this one more shot for a fix. I think it has something to do with the request.FILES that I need. Here is my complete form: class UploadFileForm(forms.Form): def __init__(self, show_title=True, *args, **kwargs):

Create a ContentType object on model save

2010-11-08 Thread Kenny Meyer
Hello, I have two models, 1) FlashCard and 2) Practice, and I have a generic relation in the FlashCard model pointing to the Practice model using the contenttypes framework. The Practice model tracks information like how many times something was practiced, and calculates an `easy factor'. Each tim

non-ASCII characters in {{}}

2010-11-08 Thread Sébastien RAGONS
Hello, I try to display an article but there is char like 'é'. The template is correctly displayed but there is no trace of the article (and no error are logged). the line 'print html' show th article correctky: Table des matières Erreur 404 Erreur 404 La page demandée n'existe pas ! If i rem

Re: Call a function after a model with inlines is created [solved]

2010-11-08 Thread Martin Tiršel
On Sun, 31 Oct 2010 20:15:19 +0100, Daniel Roseman wrote: On Oct 31, 4:46 pm, Martin Tiršel wrote: If this is only needed for the admin, you probably want to override the ModelAdmin's response_add method. This is called after the add form has been processed and all the resulting objects sav

Generic Views - do you use them?

2010-11-08 Thread Ted
What are their pros and cons? How often do you use them when you're coding? The more I code in django the less I find generic views to be useful shortcuts (direct to template being the exception). My biggest complaints are: * You don't end up saving many keystrokes unless you have 3 or more view

Structured search pages?

2010-11-08 Thread James Smagala
Hey All, I'm looking to improve the search functionality for my site. It is currently based on a highly customized django-seeker, but I'm hitting a wall trying to move forward with that package. (Not maintained, and doesn't work at all out of the box on my site). Can anyone offer suggestions?

Re: clean method in a model

2010-11-08 Thread cootetom
If you want to associate an error to a specific field in a model form then you need to populate self._errors with the error you find. Have a read about this on the Django docs to see how it is done. http://docs.djangoproject.com/en/1.1/ref/forms/validation/#ref-forms-validation The last example s

Re: creating a combined form linked via foreign key??

2010-11-08 Thread sosurim kim
Oops, I meant to say addressbook, not phonebook... sorry. # models.py class Myuser(User): bio = models.TextField() class AddressBook(models.Model): userid = models.ForeignKey(CustomUser, blank=True, null=True) address = models.CharField(max_length=50) city = models.CharField(max_length=50

Threaded script

2010-11-08 Thread Big Gosh
Hello everybody. I wrote a web application using Django. On server side I wrote also a python script that runs as a deamon. The script is threaded and uses the model I wrote for Django to access the postgres DB. Now i found a thing I'm not able to solve: each thread waiting on a TCP socket opens a

creating a combined form linked via foreign key??

2010-11-08 Thread sosurim kim
Sorry if this has been asked before, but how can I create a form that is a combination of two models linked through a foreign key? For example, let's say I have two models: # models.py class Myuser(User): bio = models.TextField() class AddressBook(models.Model): userid = models.ForeignKey(Cus

Re: Total in a django template

2010-11-08 Thread Knut Ivar Nesheim
You need to sum the fines before you enter the templates. This can be done either in your view like this: total_fines = sum([item.fine for item in items]) Or you can do it in the db using the 'Sum' aggregate, see http://docs.djangoproject.com/en/dev/ref/models/querysets/#sum Regards Knut On

Re: Enclosing intervals with dates on django

2010-11-08 Thread Knut Ivar Nesheim
Your query can be translated into the ORM by simply using '__gt' and '__lt' on your start_date and ends_date. Regards Knut 2010/11/8 Rogério Carrasqueira : > Hello Everybody! > > I'm developing a routine that will control the information about scheduled > events and it will avoid that some events

Re: Why INSERT instead of UPDATE?

2010-11-08 Thread Knut Ivar Nesheim
Look at the HTML for the form. The 'action' attribute tells the browser where to submit the post. The view responsible for that URL is the one you should be looking at. If you have a ModelForm with no instance, Django will insert a new row. If there is an instance and you call form.save(), it will

Re: Validator for \t

2010-11-08 Thread J. Cliff Dyer
On Mon, 2010-11-08 at 12:21 -0800, Ralf wrote: > Hi, > > my users put values like 'Paul\t\t' per copy and paste into html- > formfields and suceeded, the values ended up in the database. > I wonder whether there is no build-in-validator to prevent these kind > of invalid input. > > Is there a che

Re: Why INSERT instead of UPDATE?

2010-11-08 Thread Torbjörn Lundquist
That did not help. I think I know what the problem is but I don't know how to solve it: It seems that when I press the Submit button I jump to another view-function (that inserts a new course). So, I use the same form i two different places, both for insert and update. How does django know which

Re: Exclude form field when calling form from view

2010-11-08 Thread Knut Ivar Nesheim
Maybe you could just use subclassing instead of doing stuff at run-time: class UploadForm(forms.Form): file = ... # custom upload and validation code here class ThumbnailUploadForm(UploadForm): pass class UploadFileForm(UploadForm): title = ... As for your current approach, it l

Re: Obtaining And Caching User Context

2010-11-08 Thread Daniel Roseman
On Nov 8, 5:54 pm, octopusgrabbus wrote: > I am able to log into my form page, which is a simple form asking the > user for one value. If that value is entered successfully, I am able > to redirect to another "you were successful" page. However, my > template logic that checks to see if the user i

Re: Custom formset validation: having a "save?" checkbox for each form

2010-11-08 Thread Knut Ivar Nesheim
Hi, Every Form subclass defines a method called 'is_valid()', even the FormSet has one, which will repeatedly call it on every form. After running is_valid(), form.cleaned_data will contain cleaned data from the forms. On subclasses of FormSet you can also override the clean method, which allows

clean method in a model

2010-11-08 Thread refreegrata
Hello list. I want to use the clean method in a model. -- class myModel(models.Model): fields def clean(self): raise ValidationError('The Error.') --- Thats works fine. My question is

Exclude form field when calling form from view

2010-11-08 Thread Ed
I have an image upload form that takes a title and a file for its field. I have two uses for it. Most of the time I call it, I need both a title and the image itself. But when I call it simply to grab a thumbnail, I don't need the title. In fact, the form data is saved to a different model that doe

Validator for \t

2010-11-08 Thread Ralf
Hi, my users put values like 'Paul\t\t' per copy and paste into html- formfields and suceeded, the values ended up in the database. I wonder whether there is no build-in-validator to prevent these kind of invalid input. Is there a cheap way to validate or strip these kind of input? -- You recei

Django Sprint this Saturday!

2010-11-08 Thread Iván Raskovsky
Hello everyone! Here in Argentina we're planning a Sprint[1] this Saturday to help with Django 1.3 We are going to participate from more than 4 Argentinian locations. We are very proud to count with Ramiro (cramm) one of the recently designated core commiters! There will be also, another Sprint in

Obtaining And Caching User Context

2010-11-08 Thread octopusgrabbus
I am able to log into my form page, which is a simple form asking the user for one value. If that value is entered successfully, I am able to redirect to another "you were successful" page. However, my template logic that checks to see if the user is authenticated -- as far as I can tell the user i

Custom formset validation: having a "save?" checkbox for each form

2010-11-08 Thread Carsten Fuchs
Hi all, my name is Carsten Fuchs, and this is my first post here. I'm normally a C++ developer for Windows and Linux desktop and server applications, and have begun my first (big) database-web project in mid summer. Let me start with saying that Django is utterly awesome: I've been able to co

Enclosing intervals with dates on django

2010-11-08 Thread Rogério Carrasqueira
Hello Everybody! I'm developing a routine that will control the information about scheduled events and it will avoid that some events override others and prevent that it cannot happen. I made a query on mysql where that works fine and gives the results that I need. For example I have an event that

Re: How to override handle_uncaught_exception ?

2010-11-08 Thread Phlip
On Nov 8, 8:12 am, Phlip wrote: > I just need the usual features - to log the actual error, and stick it > in the programmer's face during a test run. > > But when I Google for this subject, I get ten thousand newbies asking > why they got some other error, and self.handle_uncaught_exception > ap

How to override handle_uncaught_exception ?

2010-11-08 Thread Phlip
I just need the usual features - to log the actual error, and stick it in the programmer's face during a test run. But when I Google for this subject, I get ten thousand newbies asking why they got some other error, and self.handle_uncaught_exception appears in their stack trace! -- Phlip htt

Re: Can extra() be used to implement JOIN?

2010-11-08 Thread Daniel Roseman
On Nov 8, 3:40 pm, Andy wrote: > I have a Q&A type of site with the following models: > > class Question(models.Model): >     title = models.CharField(max_length=70) >     details = models.TextField() > > class Answer(models.Model): >     question_id = IntegerField() >     details = models.TextFie

Can extra() be used to implement JOIN?

2010-11-08 Thread Andy
I have a Q&A type of site with the following models: class Question(models.Model): title = models.CharField(max_length=70) details = models.TextField() class Answer(models.Model): question_id = IntegerField() details = models.TextField() I need to display a specific question toge

Re: Making a m2m field required

2010-11-08 Thread Yo'av Moshe
O thank you! I didn't know about self.data! That's exactly what I was looking for. It works now. Thanks! Yo'av On Nov 8, 4:22 pm, Martin Ostrovsky wrote: > What about checking the raw POST for existence of data? So in your > form, checking self.data.has_key('some_key') > > On Nov 8, 9:15 am

Re: Making a m2m field required

2010-11-08 Thread Martin Ostrovsky
What about checking the raw POST for existence of data? So in your form, checking self.data.has_key('some_key') On Nov 8, 9:15 am, "Yo'av Moshe" wrote: > Hey, > > I tried this method with no success. > > Adding .clean to my Article's ModelForm and checking it's > self.instance.tags.all(), gives m

Re: Making a m2m field required

2010-11-08 Thread Yo'av Moshe
Hey, I tried this method with no success. Adding .clean to my Article's ModelForm and checking it's self.instance.tags.all(), gives me this ValueError: 'Article' instance needs to have a primary key value before a many-to- many relationship can be used. Actually this seems right, since if my Art

Create a simple Editor with image support

2010-11-08 Thread Karim Gorjux
Hi all, I would like to create a "improved" flatpage application adding a editor and the support of image files. My target is to edit a static web page load images and see a preview. I can add easily a editor like tinymce, I would try also FCKeditor, but what about the handle of images? Could you s

Re: grouping of fields inside a model into a class

2010-11-08 Thread nitm
thanks for the references, I missed that part. it does look similar but not exactly what I had in mind... what this means is that I can now have an abstract model which will be a base model to all models who can have an address. this abstract model will define the different fields which makes an

Re: AuthProfile and querysets

2010-11-08 Thread tom
Hi, I've solved the issue with these lines user_list = request.customer.siteuser_set.values_list('user', flat = True) users = User.objects.in_bulk(list(user_list)) TeamForm.base_fields['members'].queryset = users best regards, tom On Nov 7, 12:40 am, tom wrote: > Hello, > > I try to get User