accessing dictionry values in templates

2009-10-09 Thread valler
How can i use dictionary values in example below? def index(request): msg = Msg.objects.all() dict = {0:'good',1:'bad'} return render_to_response('index.html',{'msg':msg,'dict':dict}) index.html {% for m in msg %} ... {{m.status}} -> displays 0 or 1, I want to use my dict here

Re: accessing dictionry values in templates

2009-10-09 Thread Bogdan I. Bursuc
Why don't you set the value directly from the view functions ? return render_to_response('index.html', {'val': dict[msg.status]}) On Thu, 2009-10-08 at 23:51 -0700, valler wrote: > How can i use dictionary values in example below? > > def index(request): > msg = Msg.objects.all() > dict

Quick syntax query - translating a piece of API code for use in a django view

2009-10-09 Thread Eva Hamilton
>From the django documentation (here: >http://www.djangoproject.com/documentation/models/select_related/) I obtained this bit of code for performing a select_related on a list of objects and producing a list of related objects... >>> world = Species.objects.all().select_related() >>>

Re: Quick syntax query - translating a piece of API code for use in a django view

2009-10-09 Thread Bogdan I. Bursuc
You forgot a ")" sign. That's why syntax error. On Thu, 2009-10-08 at 23:48 -0700, Eva Hamilton wrote: > >From the django documentation (here: > >http://www.djangoproject.com/documentation/models/select_related/) > I obtained this bit of code for performing a select_related on a list > of

Re: Automatic primary keys at model inheritance

2009-10-09 Thread Tomasz Zieliński
> > the primary key counters for Restaurant and Bar classes are separated, which > causes me troubles, because I want a Place to be Restaurant or Bar not both. > I'm not sure if this is what you need, but take a look here: http://docs.djangoproject.com/en/dev/topics/db/models/#id8 -- Tomasz

Re: accessing dictionry values in templates

2009-10-09 Thread valler
On Oct 9, 11:14 am, "Bogdan I. Bursuc" wrote: > Why don't you set the value directly from the view functions ? > > return render_to_response('index.html', {'val': dict[msg.status]}) I can not do this in view, because 'msg' is a queryset, returning many values. ""

Re: accessing dictionry values in templates

2009-10-09 Thread Bogdan I. Bursuc
I, see. Don't know an alternative. Don't know if it's possible. You may consider creating a tag or a filter for this job. That will result in a clean, pretty solution. On Fri, 2009-10-09 at 00:28 -0700, valler wrote: > On Oct 9, 11:14 am, "Bogdan I. Bursuc" > wrote:

Re: about django.core.mail.send_mail

2009-10-09 Thread Tomasz Zieliński
On 9 Paź, 05:15, li kai wrote: > Can I send email using others' mail account following these steps? > > 1. I fill my own mail account and password in settings.py. > > 2. When using "send_mail(subject, message, sender, recipients)", I set > sender to  a different mail

Require reverse foreign key

2009-10-09 Thread Kristaps Kūlis
Hello I have such models: Class Model1(models.Model): [content] Class Model2(models.Model): model1 = models.ForeignKey(Model1) How to ensure that Model1 has at least 1 referenced model ? data are added using django admin interface, which inlineadmins Kristaps Kūlis Reality is just a

Re: accessing dictionry values in templates

2009-10-09 Thread Javier Guerra
Bogdan I. Bursuc wrote: > You may consider > creating a tag or a filter for this job. or a function on the model class -- Javier --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Quick syntax query - translating a piece of API code for use in a django view

2009-10-09 Thread Eva Hamilton
Oops, sorry, that's a typo in the post - but not present in the actual code. It should have read... world = Species.objects.all.select_related() family_list = [o.genus.family for o in world] Or is there another missing ")" that I'm not seeing? Thank you! On Oct 9, 5:18 pm, "Bogdan I.

Re: accessing dictionry values in templates

2009-10-09 Thread valler
Thank you, this was the most beautiful solution. I post it here, in case if someone will search it: class Msg(models.Model): .. .. .. status = models.IntegerField(choices=MSG_STATUS_LIST) def getStatus(self): return MSG_STATUS_LIST[self.road_status][1] in template:

Re: accessing dictionry values in templates

2009-10-09 Thread valler
Thank you, this was the most beautiful solution. I post it here, in case if someone will search it: class Msg(models.Model): .. .. .. status = models.IntegerField(choices=MSG_STATUS_LIST) def getStatus(self): return MSG_STATUS_LIST[self.status][1] in template:

Re: Quick syntax query - translating a piece of API code for use in a django view

2009-10-09 Thread Bogdan I. Bursuc
In the view the syntax is world = Species.objects.all().select_related() see the brackets after the all method. only when you use the code in the template you don't put brackets for a method/function. On Fri, 2009-10-09 at 01:06 -0700, Eva Hamilton wrote: > Oops, sorry, that's a typo in the

Re: Quick syntax query - translating a piece of API code for use in a django view

2009-10-09 Thread Daniel Roseman
On Oct 9, 9:06 am, Eva Hamilton wrote: > Oops, sorry, that's a typo in the post - but not present in the actual > code. > > It should have read... > > world = Species.objects.all.select_related() No, it shouldn't. Compare your original: > > > >>> world =

Re: accessing dictionry values in templates

2009-10-09 Thread Bogdan I. Bursuc
It can be improved. My suggestion is to use lower_underscored for methods names and you can do something like this: delete the method in your model because django models allready provides a method for your choice fields: get_field_display() for your field would be:

Re: Quick syntax query - translating a piece of API code for use in a django view

2009-10-09 Thread Bogdan I. Bursuc
I know the shell and view are the same i meant the view and the template are different, you didn't specify the brackets after the all method like: all(), this because your might be used with the template syntax, I made this mistake, too. That why i was telling you about the difference between

Re: new permission

2009-10-09 Thread elminio
Up Up On Oct 8, 12:10 pm, elminio wrote: > Hi, > I've extended my model with new permission. > >   class Meta: >         permissions = ( >             ("total", "total"), >         ) > > After that I mafe manage.py syncdb. But after that when I wanted to > add user new

Re: new permission

2009-10-09 Thread Bogdan I. Bursuc
Try to delete the auth_permissions table the sync db see if it helps On Fri, 2009-10-09 at 01:29 -0700, elminio wrote: > Up Up > > On Oct 8, 12:10 pm, elminio wrote: > > Hi, > > I've extended my model with new permission. > > > > class Meta: > > permissions =

Cannot import other model

2009-10-09 Thread Christian Wittwer
Hi, I have a strange problem with importing models from an other app. /myapp/season/models.py --- from myapp.team.models import Player class Game(models.Model):

Re: Cannot import other model

2009-10-09 Thread Bogdan I. Bursuc
from shcbelpa.season.models import Game This is the line of code that generates the error right? Is myapp = shcbelpa ? On Fri, 2009-10-09 at 10:39 +0200, Christian Wittwer wrote: > Hi, > I have a strange problem with importing models from an other app. > > /myapp/season/models.py >

Templating wart

2009-10-09 Thread Chris Withers
Hi All, I have a piece of template that looks like this: > >{% for cell in row %} > >{% if forloop.first and row.url %}{% endif %} >{{cell}} >{% if forloop.first and row.url %}{% endif %} > >{% endfor %} > How can I structure this such that I don't have to

server performance

2009-10-09 Thread elminio
Hi, I'm going to take my project on production. Now I'm looking for good hosting service and I would like to know what are django requirements. I mean what CPU, RAM, would be enough form website with more than 2000 visitors per day. And for website with visitors sth like 1000 per day. Maybe any

Re: server performance

2009-10-09 Thread Kristaps Kūlis
AFAIK 2000 users per day are enough for even cheapest hosting. If you require custom configuration (like custom C modules etc), consider VPS. Otherwise, go to shared hosting - its cheaper and easyier to manage. You can read reviews and etc on

Re: efficiently deleting content based on how old it is

2009-10-09 Thread Chris Withers
Streamweaver wrote: > You could set this up as a custom manage.py command and run a cron on > that. Gives the advantage of both initiating from outside the app and > using Django's DB abstraction layer. That's prettymuch what I was planning to do :-) > Then just iterate over the month names

Subclassing RegistrationForm in django-registration

2009-10-09 Thread british.assassin
Hi, I am trying to add some more fields for new members to fill in on registration to my site by subclassing the RegistrationForm from the django-registration app. My question is: is there away to do something like this for saving: class PlayerRegistrationForm(RegistrationForm): first_name

Re: problems subclassing models

2009-10-09 Thread Chris Withers
Daniel Roseman wrote: > If your base model doesn't contain any fields, you should probably > mark it as abstract. > http://docs.djangoproject.com/en/dev/topics/db/models/#id6 Thanks, knew there'd be some magic I needed to invoke ;-) Chris --~--~-~--~~~---~--~~

Re: Templating wart

2009-10-09 Thread british.assassin
You could do this: {% for cell in row %} {% if forloop.first and row.url %}{{cell}} {% else %} {{cell}} {% endif %} {% endfor %} On Oct 9, 10:06 am, Chris Withers wrote: > Hi All, > > I have a piece of template that looks like this: > > >   > >    {% for cell in row

Connection limit exceeded for non-superusers

2009-10-09 Thread A Melé
I am using Django with PostgreSQL and everything was ok but in the last weeks I get this error sometimes when loading my sites. I didn't make any changes to the database configuration so I don't know why it doesn't work sometimes. Anybody knows how to solve this? Is Django keeping db connections

Re: Connection limit exceeded for non-superusers

2009-10-09 Thread A Melé
I get this when I run the query: SELECT * FROM pg_stat_activity datid | datname | procpid | usesysid | usename | current_query | waiting | xact_start | query_start | backend_start | client_addr | client_port

Show first available Image in a loop

2009-10-09 Thread The Danny Bos
Hey there, I'm looping through an array of 'trading card' titles. For instance: - Pokemon - Kiss - Baseball Instead of showing just the title of the 'trading card', I'd like to display an image of each instead. But not all images are available for every card in a title, for instance

Re: Subclassing RegistrationForm in django-registration

2009-10-09 Thread Daniel Roseman
On Oct 9, 11:03 am, "british.assassin" wrote: > Hi, > > I am trying to add some more fields for new members to fill in on > registration to my site by subclassing the RegistrationForm from the > django-registration app. My question is: is there away to do > something

Re: Subclassing RegistrationForm in django-registration

2009-10-09 Thread british.assassin
Yeah I did notice that after I posted, lol. Thanks for the advice, it works fine now. On Oct 9, 12:02 pm, Daniel Roseman wrote: > On Oct 9, 11:03 am, "british.assassin" > wrote: > > > > > Hi, > > > I am trying to add some more fields for new

Re: Admin dashboard : hide and merge modules

2009-10-09 Thread JF Simon
A great new feature. It's exactly what I need, thanks !! On 20 sep, 09:37, patrickk wrote: > you can now use GrappelliSite instead of AdminSite which gives you > some options for the admin index page. take a look >

Re: Cannot import other model

2009-10-09 Thread Christian Wittwer
> from shcbelpa.season.models import Game > This is the line of code that generates the error right? > Is myapp = shcbelpa ? Yes, exactly. I forgot to replace.. Any idea why the import doesn't work? > On Fri, 2009-10-09 at 10:39 +0200, Christian Wittwer wrote: >> Hi, >> I have a strange

Re: Cannot import other model

2009-10-09 Thread Daniel Roseman
On Oct 9, 1:01 pm, Christian Wittwer wrote: > > from shcbelpa.season.models import Game > > This is the line of code that generates the error right? > > Is myapp = shcbelpa ? > > Yes, exactly. I forgot to replace.. > Any idea why the import doesn't work? Most likely you

Optional URL argument from model's get_absolute_url causing NoReverseMatch error

2009-10-09 Thread Aaron
I want to have a model view with an optional argument that's specified by the model's get_absolute_url. This argument is None if the model's page is accessed by the user typing in the URL in his browser, while the argument is set to some value if the model's page is accessed by clicking on a link

How to make fields mandatory for User

2009-10-09 Thread Gerard
Hi all, I need the fields first_name and last_name of Django's User object to be mandatory when creating users via the Admin interface. Is there an easy way to do this? Thanx, Gerard. -- self.url = www.gerardjp.com --~--~-~--~~~---~--~~ You received this

Re: Year/month archive help

2009-10-09 Thread ashbii
Hello, Check out Django's built-in "generic" views: http://docs.djangoproject.com/en/dev/ref/generic-views/ It sounds like this solution might work for you if you just want to show an archive of your Posts. With this, you don't have to write any views, you only have to configure the urls and

Re: Templating wart

2009-10-09 Thread Chris Withers
british.assassin wrote: > You could do this: > > > {% for cell in row %} > > {% if forloop.first and row.url %}{{cell}} > {% else %} > {{cell}} > {% endif %} Then you're violating DRY on {{cell}}, which of course may be a lot mroe complicated than {{cell}}... cheers, Chris -- Simplistix

problems with mysql and wsgi

2009-10-09 Thread andreas schmid
hi, im experiencing problems with my project while im using mysql and wsgi. the problem happens when i want to create a user profile with an avatar. it works fine if i start the process with the runserver command. this is the error: http://www.pastebin.org/41177 OSError: [Errno 13]

Re: problems (with mysql and) wsgi

2009-10-09 Thread aschmid
sry... mysql is not the problem. it should be a strict wsgi issue... anyway i cant understand the problem. could it be that root should have write permissions to the media folder because apache is started as root? On Oct 9, 3:53 pm, andreas schmid wrote: > hi, > > im

Re: Optional URL argument from model's get_absolute_url causing NoReverseMatch error

2009-10-09 Thread Javier Guerra
On Fri, Oct 9, 2009 at 8:09 AM, Aaron wrote: > What is the proper way to introduce optional arguments here? add a second line to your URL mappigs with the third argument: (r'^(?P[-\w]+)/(?P[-\w]+)/$', 'model_view'), (r'^(?P[-\w]+)/(?P[-\w]+)/(?P[-\w]+)/$', 'model_view')

Re: How to make fields mandatory for User

2009-10-09 Thread Bayuadji
Hi Gerard, On 10/9/09, Gerard wrote: > > Hi all, > > I need the fields first_name and last_name of Django's User object to be > mandatory when creating users via the Admin interface. Is there an easy way > to do this? The one thing that comes to my mind, is either inherit

Re: problems (with mysql and) wsgi

2009-10-09 Thread Bayuadji
Hi, On 10/9/09, aschmid wrote: > > sry... mysql is not the problem. it should be a strict wsgi issue... > anyway i cant understand the problem. could it be that root should > have write permissions to the media folder because apache is started > as root? it seems that you

Re: [solved] problems (with mysql and) wsgi

2009-10-09 Thread andreas schmid
right... i set write permissions to all for the folder /media/avatars and it works!! many thanks Bayuadji wrote: > Hi, > > On 10/9/09, aschmid wrote: > >> sry... mysql is not the problem. it should be a strict wsgi issue... >> anyway i cant understand the problem. could

Re: Optional URL argument from model's get_absolute_url causing NoReverseMatch error

2009-10-09 Thread Aaron
On Oct 9, 11:22 am, Javier Guerra wrote: > add a second line to your URL mappigs with the third argument: > > (r'^(?P[-\w]+)/(?P[-\w]+)/$', 'model_view'), > (r'^(?P[-\w]+)/(?P[-\w]+)/(?P[-\w]+)/$', 'model_view') That's the problem. 'c' is not supposed to be visible in the

Re: Optional URL argument from model's get_absolute_url causing NoReverseMatch error

2009-10-09 Thread Karen Tracey
On Fri, Oct 9, 2009 at 10:38 AM, Aaron wrote: > > On Oct 9, 11:22 am, Javier Guerra wrote: > > add a second line to your URL mappigs with the third argument: > > > > (r'^(?P[-\w]+)/(?P[-\w]+)/$', 'model_view'), > >

Modelformsets - check if instance in database

2009-10-09 Thread Maksymus007
I have a model formset to edit / add / delete objects from db. I got one extra form for adding new objects. How can I distinguish if given form exists in database ? I mean I need to discard invalid form if it does not represent real object. --~--~-~--~~~---~--~~

Modelformset - disable deletion

2009-10-09 Thread Maksymus007
Its somehow possible to disable deletion for certain forms (models) in formset? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Checking download completed

2009-10-09 Thread Christophe Pettus
On Oct 8, 2009, at 10:41 AM, Alvaro Mouriño wrote: > I was asked to keep track of how many times each edition > is downloaded, but I want to make a difference between completed > downloads and uncompleted. Unfortunately, this is a really messy problem, since the user can cancel downloads, do

Re: Optional URL argument from model's get_absolute_url causing NoReverseMatch error

2009-10-09 Thread Javier Guerra
On Fri, Oct 9, 2009 at 9:38 AM, Aaron wrote: > > On Oct 9, 11:22 am, Javier Guerra wrote: >> add a second line to your URL mappigs with the third argument: >> >> (r'^(?P[-\w]+)/(?P[-\w]+)/$', 'model_view'), >> (r'^(?P[-\w]+)/(?P[-\w]+)/(?P[-\w]+)/$',

Re: Checking download completed

2009-10-09 Thread Alvaro Mouriño
On Fri, Oct 9, 2009 at 1:57 PM, Christophe Pettus wrote: > On Oct 8, 2009, at 10:41 AM, Alvaro Mouriño wrote: >> I was asked to keep track of how many times each edition >> is downloaded, but I want to make a difference between completed >> downloads and uncompleted. > >

inspectdb generates CharFields with 3x max_length

2009-10-09 Thread Brian Morton
This is a very strange problem, so I thought I would post here and see if anyone else had seen this problem. I introspected a MySQL database with Python2.6 using Django SVN HEAD and it produced my models as expected. However, all CharFields have the max_length set to 3x the actual varchar field

Re: Checking download completed

2009-10-09 Thread Christophe Pettus
On Oct 9, 2009, at 9:20 AM, Alvaro Mouriño wrote: > Asking many people about this a friend told me that when he had to do > this the only way was using a CGI script to serve the file. That definitely works. The issues are: (a) Load and performance on the server, since the script needs to

regex infinite loop with 100% cpu use in django.forms.fields.email_re - DOS hole?

2009-10-09 Thread davisd
After hours of debugging, I found that: from django.forms.fields import email_re email_re.match ('viewx3dtextx26q...@yahoo.comx26latlngx3d15854521645943074058') will cause CPU to shoot up 100% and the process will hang forever. Since this is the regex used to validate EmailField on forms,

Re: inspectdb generates CharFields with 3x max_length

2009-10-09 Thread Karen Tracey
On Fri, Oct 9, 2009 at 12:40 PM, Brian Morton wrote: > > This is a very strange problem, so I thought I would post here and see > if anyone else had seen this problem. > > I introspected a MySQL database with Python2.6 using Django SVN HEAD > and it produced my models as

Re: inspectdb generates CharFields with 3x max_length

2009-10-09 Thread Brian Morton
Thanks for the informative reply. I searched the tracker and didn't find anything about it, but I think I was not using the right terms. I had a feeling it had to do with charset and MySQLdb, and I definitely agree it is not a Django thing. I'll keep my eye on Ubuntu's changelog for MySQLdb

Re: regex infinite loop with 100% cpu use in django.forms.fields.email_re - DOS hole?

2009-10-09 Thread davisd
Ok! I just confirmed this, I took down a live server! (On of my own) All I had to do was put the email address in the contact form. -David On Oct 9, 1:13 pm, davisd wrote: > After hours of debugging, I found that: > > from django.forms.fields import email_re >

Re: inspectdb generates CharFields with 3x max_length

2009-10-09 Thread Karen Tracey
On Fri, Oct 9, 2009 at 2:29 PM, Brian Morton wrote: > > Thanks for the informative reply. I searched the tracker and didn't > find anything about it, but I think I was not using the right terms. > > FYI I tend to use the Search tab on code.djangoproject.com and limit the

read static file error

2009-10-09 Thread Shuge Lee
Environment: ubuntu 9.04 + django 1.1 + apache 2.* I did following https://wiki.ubuntu.com/Django however, I got this error message http://dpaste.com/105064/ My configure file: cat /etc/apache2/sites-available/online http://dpaste.com/105065/ The file and path structure of my django project:

Re: regex infinite loop with 100% cpu use in django.forms.fields.email_re - DOS hole?

2009-10-09 Thread Juan Hernandez
Take a look at mine: *In [41]: from django.forms.fields django.forms.fields In [41]: from django.forms.fields import email_re In [42]: email_re.match('viewx3dtextx26q...@yahoo.comx26latlngx3d15854521645943074058 ')* and this is what top shows: * PID USER PR NI VIRT RES SHR S %CPU

Re: Django with Cherokee web server

2009-10-09 Thread Max Battcher
Rudy Lattae wrote: > * Have you used Cherokee with Django? I swapped a VPS a few months back from Apache + mod_python to lighttpd (FCGI) then to nginx then to Cherokee (SCGI)... I got somewhat frustrated with configuration editing and ugly/useless wiki documentation, so ultimately the

Re: regex infinite loop with 100% cpu use in django.forms.fields.email_re - DOS hole?

2009-10-09 Thread James Bennett
Yes. We've confirmed the problem. We're working on a patch. In the meantime, everybody go meditate on the documentation for how to report security issues. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~

Re: regex infinite loop with 100% cpu use in django.forms.fields.email_re - DOS hole?

2009-10-09 Thread davisd
Sorry for the public disclosure... I did email django security after I posted. I'm just getting into this open source goodness and I'm not really sure how it's supposed to operate yet. I did consult the documentation: http://docs.djangoproject.com/en/dev/internals/contributing/ Jacob: I'm

SHOES,HANDBAGS,JEANS,TSHIRTS,JACKETS,

2009-10-09 Thread wei tengrong
nbjgnthk welcome to: http://www.tradekay.com The website wholesale for many kinds of fashion shoes, like the nike,jorda-n,prada,ad-idas, also including the jeans,shir-ts,bags,ha-t and the decorations. All the products are free shipping, and the the price is competitive, and also can accept

Re: regex infinite loop with 100% cpu use in django.forms.fields.email_re - DOS hole?

2009-10-09 Thread Karen Tracey
On Fri, Oct 9, 2009 at 3:21 PM, davisd wrote: > > I'm wondering if a multithreaded webserver setup would be more guarded > against this sort of thing? > > Yeah, but. When I tried this on my own production server (Apache/mod_wsgi) the process handling the request that

Django Developer Position in New York City, Urgent Stuff

2009-10-09 Thread Shaun Hinklein (Sysmind L.L.C)
Hey :) I'm messaging all of you in regards to a Django Developer position located in New York City. The position is extremely urgent and the candidate would start probably next week. If you, or one of your colleagues, is interested in this position, please contact me with your resume at

Django Developer Position in New York City, Urgent Stuff

2009-10-09 Thread shaun hinklein
I'm messaging all of you in regards to a Django Developer position located in New York City. The position is extremely urgent and the candidate would start probably next week. If you, or one of your colleagues, is interested in this position, please contact me with your resume at 609-897-9670 x104

Re: How to make fields mandatory for User

2009-10-09 Thread Gerard
Think I'll go with the form option .. Just finished the User (profile) extention thing with a 1to1 instead of subclassing User :) Thanx for the feedback! Gerard. Bayuadji wrote: > Hi Gerard, > > On 10/9/09, Gerard wrote: >> Hi all, >> >> I need the fields first_name and

Re: Quick syntax query - translating a piece of API code for use in a django view

2009-10-09 Thread Eva Hamilton
Thanks, both of you - I get it now. On Oct 9, 6:22 pm, "Bogdan I. Bursuc" wrote: > I know the shell and view are the same i meant the view and the template > are different, you didn't specify the brackets after the all method > like: all(), this because your might be

ANN: Critical security updates to Django 1.0 and Django 1.1

2009-10-09 Thread James Bennett
Today the Django project is issuing a set of releases to remedy a security issue. This issue was disclosed publicly by a third party on a high-traffic mailing list, and attempts have been made to exploit it against live Django installations; as such, we are bypassing our normal policy for

Re: regex infinite loop with 100% cpu use in django.forms.fields.email_re - DOS hole?

2009-10-09 Thread Jacob Kaplan-Moss
Just as an update for anyone following this thread: This was indeed a security exploit, and it has been fixed. See http://www.djangoproject.com/weblog/2009/oct/09/security/ for details. Jacob --~--~-~--~~~---~--~~ You received this message because you are

How to create a 3rd-party database driver

2009-10-09 Thread Daniel Rhoden
Can you direct me to the documentation for creating my own 3rd-party database driver? I'm wanting to create a sibling to the concept of a SQLite, MySQL, ... Driver. Where's API documentation that says "You must respond to a minimum of these function calls to be a back end driver to django".

Re: How to create a 3rd-party database driver

2009-10-09 Thread akonsu
hello, django.db.backends.dummy is a good starting point. i have used it to implement a workaround for a problem in the sqlite3 backend and yu can find it here: http://code.konstantin.co.uk/mysite/sqlite3_fixed/ hope this helps konstantin On Oct 9, 6:29 pm, Daniel Rhoden

Re: Show first available Image in a loop

2009-10-09 Thread The Danny Bos
I had a feeling this was a pain in the ass. I might try and work out another way around it, maybe a default image for each 'trading card' set? d On Oct 9, 9:54 pm, The Danny Bos wrote: > Hey there, > > I'm looping through an array of 'trading card' titles. For instance:

Re: Show first available Image in a loop

2009-10-09 Thread Tim Chase
> I'm looping through an array of 'trading card' titles. For instance: > > - Pokemon > - Kiss > - Baseball > > Instead of showing just the title of the 'trading card', I'd like to > display an image of each instead. > But not all images are available for every card in a title, for > instance

Uploading an Image.

2009-10-09 Thread Chirolo
Probably this problem has been issue before, but I couldn't find an easy explanation. My problem: When Uploading an image I cannot write to the "image" directory. What I have done: I already changed the permissions on my main directory, and Image directory with 777 and still I'm not able to write

Re: Uploading an Image.

2009-10-09 Thread Bayuadji
Hi Chirolo On 10/9/09, Chirolo wrote: > My question is which file or directory controls this webserverprocess? > or what can I do to solve my problem. > Thank you in advance. > Here is the error output that I get: > File "/usr/lib/python2.5/os.py" in makedirs > 164.

Re: read static file error

2009-10-09 Thread Bayuadji
Hi Shuge Lee, On 10/9/09, Shuge Lee wrote: > > Environment: ubuntu 9.04 + django 1.1 + apache 2.* > > I did following https://wiki.ubuntu.com/Django > > however, I got this error message > http://dpaste.com/105064/ > > My configure file: > cat

Re: Require reverse foreign key

2009-10-09 Thread Bayuadji
On 10/9/09, Kristaps Kūlis wrote: > Hello > > I have such models: > > Class Model1(models.Model): >[content] > Class Model2(models.Model): >model1 = models.ForeignKey(Model1) > > How to ensure that Model1 has at least 1 referenced model ? > data are added

Re: iphone to website

2009-10-09 Thread Shawn Milochik
On Oct 8, 2009, at 9:33 AM, grant neale wrote: > > Well 1 problem I was thinking about was uploading photos. > Any suggestion. > > Grant While it's not Django-specific, it's easy to write a Python script that monitors an e-mail address and downloads and stores the attachments. You could

Re: Problems with custom Auth Backends: 'NoneType' object has no attribute 'DoesNotExist'

2009-10-09 Thread Shawn Milochik
The way to do what you're trying to do is to take advantage of the following: http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users In brief, you'll create another model, which will then be specified in your settings.py by AUTH_PROFILE_MODULE. From then

how to design mobile version of my site based on django?

2009-10-09 Thread hao he
I'm developing my site with django, mainly, my site works as normal, visited by PC. but ,the site will also be visited by mobile device(e.g.iphone) who tell me the solution? or recommend me some relevant articles? thanks . --~--~-~--~~~---~--~~ You received

Model Class Inheritance question

2009-10-09 Thread whiskeyjuvenile
I'm making some sort of galactic map with the following classes defined in models.py: class Star(models.Model): name = models.CharField(max_length=200) xcoord = models.FloatField() ycoord = models.FloatField() zcoord = models.FloatField() def __unicode__(self): return

Re: Model Class Inheritance question

2009-10-09 Thread whiskeyjuvenile
I was thinking, alternatively, in Planet: orbits = models.ForeignKey(System, related_name='planets') def __init__(self, *args, **kwargs): super(Planet, self).__init__(*args, **kwargs) orbits = system --~--~-~--~~~---~--~~ You received this

can I do doctest in view function? if I can, how to use fixture data in doctest?

2009-10-09 Thread hao he
@login_required def overview(request, template = "userprofile/profile/overview.html"): """ this is the doctest of a view function! >>> from django.test.client import Client >>> c = Client() >>> c.login(username='fred', password='secret') >>> response = c.get('/userprofile/overview/') >>>

Re: Model Class Inheritance question

2009-10-09 Thread whiskeyjuvenile
class Planet(Satellite): orbital = models.IntegerField() orbits = models.ForeignKey(Star, related_name='planets') def save(self): self.orbits = self.star super(Planet, self).save() This works, although it seems really inelegant due to duplicating data in Planet.orbits

Re: How to create a 3rd-party database driver

2009-10-09 Thread Russell Keith-Magee
On Sat, Oct 10, 2009 at 6:29 AM, Daniel Rhoden wrote: > > Can you direct me to the documentation for creating my own 3rd-party > database driver? > > I'm wanting to create a sibling to the concept of a SQLite, MySQL, ... > Driver.  Where's API documentation that says "You must