Re: Populating a form from the database

2009-08-04 Thread Thomas Guettler
Hi, if you use ModelForm, the data from the database are the initial form data. If you create a new record with ModelForm, you could use the "initial" parameter to supply some default values. More can be found in the docs. Thomas Magnus Valle schrieb: > Short: > How do I populate a form with

Re: Can i rise 404 from my middleware ?

2009-08-04 Thread Malcolm Tredinnick
On Wed, 2009-08-05 at 09:29 +0300, Mirat Can Bayrak wrote: > On Tue, 4 Aug 2009 16:47:37 -0500 > Alex Gaynor wrote: [...] > > Right now there is a bug in django's middleware where it doesn't > > correct catch exceptions: http://code.djangoproject.com/ticket/6094. > than... what should i do?

value error

2009-08-04 Thread srini
Hi all, I am using "location = request.get_full_path()"in my view, when the user is logged in this " request.get_full_path() " is getting the correct path but when user gets logged out and again logging in at that time this "request.get_full_path()" is adding the extr

Re: need help with model design and table relationship

2009-08-04 Thread Malcolm Tredinnick
On Tue, 2009-08-04 at 14:40 -0700, Unnamed_Hero wrote: > > > And you still haven't reduced it to a simple case that fails with a > > specific piece of data at the interactive prompt. You are trying to > > debug through three layers of curtains here. Why not remove the extra > > layers and work di

Re: Getting at the fields querysets of a form in a formset

2009-08-04 Thread Malcolm Tredinnick
On Tue, 2009-08-04 at 14:30 -0700, bnl wrote: > Hi Folks > > I'm trying to move up from a complex form based on a model declaration > to a model formset built on the same idea. > > I have a model which has some stuff that looks something like > > class Vocab(models.Model): > ''' Holds the v

Re: Select_related and foreign keys

2009-08-04 Thread Malcolm Tredinnick
On Tue, 2009-08-04 at 09:05 -0700, Joe LB wrote: > Hi all, > > I'm trying to access the related objects in the template by using > > {{ _set.select_related}} This isn't particularly useful in a template. Select_related() doesn't change the values you have access to and it isn't going to s

Re: Can i rise 404 from my middleware ?

2009-08-04 Thread Mirat Can Bayrak
On Tue, 4 Aug 2009 16:47:37 -0500 Alex Gaynor wrote: > > On Tue, Aug 4, 2009 at 4:45 PM, Mirat Can > Bayrak wrote: > > > > Question is simple. i tried to use raise Http404 from middleware and that > > is not working. > > > > My middleware is : > > > > import urlparse > > from django.contrib.si

Re: subclassed ModelForms initial values behavior changed from 1.1beta to 1.1

2009-08-04 Thread Malcolm Tredinnick
On Tue, 2009-08-04 at 22:23 +0800, Russell Keith-Magee wrote: > On Mon, Aug 3, 2009 at 3:46 AM, David Haas wrote: > > > > It looks like the change happened between rev. 10189 & 10190: 10189 > > displays the value, 10190 doesn't. > > > > Unfortunately, I don't think I can give you a completely unbi

Re: Multiple instances of the same form on one page: how to get the right POST data?

2009-08-04 Thread Malcolm Tredinnick
On Tue, 2009-08-04 at 07:07 -0700, Berco Beute wrote: > I'm trying to add multiple instances of the same form on one page, > each with its own submit button. I know how to use the 'prefix' > argument for a form to differentiate between forms, but I can't figure > out how to get the right data when

Re: Multiple Logins

2009-08-04 Thread Malcolm Tredinnick
On Tue, 2009-08-04 at 06:28 -0700, lfrodrigues wrote: > Hi, > > I've developed a special Auth backend for a internal communication > protocol. Everything was ok but now the requirements changed and I > need to allow on the same browser (in diferent tabs) several logged > users. > > How can I hav

Re: Date format in modelform.

2009-08-04 Thread zayatzz
Thanks Karen! That was one awesome explanation of how datetime field and its widgets work. Could it be made sticky for all the future django beginners to read who have this kind of problems? I for one will certainly bookmark it so i can thrown this link to anybody who has similar problem. Alan

Re: hosting a django application

2009-08-04 Thread Benjamin Sergeant
You can also look at mod_wsgi or spawning (the last one does not require any configuration nor apache). On Tue, Aug 4, 2009 at 9:53 PM, Kenneth Gonsalves wrote: > > On Wednesday 05 Aug 2009 10:00:37 am rekha wrote: >> How can i host a django application (virtual hosting in apache) using >> apache

Re: Using email instead of username in extended "User" model?

2009-08-04 Thread Dana Woodman
Yeah that seems like the option Ill go with since it is probably the most clean and future compatible. My user's dont need to log into django admin anyways so that should suffice. Thanks everyone for the feedback! Cheers, Dana On Mon, Aug 3, 2009 at 4:23 PM, Malcolm Tredinnick wrote: > > On Mo

Re: hosting a django application

2009-08-04 Thread Kenneth Gonsalves
On Wednesday 05 Aug 2009 10:00:37 am rekha wrote: > How can i host a django application (virtual hosting in apache) using > apache server. I should be able to access my application remotely and > do some changes.. what are the things i need to install.. and give me > the steps to do that.. please

hosting a django application

2009-08-04 Thread rekha
Hi, How can i host a django application (virtual hosting in apache) using apache server. I should be able to access my application remotely and do some changes.. what are the things i need to install.. and give me the steps to do that.. Thanks in advance.. Rekha --~--~-~--~~-

Change Admin Field Defaults or Attributes outside of the Model Field Definitions (for inherited models and the like)

2009-08-04 Thread ZebraShaSha
Not sure if anyone else has figured this out yet, but say you have an Entry model with categories and then a bunch of models that subclass it. When you define your Admin.ModelAdmin for the subclass, you can do the following: class SubclassModelForm(admin.ModelAdmin): opts = Entry._meta

Re: Specifying a join table for a customized query

2009-08-04 Thread Malcolm Tredinnick
On Tue, 2009-08-04 at 18:41 -0700, Daybreaker wrote: > See a recent thread here: > > http://groups.google.com/group/django-users/browse_thread/thread/0ee03167b7b5e873/850ac8304bf952b4#850ac8304bf952b4 > > and this query: > > mymodel.objects.extra(select={'ordering_field': 'IF(STRCMP > (bbs_tag.

Re: Date format in modelform.

2009-08-04 Thread Karen Tracey
On Tue, Aug 4, 2009 at 2:05 PM, zayatzz wrote: > > Thanks everybody. > > I changed this : > birth_date = forms.DateField(('%d/%m/%Y',), label='Birth Date', > required=False ), > > for this : > birth_date = forms.DateField(('%d/%m/%Y',), label='Birth Date', > required=False, widget=forms.D

Re: mysqldb help! Can't connect to MySQL server error...

2009-08-04 Thread mdsmoker
> Why have you specified port 3036? -cause i'm partially retarded, that's all...thanks for your help Matt --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to d

Re: Intermediate Table question

2009-08-04 Thread Russell Keith-Magee
On Wed, Aug 5, 2009 at 12:58 AM, LeeRisq wrote: > > Does anyone know if an intermediate table can be specified on more > than two models? For instance: > > class A(m.Model): >       B = ManyToManyField(B, through='D') >       C = ManyToManyField(C, through='D') > > Will this validate and actually

Re: Template and substitute

2009-08-04 Thread David
Thanks for your replies. On Aug 4, 4:16 am, David De La Harpe Golden wrote: > Malcolm Tredinnick wrote: > > You seem to be trying to create raw SQL using Django's template system. > > Please don't do that. It's like trying to use a shovel to hammer in a > > nail, but less effective. > > Pybati

Re: Help building a custom RadioSelect widget.

2009-08-04 Thread Sam Walters
Thanks David This example is exactly what i was hoping for. I hope something like this gets put into a tutorial because i guess many people would need to control exactly what their form looks like. Cheers -Sam On Tue, Aug 4, 2009 at 11:00 PM, David De La Harpe Golden wrote: > > Sam Walters wro

Re: syncdb does not find app on the PYTHONPATH

2009-08-04 Thread Kenneth Gonsalves
On Wednesday 05 Aug 2009 6:14:48 am Matthew wrote: > Also of note, when I ran python manage.py reset coltrane, I got this > error: > > Error: App with label coltrane could not be found. Are you sure your > INSTALLED_APPS setting is correct? on the python shell try: import coltrane and if that su

Re: problem: TemplateDoesNotExist at /admin/ (linux)

2009-08-04 Thread LuXo Jarufe
Only reinstaling the last version of django this error dissapear, 'cause I had problems with the css too, in the stable version the css didn't work, in windows the things are different beacuse the installation is incomplete in some cases and you must copy manually the templates directories (admin)

Specifying a join table for a customized query

2009-08-04 Thread Daybreaker
See a recent thread here: http://groups.google.com/group/django-users/browse_thread/thread/0ee03167b7b5e873/850ac8304bf952b4#850ac8304bf952b4 and this query: mymodel.objects.extra(select={'ordering_field': 'IF(STRCMP (bbs_tag.name, 'notice'), '',bbs_tag.name)'}, order_by=['ordering_field']) bb

Re: A custom ordering SQL and Django models

2009-08-04 Thread Daybreaker
Thanks, that works! (but I already changed my implementation not to use tag-based ordering...) For more generality, you could replace bbs_tag with Tag._meta.db_table value. On 8월4일, 오후11시25분, krylatij wrote: > Use extra() method of query set with little hack ;) > > mymodel.objects.extra(select={

Re: Apache and mod_wsgi on Ubuntu

2009-08-04 Thread Graham Dumpleton
On Aug 5, 10:27 am, Malcolm Tredinnick wrote: > On Tue, 2009-08-04 at 17:12 -0700, Steve1234 wrote: > > I am trying to setup Apache and mod_wsgi on Ubuntu to run Django > > content. I generated a minimum project using "django-admin.py > > startproject mysite" creating the project in my home fol

syncdb does not find app on the PYTHONPATH

2009-08-04 Thread Matthew
I am working through Chapter 4 of Practical Django Projects for Django 1.1. After creating a new app, "coltrane", and adding a Category class to its models.py file, I ran syncdb and everything worked. Tables were added to the database and the admin interface included the new Category model. Afte

Re: Apache and mod_wsgi on Ubuntu

2009-08-04 Thread Malcolm Tredinnick
On Tue, 2009-08-04 at 17:12 -0700, Steve1234 wrote: > I am trying to setup Apache and mod_wsgi on Ubuntu to run Django > content. I generated a minimum project using "django-admin.py > startproject mysite" creating the project in my home folder. Running > the development server works and shows the

Apache and mod_wsgi on Ubuntu

2009-08-04 Thread Steve1234
I am trying to setup Apache and mod_wsgi on Ubuntu to run Django content. I generated a minimum project using "django-admin.py startproject mysite" creating the project in my home folder. Running the development server works and shows the "get started" page. But the "production" setup returns "In

Re: apache

2009-08-04 Thread Graham Dumpleton
You must recompile mod_python to use a different Python version. Changing the symlink like that will not make a difference and you could break other stuff on your system which assumed default Python is a specific version. You should also not go blindly changing permissions to 777 as that makes it

Populating a form from the database

2009-08-04 Thread Magnus Valle
Short: How do I populate a form with data from the database? Fx. if I want to let users edit the data they have entered. Long: Currently, I have a form where the user(if logged in) will enter data and when it is submitted some extra data is entered to the form before it is saved, a time-stamp a

Re: Can i rise 404 from my middleware ?

2009-08-04 Thread Alex Gaynor
On Tue, Aug 4, 2009 at 4:45 PM, Mirat Can Bayrak wrote: > > Question is simple. i tried to use raise Http404 from middleware and that is > not working. > > My middleware is : > > import urlparse > from django.contrib.sites.models import Site > from django.http import Http404 > > class GetSubdomai

Can i rise 404 from my middleware ?

2009-08-04 Thread Mirat Can Bayrak
Question is simple. i tried to use raise Http404 from middleware and that is not working. My middleware is : import urlparse from django.contrib.sites.models import Site from django.http import Http404 class GetSubdomainMiddleware: def process_request(self, request): si

Getting at the fields querysets of a form in a formset

2009-08-04 Thread bnl
Hi Folks I'm trying to move up from a complex form based on a model declaration to a model formset built on the same idea. I have a model which has some stuff that looks something like class Vocab(models.Model): ''' Holds the values of a choice list aka vocabulary ''' name=models.CharFi

JSON Serialization with ImageField

2009-08-04 Thread scuzz
Hi, I'm trying to receive a file encoded in a json string and store it in an ImageField. I was hoping to use the standard Django deserialisation like: serializers.deserialize("json", "...snip..., \"myImageField\": \"base64encodedimage\", ...snip...) however it tries to store the image content s

Re: need help with model design and table relationship

2009-08-04 Thread Unnamed_Hero
> And you still haven't reduced it to a simple case that fails with a > specific piece of data at the interactive prompt. You are trying to > debug through three layers of curtains here. Why not remove the extra > layers and work directly with the ORM to debug an ORM problem, as I > suggested in

Re: model upload_to

2009-08-04 Thread Paulo Almeida
For what it's worth, if all you want to do is change the upload folder, you can also do it by overriding the form's __init__. - Paulo On Tue, Aug 4, 2009 at 9:28 PM, Stefan Hjelm wrote: > > ok don't know what typo I made yesterday but it works now, maybe > backslash in path. Thanks. > > for you

Re: is it possible to do a monkey patch on django.contrib.atuh.models.User to make the email field unique?

2009-08-04 Thread Vasil Vangelovski
Thanks Alex, that worked. Alex Koshelev wrote: > Hi, Vasil! > > `Field.unique` is the read only property. If you want to set > uniqueness you have to assign field's `_unique` attribute to True. > > --- > Alex Koshelev > > > On Wed, Aug 5, 2009 at 12:54 AM, Vasil Vangelovski > mailto:vvangelov..

Re: is it possible to do a monkey patch on django.contrib.atuh.models.User to make the email field unique?

2009-08-04 Thread Alex Koshelev
Hi, Vasil! `Field.unique` is the read only property. If you want to set uniqueness you have to assign field's `_unique` attribute to True. --- Alex Koshelev On Wed, Aug 5, 2009 at 12:54 AM, Vasil Vangelovski wrote: > > Having this line of code: > > User._meta.get_field('is_staff').default = Tr

Re: Login screen is always shown, i dont like it :/

2009-08-04 Thread Paulo Almeida
Hi, If you redirect users to your login screen in views that require login (for instance, using the login_required decorator), you don't have to give out your /accounts/login URL to users. Of course they can still go there if they want, but there's no reason why they should. Your login can redirec

is it possible to do a monkey patch on django.contrib.atuh.models.User to make the email field unique?

2009-08-04 Thread Vasil Vangelovski
Having this line of code: User._meta.get_field('is_staff').default = True in the models.py for one of my apps works without problems. I wonder if it's possible to make email unique and first_name,last_name unique_together by using this technique. This: User._meta.get_field('email').unique = Tr

Re: model upload_to

2009-08-04 Thread Stefan Hjelm
ok don't know what typo I made yesterday but it works now, maybe backslash in path. Thanks. for you who want to know how: def get_path(instance, filename): return instance._folder My model: class File(models.Model): type = models.CharField(max_length=10) the_file = models.FileField(

Re: Unit test failing with 302 instead of 200, using Django's TestCase class

2009-08-04 Thread Paulo Almeida
Hi, The myflow part comes from the parent urls.py, which includes myflow/urls.py when matching ^myflow (sorry, didn't think of that). I did try to comment out the CommonMiddleware line, in settings.py, and the error persisted, but maybe I should try adding APPEND_SLASH = False. I will then look at

Re: model upload_to

2009-08-04 Thread Stefan Hjelm
sorry, my last post was answer to the first reply :-) I'll the second now. Thanks. On 4 Aug, 22:08, Stefan Hjelm wrote: > thanks, forgot to say I tried that aswell but then nothing happens. > It's just as it ignores that line. It still saves the file under > "folder" and not under "new_folder"

Re: Intermediate Table question

2009-08-04 Thread Alex Gaynor
On Tue, Aug 4, 2009 at 3:06 PM, LeeRisq wrote: > >> I don't believe it would work, but even if it did, what would this do? >>  What's the expecected behavior? > > > class A defines an consumer order > > class B and C both define different lines of product > > I'd like to store all the ordering inf

Re: model upload_to

2009-08-04 Thread Stefan Hjelm
thanks, forgot to say I tried that aswell but then nothing happens. It's just as it ignores that line. It still saves the file under "folder" and not under "new_folder" On 4 Aug, 21:55, Alex Gaynor wrote: > On Tue, Aug 4, 2009 at 2:53 PM, caliman wrote: > > > Hi! > > > I'm trying to change uploa

Re: Intermediate Table question

2009-08-04 Thread LeeRisq
> I don't believe it would work, but even if it did, what would this do? >  What's the expecected behavior? class A defines an consumer order class B and C both define different lines of product I'd like to store all the ordering info in one intermediate table while maintaining different table

Re: model upload_to

2009-08-04 Thread Daniel Roseman
On Aug 4, 8:53 pm, caliman wrote: > Hi! > > I'm trying to change upload_to dynamically. > > My model: > class File(models.Model): >     type = models.CharField(max_length=10) >     the_file = models.FileField(upload_to="folder") > def __unicode__(self): >         return self.file.name > > Tried f

Re: 'RelatedManager' object is not iterable

2009-08-04 Thread british.assassin
Yeah, that did it, thanks. I didn't even notice that, lol Thanks again. On Aug 4, 8:56 pm, Daniel Roseman wrote: > On Aug 4, 8:15 pm, "british.assassin" > wrote: > > > > > > > {% extends "base.html" %} > > > {% block title %}EvoWebs{% endblock %} > > > {% block body %} > > {% if categories %}

Re: 'RelatedManager' object is not iterable

2009-08-04 Thread Daniel Roseman
On Aug 4, 8:15 pm, "british.assassin" wrote: > > {% extends "base.html" %} > > {% block title %}EvoWebs{% endblock %} > > {% block body %} > {% if categories %} > {% for category in categories %} > > {{category.name}} > {% for forum in category.forums %} > {{forum.name}} > {% endfor %} > > {% e

Re: model upload_to

2009-08-04 Thread Alex Gaynor
On Tue, Aug 4, 2009 at 2:53 PM, caliman wrote: > > Hi! > > I'm trying to change upload_to dynamically. > > My model: > class File(models.Model): >    type = models.CharField(max_length=10) >    the_file = models.FileField(upload_to="folder") > def __unicode__(self): >        return self.file.name

model upload_to

2009-08-04 Thread caliman
Hi! I'm trying to change upload_to dynamically. My model: class File(models.Model): type = models.CharField(max_length=10) the_file = models.FileField(upload_to="folder") def __unicode__(self): return self.file.name Tried following: 1, overwrite upload_to in save: def save(self

Re: Email interface to django app

2009-08-04 Thread CLIFFORD ILKAY
On 04/08/09 03:29 PM, Margie wrote: > I have an app that is similar in many ways to the django admin app. > My users are requesting access via email. IE, when an object (task in > my case) gets created, they want it to send them an email and then > they want to be able to respond to that email to

Email interface to django app

2009-08-04 Thread Margie
I have an app that is similar in many ways to the django admin app. My users are requesting access via email. IE, when an object (task in my case) gets created, they want it to send them an email and then they want to be able to respond to that email to update various fields associated with the t

Re: Non-intrusive way to authenticate phpBB against Django

2009-08-04 Thread Greg Fuller
Thanks! I suspect I will need this soon. On Aug 4, 12:25 pm, Chris McCormick wrote: > Hi All, > > Just uploaded this:http://code.google.com/p/phpbb-json-auth/ > > Hope it's useful to someone else. > > Best, > > Chris. > > ---http://mccormick.cx --~--~-~--~~--

Re: 'RelatedManager' object is not iterable

2009-08-04 Thread british.assassin
Yeah sure. Models.py: from django.db import models from django.contrib.auth.models import User class Category(models.Model): name = models.CharField(max_length=100) class Meta: verbose_name_plural = 'categories' def __unicode__(self): return self.name class Forum(

Re: Django on Hostmonster shared hosting

2009-08-04 Thread Gene
I am currently running a django site successfully on HM shared hosting. As far as I can tell I am using the same setup as you- except that I haven't yet upgraded to flup 1.0.3. It looks like your troubles are just with the path, though the WSGI errors trouble me. I'll let you know if my site brea

Login screen is always shown, i dont like it :/

2009-08-04 Thread MiratCanBayrak
hi, i am using django.contrib.auth.views.login view at /account/login url, to show login screen ( as explained here : http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.views.login) But, when user already logged in, form is not showing any error. Displaying a login form to alr

Inserting into existing tables

2009-08-04 Thread Sean Brown
I have existing tables in a postgresql database created with existing sequences as the default values for their primary key. I am trying to interface with the database with django (i have tried with 1.0.2, 1.1 and now have django-trunk) and while it seems the model works (runserver complai

Re: 'RelatedManager' object is not iterable

2009-08-04 Thread Alex Gaynor
On Tue, Aug 4, 2009 at 1:16 PM, british.assassin wrote: > > Hi, > > In the views.py for my app I have the following: > > def index(request): >    categories = models.Category.objects.all() >    return render_to_response("forum/index.html", > {'categories':categories}) > > And in the template file

'RelatedManager' object is not iterable

2009-08-04 Thread british.assassin
Hi, In the views.py for my app I have the following: def index(request): categories = models.Category.objects.all() return render_to_response("forum/index.html", {'categories':categories}) And in the template file I am trying to iterate through these via doing: {% for category in categ

Re: Date format in modelform.

2009-08-04 Thread zayatzz
Oh and i will not fix problem in server application with a code in browser script. As i understand, javascript should be as unobtrusive as possible and fixing things that way: 1) is not unobtrusive 2) makes you write too much unnecessary code. Alan. On Aug 4, 9:05 pm, zayatzz wrote: > Thanks e

Re: Date format in modelform.

2009-08-04 Thread zayatzz
Thanks everybody. I changed this : birth_date = forms.DateField(('%d/%m/%Y',), label='Birth Date', required=False ), for this : birth_date = forms.DateField(('%d/%m/%Y',), label='Birth Date', required=False, widget=forms.DateInput(format='%d/%m/%Y') ) And it all works very good. But th

Re: Unit test failing with 302 instead of 200, using Django's TestCase class

2009-08-04 Thread Karen Tracey
On Tue, Aug 4, 2009 at 1:33 PM, Paulo Almeida wrote: > Hi Karen, > > You're right, I had some unnecessary lines that I used only for unittest. I > commented them out now. Printing response['location'] gives me this: > > http://testserver/myflow/experiment/1/ > > You're also right that there is no

Re: Unit test failing with 302 instead of 200, using Django's TestCase class

2009-08-04 Thread Paulo Almeida
Hi Karen, You're right, I had some unnecessary lines that I used only for unittest. I commented them out now. Printing response['location'] gives me this: http://testserver/myflow/experiment/1/ You're also right that there is no Redirect in my view, so I don't know where that is coming from. I g

Non-intrusive way to authenticate phpBB against Django

2009-08-04 Thread Chris McCormick
Hi All, Just uploaded this: http://code.google.com/p/phpbb-json-auth/ Hope it's useful to someone else. Best, Chris. --- http://mccormick.cx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Djang

Re: Unit test failing with 302 instead of 200, using Django's TestCase class

2009-08-04 Thread Karen Tracey
On Tue, Aug 4, 2009 at 12:26 PM, palmeida wrote: > > Hi, > > I'm running a test that fails when using Django's TestCase class, but > not when running TestCase from unittest. This is my test class: > > class LoggedInUser(TestCase): >fixtures = ['myflow'] Note fixtures will not be loaded when

Re: Date/time field styling?

2009-08-04 Thread mhulse
For those interested, I found this link via browsing the django-html git source: Django Developers: Proposal: Form rendering with filters Looks interesting. Unfortunately, I am still a noob, so I probably won't be able to cross that bridge for a while. :) Thanks agai

Re: Intermediate Table question

2009-08-04 Thread Alex Gaynor
On Tue, Aug 4, 2009 at 11:58 AM, LeeRisq wrote: > > Does anyone know if an intermediate table can be specified on more > than two models? For instance: > > class A(m.Model): >       B = ManyToManyField(B, through='D') >       C = ManyToManyField(C, through='D') > > Will this validate and actually

Intermediate Table question

2009-08-04 Thread LeeRisq
Does anyone know if an intermediate table can be specified on more than two models? For instance: class A(m.Model): B = ManyToManyField(B, through='D') C = ManyToManyField(C, through='D') Will this validate and actually work? --~--~-~--~~~---~--~~ Yo

Re: buildung query with ORM

2009-08-04 Thread krylatij
It's difficult to even imagine such query (possible but very inefficient), i think you need to change your architecture or do this grouping in bussines layer --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django use

error in using naturalday

2009-08-04 Thread Sumanth
I am using dajngo template filters for humanize data . When I was using naturalday I observe the following when the date is 07-2-2009 given in (mm-dd- format) , the naturalday changes it to June 2 2009 and displays the date one month previous to date . Has anyone else faced the same problem

Re: Unit test failing with 302 instead of 200, using Django's TestCase class

2009-08-04 Thread Paulo Almeida
Hi Alex, When I do that I get a 404 instead of a 302. I also tried changing urls.py to have a trailing slash but that also gives me a 404. Byt the way, one of the variables I get in response.context is: {'request_path': u'/myflow/experiment/1/'} Thanks for the reply, Paulo On Tue, Aug 4, 2009 at

Re: standalone script

2009-08-04 Thread Vitaly
I have found where our mistake was, it was inside __init__.py of our application. Thanks anyway On 4 Сер, 18:45, Michael wrote: > > On Tue, Aug 4, 2009 at 11:29 AM, Vitaly wrote: > > I did cut of our settings > > > Here it ishttp://dpaste.com/75091/ > > > Using your method I got no error but a

Re: Unit test failing with 302 instead of 200, using Django's TestCase class

2009-08-04 Thread Alex Gaynor
On Tue, Aug 4, 2009 at 11:26 AM, palmeida wrote: > > Hi, > > I'm running a test that fails when using Django's TestCase class, but > not when running TestCase from unittest. This is my test class: > > class LoggedInUser(TestCase): >    fixtures = ['myflow'] >    def setUp(self): >        self.clie

Re: Django admin panel how add extra function in form processing?

2009-08-04 Thread Asinox
Sorry krylatij, im new with django, i will try :) thanks On 4 ago, 11:22, krylatij wrote: > Why do you need admin here? > You can generate it in the save() method of your model. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Go

Unit test failing with 302 instead of 200, using Django's TestCase class

2009-08-04 Thread palmeida
Hi, I'm running a test that fails when using Django's TestCase class, but not when running TestCase from unittest. This is my test class: class LoggedInUser(TestCase): fixtures = ['myflow'] def setUp(self): self.client = Client() try: User.objects.create_user(

Re: Django admin panel how add extra function in form processing?

2009-08-04 Thread krylatij
Why do you need admin here? You can generate it in the save() method of your model. --~--~-~--~~~---~--~~ 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

Re: Adding errors

2009-08-04 Thread Alex Gaynor
On Tue, Aug 4, 2009 at 11:17 AM, CrabbyPete wrote: > > I want to return an error that a user was not found. I wanted to add > the error and have it formatted using errorlist as happens with a > required field. So I did the following > > lform._errors['username']  = ErrorList("User does not exist o

Adding errors

2009-08-04 Thread CrabbyPete
I want to return an error that a user was not found. I wanted to add the error and have it formatted using errorlist as happens with a required field. So I did the following lform._errors['username'] = ErrorList("User does not exist or wrong password") The result in lform.errors is ErrorDict:

Re: standalone script

2009-08-04 Thread Vitaly
It should be, but not :) The matter is that I changed some code from django.conf import settings from fg import settings as app_settings settings.configure(app_settings, **{'DATABASE_NAME': ':memory:', 'DATABASE_ENGINE': 'sqlite3',

Re: Does Django fit this application?

2009-08-04 Thread Martje
This is possible with Django. Check out the auth app :-). On 4 aug, 16:30, xerophyte wrote: > Yes, you can use the django, but you need to verify all the commands > before you execute .. ( having secure daemon to do it for you ???) > > On Aug 4, 8:45 am, HB wrote: > > > Hey, > > We have a coup

Select_related and foreign keys

2009-08-04 Thread Joe LB
Hi all, I'm trying to access the related objects in the template by using {{ _set.select_related}} this works but as its not an instance and it's a query object I get [] What do I use to just display the string not the object code. Thanks, Joseph --~--~-~--~~

Re: Django file upload. 'None'

2009-08-04 Thread Martje
Ah, thanks :-). On 4 aug, 17:18, Lakshman Prasad wrote: > You need to set the form with the request file, which I think you may have > missed: > from appname.forms import ImageForm > form = ImageForm(request.POST,request.FILES) > > From the > documentation:http://docs.djangoproject.com/en/dev/t

Django admin panel how add extra function in form processing?

2009-08-04 Thread Asinox
Hi guys, somebody know how ill use a extra function in any form processing in the Django admin?, the problem is that i need to generate a encrypted code in the moment that a form is sendinga and save the code in the database in the user's account panel i did it... but i dont know how ill make

Re: standalone script

2009-08-04 Thread Michael
> > On Tue, Aug 4, 2009 at 11:29 AM, Vitaly wrote: > I did cut of our settings > > Here it is http://dpaste.com/75091/ > > Using your method I got no error but app_settings and INSTALLED_APPS > were cleaned up and contains nothing. Strange. > > Thanks > Vitaly > Why not just: from django.conf

Re: standalone script

2009-08-04 Thread Vitaly
I did cut of our settings Here it is http://dpaste.com/75091/ Using your method I got no error but app_settings and INSTALLED_APPS were cleaned up and contains nothing. Strange. Thanks Vitaly On 4 Сер, 18:11, Michael wrote: > On Tue, Aug 4, 2009 at 11:05 AM, Vitaly wrote: > > > Oh, yeah, the

Re: buildung query with ORM

2009-08-04 Thread tom
On 4 Aug., 16:40, krylatij wrote: > You need to use raw sql. (http://docs.djangoproject.com/en/dev/topics/ > db/sql/#topics-db-sql) yes. i know that i can use raw sql. but if it's possible, i want to use ORM. > > I don't understand what will be if there are more then 2 channels at > the same

Re: Django file upload. 'None'

2009-08-04 Thread Lakshman Prasad
You need to set the form with the request file, which I think you may have missed: from appname.forms import ImageForm form = ImageForm(request.POST,request.FILES) >From the documentation: http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#basic-file-uploads On Tue, Aug 4, 2009 at 8:3

Django authentication for external apache

2009-08-04 Thread rahul
Hello, I am sure this question would have come up a number of times but I couldn't find any links to suit my requirements. I want to run an external apache to serve media. Apache is to serve media only if the user is logged in. I saw a couple of links for installing Apache Authentication Handler

Re: standalone script

2009-08-04 Thread Michael
On Tue, Aug 4, 2009 at 11:05 AM, Vitaly wrote: > > Oh, yeah, there was only place, but when I removed this code nothing > changed. > > I do not know about this import > > from django.utils.translation import ugettext_lazy as _ > This (and anything from utils ideally) shouldn't need settings top b

Re: standalone script

2009-08-04 Thread Vitaly
Oh, yeah, there was only place, but when I removed this code nothing changed. I do not know about this import from django.utils.translation import ugettext_lazy as _ On 4 Сер, 17:59, Michael wrote: > On Tue, Aug 4, 2009 at 10:46 AM, Vitaly wrote: > > > Hey there > > > For running our test s

Re: standalone script

2009-08-04 Thread Michael
On Tue, Aug 4, 2009 at 10:46 AM, Vitaly wrote: > > Hey there > > For running our test script we are using standalone script. > > Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) > [GCC 4.3.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> from django

Re: Django file upload. 'None'

2009-08-04 Thread Martje
One question though. Even when it is in request.FILES, it doesn't get saved like I expected it would. I expected Django to upload my image to "media/afbeeldingen/ gastenboek/" ánd validate if it is an image or not (I've change FileField to ImageField). Why doesn't Django do this? On 4 aug, 15:1

Re: standalone script

2009-08-04 Thread krylatij
or there is another way. create custom command for manage.py (http://docs.djangoproject.com/en/dev/howto/custom-management-commands/ #howto-custom-management-commands) it's pretty simple. then write bash script like this: #!/bin/bash export PYTHONPATH=/path/to/django cd /path/to/project python man

Re: standalone script

2009-08-04 Thread Vitaly
PYTHONPATH is ok, and application is working, but see that I am running tests, and it raises exception when tries to configure custom settings. On 4 Сер, 17:52, krylatij wrote: > I guess you are using SSH? > > so before running your script run: > export PYTHONPATH=/path/to/django > > hope this h

Re: standalone script

2009-08-04 Thread krylatij
I guess you are using SSH? so before running your script run: export PYTHONPATH=/path/to/django hope this helps --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: buildung query with ORM

2009-08-04 Thread krylatij
You need to use raw sql. (http://docs.djangoproject.com/en/dev/topics/ db/sql/#topics-db-sql) I don't understand what will be if there are more then 2 channels at the same datetime? So i can't provide you solutions sample. --~--~-~--~~~---~--~~ You received this me

standalone script

2009-08-04 Thread Vitaly
Hey there For running our test script we are using standalone script. Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from django.conf import settings, global_settings >>> from fg import settin

  1   2   >