Re: A Model to store links to other models

2010-11-19 Thread Steve Holden
On 11/19/2010 8:51 PM, Micah Carrick wrote: > I'm having trouble coming up with a pretty solution to a seemingly > simple task. I'm relatively new to Django. > > I want to allow the end user to control various lists of links on the > site used for navigation. The admin should allow the creation of

Re: Models not being updated when accessed by multiple processes

2010-11-19 Thread JeeyoungKim
I'm wondering, how are fail_to_get_lock and release_lock implemented? It would be some kind of multiprocess lock, which seems overly complicated.. using save() in this case is cumbersome, because save() is not threadsafe... you'll have to try to maintain your own lock. If you only want to impleme

Re: Django Tutorial - http://docs.djangoproject.com/en/dev/intro/tutorial01/

2010-11-19 Thread Kenneth Gonsalves
On Fri, 2010-11-19 at 12:44 -0800, hank23 wrote: > 'DateFimeField' typo -- regards Kenneth Gonsalves -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this g

Re: Django Tutorial - http://docs.djangoproject.com/en/dev/intro/tutorial01/

2010-11-19 Thread Joseph (Driftwood Cove Designs)
just off the cuff - what's a "DateFimeField"?should be DateTimeField? On Nov 19, 12:44 pm, hank23 wrote: > I'm trying to work through part 1 of the tutorial at: > > http://docs.djangoproject.com/en/dev/intro/tutorial01/ > > and I seem to be having problems getting my model code to work. I > c

Multiple inheritance model

2010-11-19 Thread Joseph (Driftwood Cove Designs)
I'm trying to integrate two existing apps, both of which provide a django Model - call them ModelA and ModelB - my app's model needs to inherit from both of these. I know django models support multiple inheritance, but both ModelA and ModelB define a Meta class, override the save() method, etc., so

Django Tutorial - http://docs.djangoproject.com/en/dev/intro/tutorial01/

2010-11-19 Thread hank23
I'm trying to work through part 1 of the tutorial at: http://docs.djangoproject.com/en/dev/intro/tutorial01/ and I seem to be having problems getting my model code to work. I currently have Django-1.2.3, and Python 2.7 installed. I was able to run the startproject and create the mysite directory

Re: I have an idea for a new tag

2010-11-19 Thread Adam Hallett
Just a thought, what about: {% for k,v in mydict|order:'key' %} or {% for k,v in mydict orderby key %} -Adam On Nov 19, 10:55 am, Paweł Roman wrote: > When rendering dictionary, there is absolutely no way to display > values sorted by keys. The only workaround is to copy all the dict > items

Display ForeignKey label rather than ID in a CharField

2010-11-19 Thread Jamie Pittock
I have to override the default display of a foreignkey field in a form and instead display it as a CharField. Currently it displays the selection's ID but I need to display the label instead To be clear, the select option would be the default display for the ForeignKey. At the moment after I've

A Model to store links to other models

2010-11-19 Thread Micah Carrick
I'm having trouble coming up with a pretty solution to a seemingly simple task. I'm relatively new to Django. I want to allow the end user to control various lists of links on the site used for navigation. The admin should allow the creation of "link groups" which have a collection of "links". The

Re: Models not being updated when accessed by multiple processes

2010-11-19 Thread Iqbal Abdullah
Hi Steve, Ops, yes, I forgot to include the object.save() in the pseudo code above. Yes, we're actually saving it: 1 object = MyModel.object.get(id=1) 2 print object.value# starting value is 5 3 while object.fail_to_get_lock(): 4sleep(5) 5 object = MyModel.object.get(id=1) # Re-get the o

Feedback on New Database Template Application

2010-11-19 Thread Mark (Nosrednakram)
Hello Django Users, I decided to write a series of applications that will make up a cms among other things and the first application is a database template application. It's for a cms where users won't have OS access. There is a demo site that has nothing but the application and revision. It us

Re: Using foreignkey data as a primary key

2010-11-19 Thread fei
If you really want to have a separate table for Tag, You can do this: class CurrentTag(models.Model): tag = models.OneToOneField(Tag, primary_key=True) def __unicode__(self): return self.tag On Nov 20, 12:10 am, JE wrote: > Thanks for the replies. > I simplified the problem a bit

Re: Models not being updated when accessed by multiple processes

2010-11-19 Thread Steve Holden
On 11/19/2010 5:35 PM, Iqbal Abdullah wrote: > Hi, > > This might be a gotcha on the models side, but I would like > clarification and guidance on how to write the code better concerning > multiple process accessing the same data via models. > > I have a backend script that runs the following cod

Models not being updated when accessed by multiple processes

2010-11-19 Thread Iqbal Abdullah
Hi, This might be a gotcha on the models side, but I would like clarification and guidance on how to write the code better concerning multiple process accessing the same data via models. I have a backend script that runs the following code in multiple processes: 1 object = MyModel.object.get(id=

Re: I have an idea for a new tag

2010-11-19 Thread Doug
An easy alternative is to make a sort filter: register.filter('sort',lambda x: sorted(x)) and then do {% for k,v in mydict.items|sort %} {{k}}:{{v}} {% endfor %} I had to look at the docs to realize there isn't a sort filter in django for some reason. I long ago added the one above to built

Re: Static files ...

2010-11-19 Thread Steve Holden
On 11/19/2010 1:56 PM, jonno wrote: > And I have: > > {% load staticfiles %} > {% get_staticfiles_prefix as STATIC_PREFIX %} > > at the top of my template. Sorry to trouble all with this again! > Thanks for any help -- Jon. PS: You might want to consider injecting STATIC_PREFIX into your contex

Re: Cache problem after new image uploaded?

2010-11-19 Thread vcarney
Doing a redirect to the page with ?rand=time.time() did not work either. On Nov 19, 12:47 pm, vcarney wrote: > This can be replicated in ie8 100% of the time and FF about 10% of the > time. > > On Nov 19, 12:42 pm, vcarney wrote: > > > > > > > > > I have a custom settings form with a photo field

Re: Static files ...

2010-11-19 Thread Steve Holden
On 11/19/2010 1:56 PM, jonno wrote: > Hello, > > Sorry not to have replied for so long, but I thought I'd better just > try and dig through it! In the meantime, I have upgraded to Django > (1, 3, 0, 'alpha', 1) and follow the instructions in the development > documentation. I am just trying to s

Re: Static files ...

2010-11-19 Thread jonno
Hello, Sorry not to have replied for so long, but I thought I'd better just try and dig through it! In the meantime, I have upgraded to Django (1, 3, 0, 'alpha', 1) and follow the instructions in the development documentation. I am just trying to serve my static files for development purposes, b

Re: Cache problem after new image uploaded?

2010-11-19 Thread vcarney
This can be replicated in ie8 100% of the time and FF about 10% of the time. On Nov 19, 12:42 pm, vcarney wrote: > I have a custom settings form with a photo field: photo = > forms.ImageField(max_length=200, required=False) > > On submission with a new photo being uploaded, I delete any existing

Cache problem after new image uploaded?

2010-11-19 Thread vcarney
I have a custom settings form with a photo field: photo = forms.ImageField(max_length=200, required=False) On submission with a new photo being uploaded, I delete any existing image including its parent folder and replace with the new one. When the settings page is reloaded, the old image is still

I have an idea for a new tag

2010-11-19 Thread Paweł Roman
When rendering dictionary, there is absolutely no way to display values sorted by keys. The only workaround is to copy all the dict items to a sortable structure e.g. list and pass the list to the template, instead of the dictionary. Why not introduce a new tag to solve this problem: I say, it sh

Pass variable by URL to admin views

2010-11-19 Thread Tros Alba
I want to pass a variable by URL to another page in django admin. it seems it is not working, i want to pass the variable "/? name=hello",but the url becomes "/?e=1" ( i think this is a redirect made by Django )... does any one knows how to solve this problem Thanks -- You received this message

Re: django_content_type integrity error on sync and loaddata

2010-11-19 Thread Shawn Milochik
When you run dumpdata you can specify apps or models within an app to export. That will allow you to avoid bringing Django's scaffolding into your fixtures. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: mac No module named _md5 error

2010-11-19 Thread MrPeabody
which python returns /opt/local/Library/Frameworks/Python.framework/ Versions/2.6/bin/python I didn't install python 2.6.6, at least to my knowledge. Django doesn't automatically load it does it? I have not explicitly loaded Python myself. The first time I checked was after loading django I jus

django_content_type integrity error on sync and loaddata

2010-11-19 Thread Murray
I'm trying to recreate my database and reload the data in it, using the following steps: On my app I dump data to a fixtures file with > ./manage.py dumpdata > test_fixture then drop and recreate the database then run > ./manage.py syncdb to recreate the database tables and > ./manage.py loadda

Re: Variable extends tag

2010-11-19 Thread David De La Harpe Golden
extends can take a variable arg, set the variable to the base you want. {% extends base %} http://docs.djangoproject.com/en/1.2/ref/templates/builtins/#extends -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email t

Re: Generic relation overflows the maximum recursion depth

2010-11-19 Thread Daniel Roseman
On Nov 19, 3:46 pm, Jonas Geiregat wrote: > I'm trying to save a model and then insert it into a generic relation. > Having this models.py file: > > from django.db import models > from datetime import datetime > from django.conf import settings > from django.contrib.contenttypes.models import Cont

Generic relation overflows the maximum recursion depth

2010-11-19 Thread Jonas Geiregat
I'm trying to save a model and then insert it into a generic relation. Having this models.py file: from django.db import models from datetime import datetime from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic

Re: URL grows in address bar with each click

2010-11-19 Thread Ross
Aha! Thanks Shawn. I'd left a forgotten "http://localhost:8000/ moreInfo" in there. I was so hung up on Django urls.py I forgot about simple html mistakes and leftovers. Thanks for the pointer! -Ross. On Nov 19, 10:16 am, Shawn Milochik wrote: > What does the "action" parameter of your HTML f

Re: URL grows in address bar with each click

2010-11-19 Thread Shawn Milochik
What does the "action" parameter of your HTML form contain? I'm guessing it's a relative URL. If you want it to go to the same place, you can make the action blank ("") and it will submit to the same page. Shawn -- You received this message because you are subscribed to the Google Groups "Djan

URL grows in address bar with each click

2010-11-19 Thread Ross
I've noticed a thing which is likely a symptom of something I'm doing wrong. A good example is a page I'm serving which holds a form. If there are issues with the form content, the same page is reloaded, with an updated warning message in the body of the HTML. The page is, say, addInfo.html and

Re: Nested Categories in Admin

2010-11-19 Thread derek
You will need to use Javascipt: handwritten or via framework e.g. JQuery. Its been asked about before on this mailing list and numerous people have blogged on it. On Nov 16, 11:58 am, Federico Capoano wrote: > Any suggestion? > > On Nov 14, 6:15 pm, Federico Capoano wrote: > > > Hi all, > > > I

Variable extends tag

2010-11-19 Thread Anderson Goulart
Hi, In the django documentation (http://docs.djangoproject.com/en/dev/topics/templates/) it says that {% extends %} tag should be the first one. Is there a way to create variable base templates? Like this: {% if is_blah %} {% extends 'base.html' %} {% else %} {% extends 'base2.html' %} {% endi

Re: django charts

2010-11-19 Thread Anderson Goulart
I am not an expert on charts, but I am using highcharts.com to generate some. What I do here is: 1) get the data from the database inside the view (look for querysets on django-documentation) 2) render this data on a template 3) build the chart using this library inside the template bye, glob

AttributeError: Model object has no attribute blah

2010-11-19 Thread Jean-Pierre De Villiers
Hi, I've been using Djangos manytomany functionality to add values into the auto generated table, here are my model classes: class Contract_Item(models.Model): quant = models.DecimalField(max_digits=10, decimal_places=4) item = models.OneToOneField(Item) class Contract(models.Model):

Re: auth user permissions

2010-11-19 Thread MikeKJ
Thx, knew I'd forgotten something Łukasz Balcerzak wrote: > > Try running "python manage.py syncdb". Hope that helps > > On Nov 19, 2:00 pm, MikeKJ wrote: >> I have forgotten something here, added a model to a site, restarted the >> server but the add/change/delete permission set is not showi

Re: auth user permissions

2010-11-19 Thread lukaszb
Try running "python manage.py syncdb". Hope that helps On Nov 19, 2:00 pm, MikeKJ wrote: > I have forgotten something here, added a model to a site, restarted the > server but the add/change/delete permission set is not showing in the > auth-user add permission set, what is it I have forgotten pl

filefield and utf-8, rev12661 and filefield.size

2010-11-19 Thread patrickk
with rev 12661, storage.py has been changed and return smart_str(os.path.normpath(path)) has been replaced with return os.path.normpath(path) now, when trying to upload a filefield (or displaying the size of a filefield), we get this error: Caught UnicodeEncodeError while rendering: 'ascii' codec

Re: fieldsets not working in admin

2010-11-19 Thread Reikje
Bah stupid me. Use admin.site.register(Poll, PollAdmin) not just admin.site.register(Poll). Sorry ... On Nov 19, 10:26 am, Reikje wrote: > Hi, playing around with the django tutorial part 2. The fieldsets > example does not work at all for me. I don't see the fieldsets. No > error displayed. Anyo

auth user permissions

2010-11-19 Thread MikeKJ
I have forgotten something here, added a model to a site, restarted the server but the add/change/delete permission set is not showing in the auth-user add permission set, what is it I have forgotten please? -- View this message in context: http://old.nabble.com/auth-user-permissions-tp30257316p

fieldsets not working in admin

2010-11-19 Thread Reikje
Hi, playing around with the django tutorial part 2. The fieldsets example does not work at all for me. I don't see the fieldsets. No error displayed. Anyone had this? Using ubuntu 10.04 and django 1.2.3 installed with easy_install not Synaptic. -- You received this message because you are subscri

django charts

2010-11-19 Thread Priya
Hi, I am a new user to django ,can anybody please help me resolve this issue.I am trying to construct a Gant chart based on the certain constraints.Now i am unable to make a line of approach for this.I have defined a class for chart and defined function for it in views.Now how do i pass my values t

Re: forloop.last FAIL in template.

2010-11-19 Thread Sithembewena Lloyd Dube
for tag in tags_list: tag.blogs_count = tag.blogpost_set.count() clean_tags = [] for tag in tags_list: if tag.blogs_count != 0: clean_tags.append(tag) tags_list = clean_tags - Just fixed that. The indentation gave the code a different meaning :). On Fri, Nov 19, 2010 at 1:37 PM, S

Re: forloop.last FAIL in template.

2010-11-19 Thread Sithembewena Lloyd Dube
Bruno, you were absolutely right - the "last" tag in my loop wasn't really the last. I had this: for tag in tags_list: tag.blogs_count = tag.blogpost_set.count() So, each tag would get a blog count, and some tags had zero blogs. In the template, I was only writing out those tags that ha

Re: Django Dropdown List

2010-11-19 Thread Derek
Sean I hear what you say - but is this approach also readily available inside the Admin framework? Derek On 16 November 2010 16:20, Shawn Milochik wrote: > On Tue, Nov 16, 2010 at 9:08 AM, derek wrote: > > " you'll have to have all the states/provinces as 'choices' in the > > ChoiceField in t

Re: forloop.last FAIL in template.

2010-11-19 Thread Sithembewena Lloyd Dube
Hi Bruno, Thanks for the idea! I checked my data and nothing seems out of the ordinary. truly stumps me. Regards On Fri, Nov 19, 2010 at 12:51 PM, bruno desthuilliers < bruno.desthuilli...@gmail.com> wrote: > > > On 19 nov, 11:09, Sithembewena Lloyd Dube wrote: > > Hi everyone, > > > > I have

Re: Using foreignkey data as a primary key

2010-11-19 Thread JE
Thanks for the replies. I simplified the problem a bit by deciding it will be easier to have some extra validation code in a separate admin view to do what I need it to and removed the CurrentTag table, similar to what Rainy has said. On Nov 18, 4:59 pm, Rainy wrote: > On Nov 18, 9:04 am, JE wr

Re: forloop.last FAIL in template.

2010-11-19 Thread bruno desthuilliers
On 19 nov, 11:09, Sithembewena Lloyd Dube wrote: > Hi everyone, > > I have a template where Django is spitting out blog tags followed by a ',' > when the tag is not the final one in the loop. > > {% if not forloop.last %}, {% endif %} > > Strangely, I am still seeing tag1, tag2, tag3, This shou

Re: Need help using ExtJS in Django

2010-11-19 Thread bruno desthuilliers
On 19 nov, 07:23, codingJoe wrote: > Newbie question here... I know the basics of Django and nothing of > ExtJS.  I am running a simple web framework and I want to integrate > ExtJS Grid into it. > > My first step was to run the example grid from extjs.  "Yay!!  It > works" > > Then I wanted to re

Re: Where is everything on ubuntu 10.10

2010-11-19 Thread Sam Walters
Read up on how linux programs work the file system becomes intuitive. Also try this: python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" cheers sam_w On Fri, Nov 19, 2010 at 3:08 AM, Kenneth Gonsalves wrote: > On Thu, 2010-11-18 at 06:10 -0800, sheeptick wrote:

forloop.last FAIL in template.

2010-11-19 Thread Sithembewena Lloyd Dube
Hi everyone, I have a template where Django is spitting out blog tags followed by a ',' when the tag is not the final one in the loop. {% if not forloop.last %}, {% endif %} Strangely, I am still seeing tag1, tag2, tag3,. How can I suppress that last ','? -- Regards, Sithembewena Lloyd Dube ht

Uploads outside of a form

2010-11-19 Thread AK
I am trying to use Valum's Ajax Upload to do file uploads on a Django- based site I am making. Currently I am avoiding a form simply because AU sends the upload as the entirety of the POST data in an ajax request. Right now I have a very naive approach to doing this: upload = SimpleUploadedFile(

Re: django-admin.py not functional on 64 bit Vista

2010-11-19 Thread Robbington
Hi Micheal, Pretty sure it has nothing to do with your version of windows. appended MS-DOS PATH: with "C:\hp\bin\Python\Lib\site-packages \django \bin" which allows me to run django-admin.py If you have installed Python and django propely, there is no need to append anything. It should work st

Re: ReportLab and Django - templates? ; FK object has no attribute split

2010-11-19 Thread Carlos Daniel Ruvalcaba Valenzuela
There is also template2pdf which is basically and RML subset interpreter, you write your RML from a django template and pass it to a function from template2pdf which will generate a PDF from it. http://code.google.com/p/template2pdf/ That is what we are using, I have even contributed a few patche