Re: array grouping in templates

2008-10-20 Thread jhf555
Thanks a lot for your help everyone...those are great resources. On Oct 12, 5:50 am, Tim Chase <[EMAIL PROTECTED]> wrote: > > I have an array and I want to use Django templating to display each > > item in a table, grouped by 3 per row. > > For example, if i have > >   arr = ["a", "b", "c", "d",

Feature like "acts_as" in Django ORM or contrib ?

2008-10-20 Thread [EMAIL PROTECTED]
Hi, Are there something in Django ORM or contrib to do "acts_as" like in RoR or Elixir (SqlAlchemy). Example : http://elixir.ematia.de/apidocs06/elixir.ext.html http://elixir.ematia.de/apidocs06/elixir.ext.list.html In Elixir, when I add acts_as_list(qualifier=qualify) in Model I can use

Re: having problems with datefield and datetime.date in models

2008-10-20 Thread Josiah Young
Thanks Karen! Worked great. =) On Mon, Oct 20, 2008 at 9:45 PM, Karen Tracey <[EMAIL PROTECTED]> wrote: > On Tue, Oct 21, 2008 at 12:30 AM, Josiah <[EMAIL PROTECTED]>wrote: > >> >> Ive set up a simple model for a Cruise. It has a cruise date, and >> time. Im trying to pass a datetime.date as the

Re: having problems with datefield and datetime.date in models

2008-10-20 Thread Karen Tracey
On Tue, Oct 21, 2008 at 12:30 AM, Josiah <[EMAIL PROTECTED]>wrote: > > Ive set up a simple model for a Cruise. It has a cruise date, and > time. Im trying to pass a datetime.date as the date parameter which is > defined in the model as models.DateField(). I get the following error > constantly,

having problems with datefield and datetime.date in models

2008-10-20 Thread Josiah
Ive set up a simple model for a Cruise. It has a cruise date, and time. Im trying to pass a datetime.date as the date parameter which is defined in the model as models.DateField(). I get the following error constantly, and cant figure out what it wants me to do. im using sqlite as the temporary

In URL dispatcher, is there a way to pass values of Named Groups directly to template?

2008-10-20 Thread yuanyun.ken
Hi,all great Django users and developers, I have a little problem. In URL dispatcher, is there a way to pass values of Named Groups directly to template, don't want to write a view function just for this. for example, I have the following urls: (r'^machine_logs/$', direct_to_template,

Re: render_to_response failed to render media files in base.html

2008-10-20 Thread James Bennett
On Mon, Oct 20, 2008 at 9:30 PM, Chuck22 <[EMAIL PROTECTED]> wrote: > Adding context_instance=RequestContext(request) to the method fixed > the problem. Seems this should be done by default for > render_to_response method. Thank you. It would be technically impossible to do this;

Re: render_to_response failed to render media files in base.html

2008-10-20 Thread Chuck22
Adding context_instance=RequestContext(request) to the method fixed the problem. Seems this should be done by default for render_to_response method. Thank you. On Oct 20, 4:36 am, Christian Joergensen <[EMAIL PROTECTED]> wrote: > Chuck Bai2 wrote: > > Here is my view code: > > > def

Limiting a ForeignKey when using ModelForm

2008-10-20 Thread tenni
I have a ModelForm: RequestForExtensionForm which is built from a model: RequestForExtension Basic stuff so far... The RequestForExtension model has a ForeignKey to the Unit model (Unit is a study course offered that a student can request an extension on via this form) My problem is that in

Re: Returning Queryset that excludes certain results from another queryset.

2008-10-20 Thread Eric Abrahamsen
On Oct 21, 2008, at 5:38 AM, timc3 wrote: > > So I have a model that looks like this: > > class GroupsOfUser(models.Model): >name = models.CharField(_("Name"), max_length=50) >description = models.TextField(_("Description"), blank=True, > help_text=_("Optional")) >slug =

Re: File upload progress bar for Django?

2008-10-20 Thread Sascha Brossmann
> Is anyone > familiar with a django or python tutorial that shows how to implement > some kind of file upload progress bar? Sorry, but the main magic in those uploaders is done via flash, not via js or php. AFAIK there is currently no sane (though you may use Java ;-)) way to do it otherwise.

Returning Queryset that excludes certain results from another queryset.

2008-10-20 Thread timc3
So I have a model that looks like this: class GroupsOfUser(models.Model): name = models.CharField(_("Name"), max_length=50) description = models.TextField(_("Description"), blank=True, help_text=_("Optional")) slug = models.SlugField() group_members = models.ManyToManyField(User,

Re: Difficulty getting Django working with Apache and mod_python

2008-10-20 Thread Karen Tracey
On Mon, Oct 20, 2008 at 5:15 PM, projecktzero <[EMAIL PROTECTED]>wrote: > > I'm pretty new to Django. I'm having trouble getting my Django > app/web-site to run under Apache2 and Mod_Python. I'm running Django > 0.96. I installed Apache2 and Mod_Python and tested both, and they > seem to work

Re: Migration problems (old svn version to 1.0 and new server)

2008-10-20 Thread Karen Tracey
On Mon, Oct 20, 2008 at 5:10 PM, AdamC <[EMAIL PROTECTED]> wrote: > > 2008/10/20 Karen Tracey <[EMAIL PROTECTED]>: > > On Mon, Oct 20, 2008 at 4:36 PM, AdamC <[EMAIL PROTECTED]> wrote: > >> > >> I'm running the latest checkout using svn as per the download > >> instructions on the djangoproject

Re: Migration problems (old svn version to 1.0 and new server)

2008-10-20 Thread AdamC
2008/10/20 Karen Tracey <[EMAIL PROTECTED]>: > On Mon, Oct 20, 2008 at 4:36 PM, AdamC <[EMAIL PROTECTED]> wrote: >> >> I'm running the latest checkout using svn as per the download >> instructions on the djangoproject site. >> > > OK, now that you've confirmed that and I take a closer look at the

Difficulty getting Django working with Apache and mod_python

2008-10-20 Thread projecktzero
I'm pretty new to Django. I'm having trouble getting my Django app/web-site to run under Apache2 and Mod_Python. I'm running Django 0.96. I installed Apache2 and Mod_Python and tested both, and they seem to work properly. In my http.conf, I have the following: Python Path

Re: problems connecting with Mysql

2008-10-20 Thread pantagruel
Thanks! On Oct 20, 4:37 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Mon, Oct 20, 2008 at 10:23 AM, pantagruel <[EMAIL PROTECTED]>wrote: > > > > > > > Hi, > > > I can connect via the mysql console to the database, my service is > > running.  however when I try to do syncdb from Django I

Re: Migration problems (old svn version to 1.0 and new server)

2008-10-20 Thread Karen Tracey
On Mon, Oct 20, 2008 at 4:36 PM, AdamC <[EMAIL PROTECTED]> wrote: > > I'm running the latest checkout using svn as per the download > instructions on the djangoproject site. > > OK, now that you've confirmed that and I take a closer look at the erroryou have: {%url films.views.edit_film_list

Re: Highlight current active page

2008-10-20 Thread Jesse Young
I have a template block tag {% ifactive %} that lets you highlight the currently active page using similar syntax as the {% url %} tag (i.e., you can specify urlpattern names and arguments in the same way), e.g.: Page 1 Page 2 ... Page N The code for this is at

Re: Migration problems (old svn version to 1.0 and new server)

2008-10-20 Thread AdamC
2008/10/20 Karen Tracey <[EMAIL PROTECTED]>: > 2008/10/20 AdamC <[EMAIL PROTECTED]> >> >> They all import fine. >> >> I do have @login_required at the beginning of a few functions. Has >> this changed since v1.0? > > You mean since 0.96? It certainly hasn't changed since 1.0, and I don't >

Re: Assigning to foreign key relationships with only the pk

2008-10-20 Thread Andy Lei
Thanks, that's just the solution I was looking for! Just out of curiosity, is it also possible to do this for many-to-many relationships? On Oct 20, 2:09 pm, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Oct 20, 6:07 pm, "Andy Lei" <[EMAIL PROTECTED]> wrote: > > > > > Sorry if this is a

Re: Migration problems (old svn version to 1.0 and new server)

2008-10-20 Thread Karen Tracey
2008/10/20 AdamC <[EMAIL PROTECTED]> > They all import fine. > > I do have @login_required at the beginning of a few functions. Has > this changed since v1.0? > You mean since 0.96? It certainly hasn't changed since 1.0, and I don't believe @login_required was changed between 0.96 and 1.0. (If

callable upload_to problem

2008-10-20 Thread Brot
Hello, I am using the latest svn-revision 9236 and tried to use a callable in the upload_to parameter of the ImageField. The explanation in the django-docs for the instance-parameter of a callable says the following: > An instance of the model where the FileField is defined. More specifically,

Re: Migration problems (old svn version to 1.0 and new server)

2008-10-20 Thread AdamC
2008/10/20 Jarek Zgoda <[EMAIL PROTECTED]>: > > Wiadomość napisana w dniu 2008-10-19, o godz. 21:19, przez AdamC: > In template /home/adam/apps/films/templates/includes/nav.html, error at line 1 Caught an exception while rendering: Reverse for 'films.films.views.edit_film_list'

Re: Editing ForeignKey relations from parent

2008-10-20 Thread TiNo
Something that is in a different direction, but might do the trick:check out http://code.google.com/p/django-batchadmin/ You could select multiple "children" and create an "add to parent..." action for it. Hope it helps, TiNo On Mon, Oct 20, 2008 at 8:45 PM, endi <[EMAIL PROTECTED]> wrote: > >

Editing ForeignKey relations from parent

2008-10-20 Thread endi
My database model includes a ForeignKey relationship. I'm writing the admin.py. We have a lot of "children" and "parents". The expected workflow is: create children one by one, then create parent, then add children to the parent. The heaviness of the "child" model makes it unfit for inline

How to save/link/rename thumbnail in model

2008-10-20 Thread Francis
Hi, I'm trying to save a thumbnail image when I save a picture in one of my models. But I have three problems. 1. I can successfully create the thumbnail image, but I cannot link it in my database. 2. Is there a better way to name the thumbnail image? 3. When the save function is called, the

Any way to avoid the SQL hit of auth_messages?

2008-10-20 Thread Rob Hudson
Hi, I'm wanting to reduce an unneeded query from my page views in my project caused from Django's built-in auth_messages. I'm looking for the best solution to do this while still allowing me to use contrib/ auth and the admin. The source of the query comes from the 'auth' context processor, I

PIL with python 2.5 on Leopard - [Solution]

2008-10-20 Thread Francis
I had trouble installing PIL on my Mac with 10.5 Leopard. I always got an : "Upload a valid image. The file you uploaded was either not an image or a corrupted image." I searched to groups for answer but it seems that others were also having this problem. For those who are still looking for a

Re: Assigning to foreign key relationships with only the pk

2008-10-20 Thread Daniel Roseman
On Oct 20, 6:07 pm, "Andy Lei" <[EMAIL PROTECTED]> wrote: > Sorry if this is a repost, i don't think my last message got through: > I have two models: > class Reporter(models.Model): >     pass > > class Article(models.Model): >     reporter = models.ForeignKey(Reporter) > > Let's say I have the

Re: How to get RadioSelect items one by one in a template

2008-10-20 Thread Nathaniel Whiteinge
On Oct 18, 3:40 am, Torsten Bronger <[EMAIL PROTECTED]> wrote: > I try to achieve the following HTML table layout: > > .+--+---+ > .| 1 | | > .+--+---+ > .| 2 | | > .+--+---+ > .| 3 |

django-navbar in 1.0

2008-10-20 Thread Juanjo Conti
Hi! I am trying to use django-navbar app[0], but I am getting troubles because it seems to be pre 1.0. Does anyone know about it? Does any one use it with django 1.0? Thanks, Juanjo [0] http://code.google.com/p/django-navbar/ -- mi blog: http://www.juanjoconti.com.ar

Assigning to foreign key relationships with only the pk

2008-10-20 Thread Andy Lei
Sorry if this is a repost, i don't think my last message got through: I have two models: class Reporter(models.Model): pass class Article(models.Model): reporter = models.ForeignKey(Reporter) Let's say I have the pk of a reporter object. Can I assign the reporter attribute of the

emulate existing session in automated test

2008-10-20 Thread Bruno Zanchet
Hi, well, I'm new to django (coming from rails hehe), and I'm trying to develop using a test-driven approach. I'm facing a problem trying to emulate an existing session in a "functional" test. There is a related problem here (http://groups.google.com/group/django-

Re: How to send emails when after an event happened?

2008-10-20 Thread Steve Holden
A better starting point might be http://docs.djangoproject.com/en/dev/topics/email/ which the OP will already have seen if he followed Karen's advice. regards Steve megrez80 wrote: > Start here: http://www.python.org/doc/2.5.2/lib/module-smtplib.html . > > Ken > > > On Oct 19, 2:04 am,

Re: Custom upload handlers: Potential multi threading, session, etc issues. Take a look!

2008-10-20 Thread truebosko
As I said in my post, I put it up on a non-dev server (lighttpd/fcgi setup with mediatemple) because I know dev server can't handle it. On Oct 20, 11:56 am, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > truebosko wrote: > > What I found though, is that the view that is being called from JS > >

Re: save_model and how to ignore any changes to an object

2008-10-20 Thread Markos Gogoulos
Excellent, many thanks TiNo! On Oct 20, 12:39 am, TiNo <[EMAIL PROTECTED]> wrote: > In django admin, there is a save_as option. > > seehttp://docs.djangoproject.com/en/dev/ref/contrib/admin/#save-as > > You could also save revisions of objects. >

File upload progress bar for Django?

2008-10-20 Thread M Godshall
I've found several file upload progress bar applications, but the source code is usually written in php (like http://www.swfupload.org/ and http://www.pixeline.be/experiments/jqUploader/). Is anyone familiar with a django or python tutorial that shows how to implement some kind of file upload

best practice for form update?

2008-10-20 Thread greinhart
Hi, This thread http://groups.google.com/group/django-users/browse_frm/thread/56b0a150a777333a seems to reply to this question... but all sources pasted in the http://dpaste.com site are no more available... Is anybody still have theme. Thanks, Gerald

Re: Custom upload handlers: Potential multi threading, session, etc issues. Take a look!

2008-10-20 Thread Ivan Sagalaev
truebosko wrote: > What I found though, is that the view that is being called from JS > will finally have access to the session variable after the upload is > complete Looks like you're doing it with development server. It's single-process and can't handle and upload and another view

Re: ModelForm fails with TypeError on save

2008-10-20 Thread simong
On Oct 20, 12:28 pm, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Oct 20, 11:12 am, simong <[EMAIL PROTECTED]> wrote: > > > > >         if request.method == 'POST': > >                 orderform = OrderForm(request.POST) > >                 if orderform.is_valid(): > >                        

Re: assigning variables in templates

2008-10-20 Thread Chris Emerson
Hi, On Wed, Oct 15, 2008 at 01:46:38PM -0700, bmt wrote: > my problem is that when this list is empty i want to branch in the > template, and display some sort of message, instead of the usual 'for' > loop which would display the returned list. since i can't assign the > returned list to a

Re: problems connecting with Mysql

2008-10-20 Thread Karen Tracey
On Mon, Oct 20, 2008 at 10:23 AM, pantagruel <[EMAIL PROTECTED]>wrote: > > Hi, > > I can connect via the mysql console to the database, my service is > running. however when I try to do syncdb from Django I get: > > _mysql_exceptions.OperationalError: (2003,"Can't connect to MySQL > server on

Re: missing template for admin

2008-10-20 Thread Thomas Guettler
DanJ schrieb: > Hi, > > I'm new to Django so please pardon my ignorance. > I've just installed Django 1.0 from SVN. I'm trying to follow the > tutorial, while at the same time use Apache and mod_python. > > When I point my browser to the admin site I get a simple text version, > as if it missing

Re: select_related and m2m

2008-10-20 Thread Erik Allik
Sorry, found this: http://code.djangoproject.com/ticket/6432 I think I will probably just denormalize. Erik On 20.10.2008, at 17:22, Erik Allik wrote: > > I've a feeling that this has been brought up before so my apologies > just in case my feeling is right! > > I'm doing a qs =

Re: How to send emails when after an event happened?

2008-10-20 Thread megrez80
Start here: http://www.python.org/doc/2.5.2/lib/module-smtplib.html . Ken On Oct 19, 2:04 am, Net_Boy <[EMAIL PROTECTED]> wrote: > Hi, > >    I am doing a new project and  (doing a function that checks  for a > specific event, if it happened then the system should send email to > the user?

problems connecting with Mysql

2008-10-20 Thread pantagruel
Hi, I can connect via the mysql console to the database, my service is running. however when I try to do syncdb from Django I get: _mysql_exceptions.OperationalError: (2003,"Can't connect to MySQL server on 'localhost' (10061)") My current test Django settings.py says: DATABASE_ENGINE =

select_related and m2m

2008-10-20 Thread Erik Allik
I've a feeling that this has been brought up before so my apologies just in case my feeling is right! I'm doing a qs = MyModel.objects.all().select_related("foobars") where foobars is a m2m relation. Later when doing qs_item.foobars.all(), a database hit is generated. Is this a bug, a

Re: Paginator - JSON - Serializing related issue

2008-10-20 Thread H. de Vries
Hey Rajesh, Thank you so much for your comment. Somehow Google didn't sent me a message that I had a reply on my post, so that's why I'm late with my reply. I think your solution looks neat, but this way I would still need 2 ajax requests wouldn't I? Doesn't self.options.pop('fields', None)

template queryset sort filter search

2008-10-20 Thread dusans
What is the best reasuable way of implementing Sorting on each field and filtering --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Custom upload handlers: Potential multi threading, session, etc issues. Take a look!

2008-10-20 Thread truebosko
Hi there, I wrote a previous post but I have discovered a bit more since. Here's my situation: What I'm trying to do: Write a custom upload handler that allows me to intercept it with Javascript calls and return a simple progress upload bar to the user. What is happening: The custom upload

Re: maximum recursion depth exceeded ???

2008-10-20 Thread Thomas Guettler
kele schrieb: > i just try to make my first authenticate codes . but while in the > line > ' login(request, v) ' , i got this runtime error , and > 'maximum recursion depth exceeded'. > > but i do not have any loop there . why ??? help . > > you call login() inside login(): > def

Re: maximum recursion depth exceeded ???

2008-10-20 Thread kele
sorry . i blow myself up ! i redefine the login function . ignore me . On Oct 20, 7:41 pm, kele <[EMAIL PROTECTED]> wrote: > i just try to make my first authenticate codes . but while in the > line > '      login(request, v) '   , i got this  runtime error  , and > 'maximum recursion depth

maximum recursion depth exceeded ???

2008-10-20 Thread kele
i just try to make my first authenticate codes . but while in the line ' login(request, v) ' , i got this runtime error , and 'maximum recursion depth exceeded'. but i do not have any loop there . why ??? help . my codes r shown as below : def login(request ,template_name):

Re: Strange problem with 'syncdb' not finding application models

2008-10-20 Thread Will Boyce
Thanks for the quick response Daniel! The only self-referencing import I can see is that __init__.py is importing a model from the apps models.py: [EMAIL PROTECTED]:~/ibd$ grep -n -r granular granular_permissions/ granular_permissions/__init__.py:8:from granular_permissions.models import

Re: Strange problem with 'syncdb' not finding application models

2008-10-20 Thread Daniel Roseman
On Oct 20, 12:26 pm, Will Boyce <[EMAIL PROTECTED]> wrote: > I was throwing together a (supposedly quick!) project today to gather > some information from customers, however I hit a stumbling block a > while back and I now feel like I'm banging my head on a brick wall.. > > I've modified the

Re: ModelForm fails with TypeError on save

2008-10-20 Thread Daniel Roseman
On Oct 20, 11:12 am, simong <[EMAIL PROTECTED]> wrote: >         if request.method == 'POST': >                 orderform = OrderForm(request.POST) >                 if orderform.is_valid(): >                         preorder = orderform.save(commit=False) >                         orderno  =

Strange problem with 'syncdb' not finding application models

2008-10-20 Thread Will Boyce
I was throwing together a (supposedly quick!) project today to gather some information from customers, however I hit a stumbling block a while back and I now feel like I'm banging my head on a brick wall.. I've modified the syncdb process to be a bit more verbose: ..snip.. Loading

Re: variables in forms.py?

2008-10-20 Thread tofergus
On 19.10-11:37, Jorge Romo wrote: [ ... ] > I want to validate a form, but it has several different options. It > has to take a value_a and the see if it is bigger, smaller or equal to > another value_b. The issue (or maybe not :p) is that the value_b is > entered by the user, so it is always

ModelForm fails with TypeError on save

2008-10-20 Thread simong
I have a model like this: class OrderProfile(models.Model): cartid = models.CharField(max_length=128, null=True, blank=True) orderno = models.CharField(max_length=48, null=True, blank=True) userid = models.CharField(max_length=128, null=True, blank=True)

Re: Custom Template Tag with {% end... %} tag

2008-10-20 Thread Erik Allik
I guess it was easier for me to type it myself than search through the new documentation. :) Erik On 20.10.2008, at 5:49, James Bennett wrote: > > On Sun, Oct 19, 2008 at 4:20 PM, Erik Allik <[EMAIL PROTECTED]> wrote: >> In the compilation function of your template tag, you can force the >>

Re: separate users from django admin'able users

2008-10-20 Thread Jarek Zgoda
Wiadomość napisana w dniu 2008-10-20, o godz. 04:42, przez tvaughan: >>> I'm definitely ok with admins having to create another account to >>> use >>> the site. The two pools of users seems to me to be totally unique, >>> and >>> shouldn't overlap in anyway. >> >> Just do not set is_staff

Re: render_to_response failed to render media files in base.html

2008-10-20 Thread Christian Joergensen
Chuck Bai2 wrote: > Here is my view code: > > def contact(request): > form = ContactForm() # An unbound form > return render_to_response('contact.html', { > 'form': form, > }) > My contact form page rendered but without all the media files(CSS files, > Javascripts files,

Re: Migration problems (old svn version to 1.0 and new server)

2008-10-20 Thread Jarek Zgoda
Wiadomość napisana w dniu 2008-10-19, o godz. 21:19, przez AdamC: >>> In template /home/adam/apps/films/templates/includes/nav.html, error >>> at line 1 >>> Caught an exception while rendering: Reverse for >>> 'films.films.views.edit_film_list' with arguments '()' and keyword >>> arguments '{}'

Re: alternative for foreignkey fieldset

2008-10-20 Thread Russell Keith-Magee
On Mon, Oct 20, 2008 at 1:50 AM, Low Kian Seong <[EMAIL PROTECTED]> wrote: > Just curious but has anyone done this is a production environment? Used raw_id_fields? Written a custom widget and used it in the admin? In my case, yes to both questions - although I'm not sure of the significance of a

Re: Simplest unit testing of models fail ...

2008-10-20 Thread Russell Keith-Magee
On Sun, Oct 19, 2008 at 5:06 PM, zobbo <[EMAIL PROTECTED]> wrote: > > When a test fails and another test then runs, it dies because the > transaction is in error. The field with too many chars fails and that > causes the next test to raise an error. If you switch the backend to > SQLLite for

Re: middleware or view ?

2008-10-20 Thread Russell Keith-Magee
On Sun, Oct 19, 2008 at 7:27 PM, PonasNiekas <[EMAIL PROTECTED]> wrote: > > Thanks Russ for the replay. Your idea would certainly work and I agree > that > doing calculations outside django/web server makes sense. I will > probably > and up doing the way you described. > > On the other hand,

Mozilla connection interrupted error while using thread running python subprocess popen in shell

2008-10-20 Thread emy_66
Hello, I don't know much about networking. I keep getting a connection interrupted error page when I start a thread which runs the python subprocess popen method: "proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)". After starting this thread my function returns a render to