Re: Unaccountable syntax error
Sorry guys, I just need a tip : where do you get your models.ColorField from ? I've upgraded to django 1.0, and don't have it ! Regards, Guillaume On 30 août, 16:03, Leaf <[EMAIL PROTECTED]> wrote: > Of course. I just look at the error actually occurs on, not the > context. I guess even Python's awesome debugging still has limits. > What happened was that I forgot a parenthesis at the end of the > previous line. Thanks for giving me the tip. > > On Aug 30, 9:57 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > > > On Sat, Aug 30, 2008 at 9:50 AM, Leaf <[EMAIL PROTECTED]> wrote: > > > > I'm having a problem when I try to validate my models. The interpreter > > > somehow takes offense at this line: > > > > box_text_color = models.ColorField("Box Text Color") > > > > I'm using a custom "ColorField" here. What I don't understand is that > > > it seems almost identical to this ColorField, which it did accept: > > > > bg_color = models.ColorField("Background Color") > > > > When it rejected it, the flow looked like this: > > > > File "/Users/leaf/Django/devsite/../devsite/djstyles/models.py", > > > line 47 > > > box_text_color = models.ColorField("Box Text Color") > > > ^ > > > SyntaxError: invalid syntax > > > > The caret was pointing at the r in "box_text_color". Does anyone know > > > how this could have happened? > > > What's on the line above that? That's probably where the trouble begins. > > > Karen --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
MediaTemple Django Containers
Are now available according to their homepage: http://mediatemple.net/webhosting/gs/django.html Was anyone in the beta? I've not used them, so I'm wondering what the experience was like. --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
View not passing MEDIA_URL to Template
I have two templates, one called via a Generic View and one via my own View. They both extend a base.html view that has {{MEDIA_URL}} in it. When the generic view is hit, the base.html template gets it's value, http://rtdev.apple.com/media/ , but when my own View hits MEDIA_URL blanks. I tried to get MEDIA_URL in my views.py to pass it in to my render_to_response but it seems from there that global isn't defined. views.py: > from django.shortcuts import render_to_response, get_object_or_404 > > from models import Event > > def results(request): > event = get_object_or_404(Event, pk=request.REQUEST['event']) > response = {} > response['correct_answers'] = 0 > response['total_questions'] = 0 > response['passed'] = 0 > response['name'] = request.REQUEST['name'] > > # ... > > return render_to_response('whatsnew/results.html', response) -- Cortland Klein <[EMAIL PROTECTED]> +1 408 506 9791 http://pixelcort.com/ 2260 California Street #13 Mountain View, CA, USA 94040 Alumni, Business Management <[EMAIL PROTECTED]> San José State University Alumni Technical Advisor, Entrepreneurial Society <[EMAIL PROTECTED] > http://e-society.org/ Q Techie, Silicon Valley Mac User Group http://svmug.org/ Member, Silicon Valley Google Technology User Group http://sv-gtug.org/ --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Discover tests in forms.py
>From http://www.djangoproject.com/documentation/testing/ "4. Looking for unit tests and doctests in the models.py and tests.py files in each installed application." Next to models.py I have forms.py which does exactly what the filename suggests: it defines forms. I've put some doctests in these classes. How do I get the testrunner to discover them? --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Need suggestions on subversion structure for project
Hi, First, let me start by explaining what my goals are: - Have a django project & its apps in version control - Have all of the templates the apps will use in the same version control - Have all static content (images, css, etc) in the same version control. So far, this is the directory structure I've come up with: django/ my_project/ app1/ app2/ templates/ static/ images/ styles/ Is this a good structure? Using this structure, I can work on everything involved in making my website through a single working copy in Subversion. Do you guys have any better suggestions? My main concern with the structure I presented above is how I will configure Apache2 to handle serving static content. Also, the fact that Django requires an absolute path for the templates directory makes this more of a management nightmare. --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ANN: Updated Django Cheat Sheet
Le 4 sept. 08 à 12:20, Fraser Nevett a écrit : > > http://www.mercurytide.co.uk/whitepapers/django-cheat-sheet/ > > We welcome any ideas for improvements, corrections, or any other > feedback. Any chance to get a printable copy without colors, just a white background? My printer will thank you ;-). Best, David --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
UploadedFile Content-Type
Hi. I'm using newforms to upload a file in my project. I want to check the mime type of the uploaded file. Let's say my field name is "file", and check_uploaded_file() is a function that takes the content type and checks it. file = request.FILES['file'] check_uploaded_file(file.content_type) So when I upload let's say a JPG file with firefox, print file.content_type outputs "image/jpeg" that's ok. If I try the exact same thing with Safari, print file.content_type outputs ""NOTHING NADA RIEN ! I don't get it.. I'm using svn release 8649 of django. Does anyone knows what's happening to me ? Thx for any help you could provide me. --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
modelform_sets
I am attempting to use modelform_sets and AFAIK I have implemented it correctly. The problem is that the first time the form is submitted without any data in the form fields, the is_valid() function validates these fields as being valid and then stores empty values in the database, even though my model states that these fields cannot be blank/null. Is this a django error or am I going wrong in my code somewhere perhaps? Once some data (even if it is blank) has been submitted the first time, the form then validates input correctly as normal. I would much appreciate it someone can shed some light on this issue. Regards --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Template Question
I am wanting to show all blog entries written by certain authors..how would I go about doing this in my templates. In my Blog model I have an author variable. --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: TemplateSyntaxError 'No module named admin_urls' in 1.0 stable
On Thu, Sep 4, 2008 at 10:00 AM, simong <[EMAIL PROTECTED]> wrote: > It might have been in part a caching problem in Firefox: to clarify, > I'm testing this on my laptop running Ubuntu 8.04 using apache2 with > local name resolution using names against localhost, which is fairly > non-standard but is the easiest way to do it on a machine that moves > around. I have since tested the project with django's built-in web > server and while I got the same problem at first, forcing a reload of > the page in Firefox has made it go away in the top levels of the admin > section. > > However, I have just experimented with adding a user, which worked, > and then granting admin rights, and the problem has returned. The > traceback is pasted here: http://dpaste.com/75889/ > > However, making other changes to user information doesn't raise the > error. > > I also have treemenus installed and that is getting an ImportError > with the same value, but that could be because I haven't updated > treemenus: the traceback is here: http://dpaste.com/75891/ > I'm not familiar with the url resolver code, but the traceback seems to indicate you've got a module somewhere in what is referenced from your root urls.py that references a module named 'admin_urls'. I'd grep for that string in the trees of all your installed apps to see where it is coming from. I don't believe it exists in Django itself. I don't know if it ever did, but if it did ensuring that you installed 1.0 cleanly (that is, removed any old version before installing 1.0...you didn't answer that part of my question?) would guarantee any old remnants of a previous Django are not causing the problem. If you do really have a clean 1.0 install than I think this has to be coming from one of your installed apps. Karen --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
type error in form after upgrade from beta to stable
Hello, After upgrading from Django version 1.0-beta_1-SVN-unknown to the Django 1.0 stable, I am getting this error: Exception Type: TypeError Exception Value: 'NoneType' object is not callable Exception Location: /usr/lib/python2.5/site-packages/django/forms/models.py in __init__, line 197 Python Executable: /usr/bin/python Python Version: 2.5.1 I don't understand why I'm getting this error now, the same model, view form etc. works fine in the beta version... Any ideas welcome :) thanks. greetings, -- Genís --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ModelForm, images and exclude
True but I wanted to organize my folder a bit because there's not just one photo per pet, there could be quite a lot more than one photo per pet. First, I'd rather not have a million _ at the end of a file because everyone named their file cute1.jpg. Anyway, I got it to work, code below. (It's not the greatest code I've ever written but it seems to work) class AddPhotoForm(forms.Form): # Categories is just a list of photo categories that a user can choose from. # I disable them by selecting show_in_sidebar=False, hence the filter categories = Category.objects.filter(show_in_sidebar=True).values_list('id','name') title = forms.CharField(max_length=100) category = forms.ChoiceField(choices=categories) image = forms.ImageField() def handle_uploaded_file(f, pet_id): filename = f.name while os.path.exists(os.path.join(settings.MEDIA_ROOT, 'pet_photos', pet_id, filename)): if filename[len(filename[:-4]):-3] == '.': # 3 char extension (ie. .jpg) filename = filename[:-4] + '_' + filename[len(filename[:-4]):] elif filename[len(filename[:-5]):-4] == '.': # 4 char extension (ie. .jpeg) filename = filename[:-5] + '_' + filename[len(filename[:-5]):] else: # who knows, append it to the beginning filename = '_' + filename destination = open(os.path.join(settings.MEDIA_ROOT, 'pet_photos', pet_id, filename), 'wb+') for chunk in f.chunks(): destination.write(chunk) return os.path.join('pet_photos', pet_id, filename) def add_pet_photo(request, pet_id): this_pet = get_object_or_404(Pet, id=pet_id) # using custom user model because I'm rewriting a web app user = User.objects.get(username__iexact=request.session['username']) if request.method == 'POST': if this_pet.owner == user: # Make sure pet belongs to this user form = AddPhotoForm(data=request.POST, files=request.FILES) if form.is_valid(): filename = handle_uploaded_file(request.FILES['image'], pet_id) c = Category.objects.get(id=form.cleaned_data['category']) m = Media(title=form.cleaned_data['title'], category=c, type='P', pet=this_pet, image=filename) m.save() return HttpResponseRedirect('/photos/' + pet_id) else: return HttpResponse("Not your pet") else: form = AddPhotoForm() return render_to_response('photos/add_photo.html', {'pet': this_pet, 'form': form }, context_instance=RequestContext(request)) So it seems to work, probably not the most pythonic way of doing it but it gets the job done. -Chris On Sep 3, 9:00 am, TiNo <[EMAIL PROTECTED]> wrote: > Question, why do you need to create a folder for every pet? Why not throw > all pet photos in one folder?That would solve your problem as well. > --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Accessing other attributes from Foreign-key
On Sep 4, 12:36 pm, [EMAIL PROTECTED] wrote: > Guys, > > I have the following model : > > from pypo.contracts.models import job_id > from pypo.suppliers.models import Company > > ##Create your models here > > class ponum(models.Model): > contract = models.ForeignKey(job_id) > supplier = models.ForeignKey(Company) > Description = models.XMLField(max_length=200) > price = models.DecimalField(decimal_places=2, max_digits=7) > pub_date = models.DateTimeField(auto_now_add=True, editable=False) > pid = models.CharField(max_length=25) > > It pulls the job_id from one app, and the Company from another. > > The job_id class contains the following: > > class job_id(models.Model): > contract = models.CharField(max_length=5) > customer = models.CharField(max_length=30) > pub_date = models.DateTimeField(auto_now_add=True, editable=False) > > It's nice and simple. However, for class ponum, I want the user to be > able to submit job_id.contract into the ponum.contract field (what I've > got now)... but for the selection box on ponum.contract to show a str of > job_id.contract + " : " + job_id.customer. > > Is this possible using the admin interface, or am I going to have to > write a custom form to do it? > > Regards, > > Andy If you define the __unicode__ method on job_id, Django will use that to populate the select box. class job_id(models.Model): def __unicode__(self): return u'%s: %s' % (self.contract, self.customer) --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: No module named adminapplist
On Thu, Sep 4, 2008 at 10:30 AM, KillaBee < [EMAIL PROTECTED]> wrote: > > Hello Django world, I am having a problem running the updated > adminapplist version. The error is 'adminapplist' is not a valid tag > library: Could not load template library from > django.templatetags.adminapplist, No module named adminapplist. There > is a adminapplist, but from a post here I need to replace it with a > old one. > > Where can I get the old adminapplist from and do I have to change the > admin index template? > > I am using svn and this applist > > http://code.djangoproject.com/browser/django/trunk/django/templatetags/adminapplist.py?rev=298 > > and this index > > http://code.djangoproject.com/browser/django/trunk/django/conf/admin_templates/index.html?rev=127 > > There's no need to post the same problem in two different threads. adminapplist no longer exists in the Django source code. So, any attempt to load it is coming from your own customized templates based on an old version of Djanog's templates. You need to update your customized templates and base them off of the current admin templates. Karen --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ANNOUNCE: Django 1.0 released
W00t! :) (i've been patiently waiting :)) --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
No module named adminapplist
Hello Django world, I am having a problem running the updated adminapplist version. The error is 'adminapplist' is not a valid tag library: Could not load template library from django.templatetags.adminapplist, No module named adminapplist. There is a adminapplist, but from a post here I need to replace it with a old one. Where can I get the old adminapplist from and do I have to change the admin index template? I am using svn and this applist http://code.djangoproject.com/browser/django/trunk/django/templatetags/adminapplist.py?rev=298 and this index http://code.djangoproject.com/browser/django/trunk/django/conf/admin_templates/index.html?rev=127 --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 'adminapplist' is not a valid tag library
Hey, I am having the same problem running the updated version. The error is 'adminapplist' is not a valid tag library: Could not load template library from django.templatetags.adminapplist, No module named adminapplist. There is a adminapplist, but from post I need to replace it with a old one. Where did you get the old adminapplist from and did you have to change the admin index template? I am useing svn and this applist http://code.djangoproject.com/browser/django/trunk/django/templatetags/adminapplist.py?rev=298 and this index http://code.djangoproject.com/browser/django/trunk/django/conf/admin_templates/index.html?rev=127 On Aug 28, 8:10 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Thu, Aug 28, 2008 at 8:56 PM, XtraGreen <[EMAIL PROTECTED]> wrote: > > > I'm upgrading a Django site from 0.96 to the 1.0 beta (django-trunk > > svn as of tonight) and it's mostly going smoothly except the built in > > Django admin is giving me issues. > > > I think I've got everything setup for the new admin code, but when I > > try to execute the main admin page I get the following error: > > > TemplateSyntaxError: 'adminapplist' is not a valid tag library: Could > > not load template library from django.templatetags.adminapplist, No > > module named adminapplist > > > Indeed, adminapplist.py doesn't exist in django/templatetags so what's > > the catch? Is this a bug in the distribution or am I doing something > > wrong? > > Do you have a customized index.html admin template based on the old admin > index.html? That's where adminapplist used to be loaded from. It is no > longer referenced by the current django/contrib/admin/templates/index.html > file. > > Karen --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: UnicodeDecodeError when using replace on model field
On Sep 4, 4:00 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > In the working case your initial string is a bytestring, in the non-working > case the initial string is unicode. The error comes from trying to replace > into a unicode string a bytestring containing non-ascii chars: > > >>> s = u'asd' > >>> s = s.replace("s", "š") > > Traceback (most recent call last): > File "", line 1, in > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 0: > ordinal not in range(128) > > One fix it to specify the replacement string as a unicode literal instead of > a bytestring: > > >>> s = s.replace("s", u"š") > >>> print s > > ašd thanks, now i feel like an idiot 8-) Aljosa --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ANN: Updated Django Cheat Sheet
> We welcome any ideas for improvements, corrections, or any other > feedback. Nice work, much appreciated. One thing did jump out at me though... In the Model fields section, USStateField and PhoneNumberField have been moved into localflavor: http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#MovedUSStateFieldandPhoneNumberFieldtolocalflavor --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: TemplateSyntaxError 'No module named admin_urls' in 1.0 stable
On Sep 4, 2:02 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Thu, Sep 4, 2008 at 7:04 AM, simong <[EMAIL PROTECTED]> wrote: > > > I am trying to migrate a project to 1.0 and I'm currently updating the > > admin system. When I try to load the /admin/ URL I get this error: > > > Exception Type: TemplateSyntaxError > > Exception Value: Caught an exception while rendering: No module > > named > > admin_urls > > > The error is coming from line 25 in /usr/lib/python2.5/site-packages/ > > django/contrib/admin/templates/admin/base.html > > > which is shown here:http://dpaste.com/75851/ > > > The problem is with the tag {% url django-admindocs-docroot as > > docsroot %}, which as far as I can see, doesn't exist in 1.0. I have > > installed Django 1.0 from scratch, and the only other possible > > weirdness is that I have the admin directory configured as admin_media > > in settings.py, which is a symlink to /usr/lib/python2.5/site-package/ > > django/contrib/admin > > > Next step would appear to be to try and move my code to a 1.0 project, > > but this would appear to be a bug in the admin templates. > > That named url does exist: > > http://code.djangoproject.com/browser/django/tags/releases/1.0/django... > > This is more likely a migration problem than a bug in 1.0. I have tested > admin in configurations both with and without the django.contrib.admindocs > application listed in INSTALLED_APPS and have not run into this. > > When you installed 1.0 did you first remove any old installed django? > > Is there a more complete traceback that might give a clue where this > admin_urls reference is coming from? I can't find that string anywhere in > the 1.0 tree nor 0.96. > It might have been in part a caching problem in Firefox: to clarify, I'm testing this on my laptop running Ubuntu 8.04 using apache2 with local name resolution using names against localhost, which is fairly non-standard but is the easiest way to do it on a machine that moves around. I have since tested the project with django's built-in web server and while I got the same problem at first, forcing a reload of the page in Firefox has made it go away in the top levels of the admin section. However, I have just experimented with adding a user, which worked, and then granting admin rights, and the problem has returned. The traceback is pasted here: http://dpaste.com/75889/ However, making other changes to user information doesn't raise the error. I also have treemenus installed and that is getting an ImportError with the same value, but that could be because I haven't updated treemenus: the traceback is here: http://dpaste.com/75891/ --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: UnicodeDecodeError when using replace on model field
2008/9/4 Aljosa Mohorovic <[EMAIL PROTECTED]> > > i can't figure out what's the problem (i also used re with same > results). how should i replace a pattern with non-ascii char? > > working as expected: > In [27]: s > Out[27]: 'asd' > In [28]: s = s.replace("s", "š") > In [29]: s > Out[29]: 'a\xc5\xa1d' > > not working on model fields: > In [30]: p = Page.objects.all()[0] > In [31]: p > Out[31]: > In [32]: p.name.replace("sto", "š") > --- > Traceback (most recent call > last) > > /home/aljosa/Projects/nn/ in () > > : 'ascii' codec can't decode > byte 0xc5 in position 0: ordinal not in range(128) > > In the working case your initial string is a bytestring, in the non-working case the initial string is unicode. The error comes from trying to replace into a unicode string a bytestring containing non-ascii chars: >>> s = u'asd' >>> s = s.replace("s", "š") Traceback (most recent call last): File "", line 1, in UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 0: ordinal not in range(128) One fix it to specify the replacement string as a unicode literal instead of a bytestring: >>> s = s.replace("s", u"š") >>> print s ašd Karen --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Strange AttributError when saving sessions in 1.0
> I just moved to Django 1.0 and I am facing a weird error when Django > sessions tries to save the session into the PostgreSQL DB. Problem solved guys :) It was an old Django process which was still running and throwing the error. Congratulations on 1.0 and keep up the great work. Regards, BG --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
InlineModelAdmin dynamic extra option
Hi, I'ld like to put an "add another" kind of button at the admin inline form, but with InlineModelAdmin classes I can only put extra, min_num and max_nun. How could I do to add another instance dynamically without saving? Thanks in advance. --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
UnicodeDecodeError when using replace on model field
i can't figure out what's the problem (i also used re with same results). how should i replace a pattern with non-ascii char? working as expected: In [27]: s Out[27]: 'asd' In [28]: s = s.replace("s", "š") In [29]: s Out[29]: 'a\xc5\xa1d' not working on model fields: In [30]: p = Page.objects.all()[0] In [31]: p Out[31]: In [32]: p.name.replace("sto", "š") --- Traceback (most recent call last) /home/aljosa/Projects/nn/ in () : 'ascii' codec can't decode byte 0xc5 in position 0: ordinal not in range(128) --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django 1.0 post_save signal has no attribute 'connect'?
Hi all! Trying the fallowing: from django.db.models import signals print dir(signals.post_save) gives: ['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] and print signals.post_save.connect gives: AttributeError: 'object' object has no attribute 'connect' How can I use signals now? --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: S3 tutorial for File Storage Refactor?
Hi Jay, Thanks for the patch, I need to spend more time on this but I had pushed your correction. Any feedback is really appreciated. Best, David Le 2 sept. 08 à 18:22, shadfc a écrit : > To fix the corrupt images error, add > content.open() > to the top of _save() on the S3Storage class (or at least before the > chunks() or read() calls). This basically causes a seek(0) on > content. I think perhaps some of the image validation reads part of > the file and doesn't reset the pointer back to the beginning. > > Jay > > On Sep 1, 10:40 am, Ramdas S <[EMAIL PROTECTED]> wrote: >> David, >> >> I think this is still not fixed. I am getting the same errors >> >> R >> >> On Aug 25, 2:02 pm, David Larlet <[EMAIL PROTECTED]> wrote: >> >>> Le 20 août 08 à 17:56, shadfc a écrit : >> With the code from the django-storages you referenced installed somewhere on PYTHONPATH, its as easy as setting a few things in your settings.py. You can see the docs for the code at http://code.larlet.fr/doc/django-s3-storage.html. Put the Required and Optional (if you want it, obviously) stuff in your settings.py and fill in the appropriate values for yourS3account. >> Now, assuming those settings are all correct, all of your FileFields (and thus, ImageFields) should store toS3into the bucket you set. You can continue to use upload_to to prefix the filename within the bucket. >> Now, I've noticed a few bugs, both of which I've notified David (the author) of: 1) if you call object.filefield.size, this code will download the entire file fromS3just to calculate the size. This happens because of the construction of the _open() method on the S3Storage class. It should not make theS3get call (which downloads the file). The workaround for now is not to use the size property with this code, but the more permanent fix is to delay reading of the file fromS3until read() is called on a S3StorageFile object. 2) I cannot get images to store correctly toS3when using an ImageField. They appear in the bucket with a small filesize change, but no software I have will recognize them as valid images. Storing images (and any other file) via a FileField works just fine and the files are not corrupted. Strangely, storing images via ImageField on the FileSystemStorage backend works just fine, so it only seems to be the combination of an ImageField while using thisS3backend that is the problem. I am not sure where the bug in this is. If you give it a try, see if you can verify this bug for me. >> Jay >> >>> Hi Jay, >> >>> I plan to work on this tonight because that's clearly a blocking >>> point. Thanks for reporting those bugs. >> >>> Best, >>> David --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
ANN: 'Django in Under a Minute' screencast
I've amended yesterday's preview release to reflect the new v1 Django site, the finished 'Django in Under a Minute' screencast is available, I trust it'll help spread the word to potential new Django users, feel free to embed in blog posts: http://www.vimeo.com/1665004 http://showmedo.com/videos/video?name=324=324 http://www.youtube.com/watch?v=72qt-r_W-g4 Andy & Rodolfo - thanks for the feedback. The screencast is licensed as Creative Commons By Attribution 2.0 (commercial use+derivatives allowed). The screencast is aimed at users who haven't used Django but have probably heard of it. It shows all they need to know to get up and running within 2 hours including a demo of the tutorial, the Django book, mailing lists and 'how to get it'. Music by Mr. Django Reinhardt. More background here: http://ianozsvald.com/2008/09/04/django-in-under-a-minute-screencast/ If this screencast is well-received then I'll look into making a longer screencast accompaniment to the 4-part Django Tutorial series. I'm the co-founder of ShowMeDo, we'd love to get more involved with Django. Cheers, Ian. -- Ian Ozsvald (Professional Screencaster) [EMAIL PROTECTED] http://ProCasts.co.uk http://IanOzsvald.com + http://ShowMeDo.com --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ManyToMany performance..
sorry, you need story = Story.objects.filter(pk=1).extra(select={'main_section': sub_select }).values('main_section', 'other_field1', 'other_field2' ) [0] because we get here list of dictionaries Good luck! --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: TemplateSyntaxError 'No module named admin_urls' in 1.0 stable
On Thu, Sep 4, 2008 at 7:04 AM, simong <[EMAIL PROTECTED]> wrote: > > I am trying to migrate a project to 1.0 and I'm currently updating the > admin system. When I try to load the /admin/ URL I get this error: > > Exception Type: TemplateSyntaxError > Exception Value:Caught an exception while rendering: No module > named > admin_urls > > The error is coming from line 25 in /usr/lib/python2.5/site-packages/ > django/contrib/admin/templates/admin/base.html > > which is shown here: http://dpaste.com/75851/ > > The problem is with the tag {% url django-admindocs-docroot as > docsroot %}, which as far as I can see, doesn't exist in 1.0. I have > installed Django 1.0 from scratch, and the only other possible > weirdness is that I have the admin directory configured as admin_media > in settings.py, which is a symlink to /usr/lib/python2.5/site-package/ > django/contrib/admin > > Next step would appear to be to try and move my code to a 1.0 project, > but this would appear to be a bug in the admin templates. > > That named url does exist: http://code.djangoproject.com/browser/django/tags/releases/1.0/django/contrib/admindocs/urls.py This is more likely a migration problem than a bug in 1.0. I have tested admin in configurations both with and without the django.contrib.admindocs application listed in INSTALLED_APPS and have not run into this. When you installed 1.0 did you first remove any old installed django? Is there a more complete traceback that might give a clue where this admin_urls reference is coming from? I can't find that string anywhere in the 1.0 tree nor 0.96. Karen --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ManyToMany performance..
You can use an extra select to get additional parameter 'main_section' This is for MySQL and it's only sample you need to test it in your DB to make sure, that it works sub_select = """SELECT section_name FROM %(table_section)s as sc, % (table_section_story)s as st WHERE st.story_id = %(table_story)s.id AND sc.id = st.section_id ORDER BY order LIMIT 1""" % { 'table_section': Section._meta.db_table, 'table_section_story': 'myapp_section_story' # Not sure!!! see your DB actual table name 'table_story': Story._meta.db_table } We don't create Story object here, we just get a dictionary with all values we need in template story = Story.objects.filter(pk=1).extra(select={'main_section': sub_select }).values('main_section', 'other_field1', 'other_field2' ) In template: {{ story.main_section }} --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ANNOUNCE: Django 1.0 released
Thank you all, yet again, for making it feel like the past decade or so that I've been using other languages/frameworks was completely wasted :-) Keep it up, please. -Jeff --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Strange AttributError when saving sessions in 1.0
Hello, I just moved to Django 1.0 and I am facing a weird error when Django sessions tries to save the session into the PostgreSQL DB. A traceback is given below: 2008-09-04 17:30:55: (mod_fastcgi.c.2534) FastCGI-stderr: Traceback (most recent call last): File "/var/lib/python-support/python2.4/flup/server/fcgi_base.py", line 558, in run protocolStatus, appStatus = self.server.handler(self) File "/var/lib/python-support/python2.4/flup/server/fcgi_base.py", line 1112, in handler result = self.application(environ, start_response) File "/usr/lib/python2.4/site-packages/django/core/handlers/ wsgi.py", line 221, in __call__ File "/usr/lib/python2.4/site-packages/django/contrib/sessions/ middleware.py", line 33, in process_response request.session.save() File "/usr/lib/python2.4/site-packages/django/contrib/sessions/ backends/db.py", line 56, in save sid = transaction.savepoint() AttributeError: 'module' object has no attribute 'savepoint' I am not sure why this is happening since I can see that savepoint method is present in the transaction class. This only happens when Django tries to do any kind of session handling. Any help will be appreciated. Regards, BG --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to filter objects by return value of Model's or AdminModel's method by list_filter?
On Thu, Sep 4, 2008 at 4:55 AM, MakotoSatoh <[EMAIL PROTECTED]> wrote: > > Hi, > > Can I include my Model's or AdminModel's method into AdminModels > list_filter? > > I don't want to store the value in database, since that value is > calculatable on the fly. > > Thanks in advance and congratuation on 1.0 release. > No, the filtering is done at the database level. Karen --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 'Django in Under a Minute' screencast, requesting feedback before v1-final is ready
Love it :) --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 'Django in Under a Minute' screencast, requesting feedback before v1-final is ready
Hi Rodolfo, thanks for the feedback. I've just finished the v1 version, once it is uploaded to Vimeo etc I'll announce it here. I'm glad you liked Chrome, I figured it'd make for a change from Firefox or Safari :-) Cheers! Ian. 2008/9/4 Rodolfo <[EMAIL PROTECTED]> > > Man, nice video! > Go for it with 1.0 final! > > And, btw, never thought I'd see Google Chrome in a video not related > to it :P > > []'s > > Rodolfo > > > > On Sep 3, 6:07 pm, "Ian Ozsvald" <[EMAIL PROTECTED]> wrote: > > I've created a 57 second screencast showing 'Django in Under a Minute'. > I > > recorded it over the last two days using the current Django release > > candidate, I'll update the visuals once v1-final is ready and then > release a > > final copy: > http://procasts.co.uk/examples/DjangoIn1Min_early_cut_for_ReleaseCand... > > > > I'd like to ask for feedback, there's still time to make minor tweaks if > > need be. I've aimed the screencast at users who have heard of Django and > > know about web-app frameworks but who haven't yet tried Django. I'm > aiming > > to show them how easy it is to get on board and start building neat > stuff. > > > > Does the message come through clearly? Do I cover too much/too little? > > > > Once Django v1 is out I'll update the video element (to show the v1 > django > > site, not the current release-candidate site) and release the result to > > ShowMeDo, Vimeo etc under a CC license. I hope it'll be useful for > bloggers > > to help spread the word. > > > > Assuming this video gets a good reception, I'll think about making a > 4-part > > video accompaniment to the 4-part Django tutorial. This is exactly the > sort > > of stuff we want to see in ShowMeDo (I'm ShowMeDo's co-founder), assuming > > this longer series is well-received then we'd look to do more Django > > material. > > > > Cheers, > > Ian (ShowMeDo/ProCasts) > > > > -- > > Ian Ozsvald (Professional Screencaster) > > [EMAIL PROTECTED] > > > > http://ProCasts.co.ukhttp://IanOzsvald.com+http://ShowMeDo.com > > > -- Ian Ozsvald (Professional Screencaster) [EMAIL PROTECTED] http://ProCasts.co.uk http://IanOzsvald.com + http://ShowMeDo.com --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ANNOUNCE: Django 1.0 released
Thanks for the great work! James Bennett wrote: > The Django team is pleased to announce the release of Django 1.0 this evening: > > Download: http://www.djangoproject.com/download/ > Release notes: http://docs.djangoproject.com/en/dev/releases/1.0/ > > Have fun with it, and we'll see you in a few days for DjangoCon. > > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ANNOUNCE: Django 1.0 released
Great achievement, congratulations from Belgium! We already celebrated on our own release trip. Check out the original Django museum and his place of birth: http://www.think-wize.com/nl/django-10-celebration On Sep 4, 2:07 am, "James Bennett" <[EMAIL PROTECTED]> wrote: > The Django team is pleased to announce the release of Django 1.0 this evening: > > Download:http://www.djangoproject.com/download/ > Release notes:http://docs.djangoproject.com/en/dev/releases/1.0/ > > Have fun with it, and we'll see you in a few days for DjangoCon. > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ANNOUNCE: Django 1.0 released
dankelley wrote: > In other words, should I (or typical users) download the official 1.0 > version, or will it still be advised to track the development version? Nothing can stop you from using trunk :-) I'm not a core developer so don't take it as an official advice. But I do think that living on the edge in the case of Django is most rewarding. --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Accessing other attributes from Foreign-key
Guys, I have the following model : from pypo.contracts.models import job_id from pypo.suppliers.models import Company ##Create your models here class ponum(models.Model): contract = models.ForeignKey(job_id) supplier = models.ForeignKey(Company) Description = models.XMLField(max_length=200) price = models.DecimalField(decimal_places=2, max_digits=7) pub_date = models.DateTimeField(auto_now_add=True, editable=False) pid = models.CharField(max_length=25) It pulls the job_id from one app, and the Company from another. The job_id class contains the following: class job_id(models.Model): contract = models.CharField(max_length=5) customer = models.CharField(max_length=30) pub_date = models.DateTimeField(auto_now_add=True, editable=False) It's nice and simple. However, for class ponum, I want the user to be able to submit job_id.contract into the ponum.contract field (what I've got now)... but for the selection box on ponum.contract to show a str of job_id.contract + " : " + job_id.customer. Is this possible using the admin interface, or am I going to have to write a custom form to do it? Regards, Andy --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
django-mptt
Hi! Playing with the wonderful mptt code: http://code.google.com/p/django-mptt/ I would like to ask if someone knows how to do this: (I play with some kind of navigation for websites) I have a tree where some nodes are marked "inactive" or "deleted". Furthermore, some nodes are to be displayed in different "places", to render many navigations at once, e.g. a horizontal, a vertical, a top, bottom etc. navigation. One node could be placed in the top "place", wheras it's children are placed in the vertical place. Would it be sufficient to work over the "full_tree_for_model" tag to allow arguments resulting actually in WHERE-clauses that exclude certain nodes when building the tree? Thanks! Peter. --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: GeoDjango question
I am using MySQL at the moment, so I cannot really help you with the distance calculations, but the documentation at http://code.djangoproject.com/wiki/GeoDjangoDatabaseAPI#DistanceLookupssuggests that your distance calculations should work at least if your SRS is in meters/km etc. I you mean default SRID as -1, I tend to think of it as a "don't know/don't" care in the DB, making it store the data but without ability to interpret it in any geographic way. I always store my geodata with a known SRS, be it 4326 (WGS84) or whatever the data came in. If you have a look at your data source with any kind of GIS software, it should tell you what SRS it is in. If you set it to -1, the DB will have no idea how to do the distance calculations. Ludwig --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ANNOUNCE: Django 1.0 released
On Sep 4, 2:07 am, "James Bennett" <[EMAIL PROTECTED]> wrote: > The Django team is pleased to announce the release of Django 1.0 this evening: > > Download:http://www.djangoproject.com/download/ > Release notes:http://docs.djangoproject.com/en/dev/releases/1.0/ > > Have fun with it, and we'll see you in a few days for DjangoCon. > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." Thank you to all the Django developers and to all "perfectionists with deadlines" ;-) --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
TemplateSyntaxError 'No module named admin_urls' in 1.0 stable
I am trying to migrate a project to 1.0 and I'm currently updating the admin system. When I try to load the /admin/ URL I get this error: Exception Type: TemplateSyntaxError Exception Value:Caught an exception while rendering: No module named admin_urls The error is coming from line 25 in /usr/lib/python2.5/site-packages/ django/contrib/admin/templates/admin/base.html which is shown here: http://dpaste.com/75851/ The problem is with the tag {% url django-admindocs-docroot as docsroot %}, which as far as I can see, doesn't exist in 1.0. I have installed Django 1.0 from scratch, and the only other possible weirdness is that I have the admin directory configured as admin_media in settings.py, which is a symlink to /usr/lib/python2.5/site-package/ django/contrib/admin Next step would appear to be to try and move my code to a 1.0 project, but this would appear to be a bug in the admin templates. Simon --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: forms and dynamic # of form fields
Mike Hansen wrote: > I apologize if this already showed up on the list. I originally posted this > from google groups, and I think it ate it. > > I'm new to Django. As a small Django project, I'm making a internal purchase > request form. One section has user information and another section has a > selection of items to request to be purchased(computer hardware and > software). The items in the second section are dynamic. I read them from a > database, and the list of items can fluctuate depending on what is being > offered. Is it possible to use newforms to do this? I'm not sure how to > create the form object. BTW, I'm using 0.96. > > > class RequestForm(forms.Form): > name = forms.CharField(max_length=100) > department= forms.CharField() > email= forms.EmailField() > # here's where I get lost. I'd like some sort of dictionary/class/list > that > # has items, and quantities requested. > > Does anyone have any ideas on this? > > Thanks. Mike, Have a look at using the ForeignKey attribute to pull in information from another database. I've just started using Django myself. For how I've done this, check-out http://www.launcpad.net/posys/pypo - look at http://bazaar.launchpad.net/~andylockran/posys/pypo/annotate/6?file_id=models.py-20080902200058-47p99xmqjp3zourq-3 for the model. Regards, Andy --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
ANN: Updated Django Cheat Sheet
With the release of Django 1.0, we're pleased to announce the release of a completely updated version of our highly popular Django Cheat Sheet which is crammed with a whole host of useful Django information: http://www.mercurytide.co.uk/whitepapers/django-cheat-sheet/ We welcome any ideas for improvements, corrections, or any other feedback. On behalf of everyone here at Mercurytide, I'd like to offer our sincere thanks to all those who have contributed to Django, and especially to the core devs for all their effort. It's been a long time coming, but everyone's hard work has made Django a truly awesome framework. Fraser P.S. Apologies if this appears twice -- my first message didn't seem to get posted. --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
ANN: Updated Django Cheat Sheet
With the release of Django 1.0, we're pleased to announce the release of a completely updated version of our highly popular Django Cheat Sheet which is crammed with a whole host of useful Django information: http://www.mercurytide.co.uk/whitepapers/django-cheat-sheet/ We welcome any ideas for improvements, corrections, or any other feedback. On behalf of everyone here at Mercurytide, I'd like to offer our sincere thanks to all those who have contributed to Django, and especially to the core devs for all their effort. It's been a long time coming, but everyone's hard work has made Django a truly awesome framework. Fraser --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ProgrammingError at /admin/, date/time field value out of range
> > > When i use wrong dates in a query and execute that directly on the > database, > then i get the same error message. > Judging from the error message, it seems as if the date is in a different > format than expected by the database. > The expected date format is a per-connection level setting. (Called "DATESTYLE" in postgresql). There is also a default format if the connection doesn't specify. I strongly suspect that this mismatch between formats is actually happening between the database and the python postgresql driver, and does not involve django. You should be able to test this my executing a "SHOW DATESTYLE" using django's db connection, and also in the working client, and comparing. Another third thing is to open a python shell, create a connection, and execute the sql there and see if that works. I don't have a postgres database currently so I can't be certain about this, but that's where I would start investigating. --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: using 1.0 instead trunk
On Thu, Sep 4, 2008 at 4:28 AM, Aljosa Mohorovic <[EMAIL PROTECTED]> wrote: > since i'm using subversion for my sites in svn:externals i have django > trunk and now i'm switching to 1.0 tag. > so what i'm actually asking is if i'm using 1.0 tag in svn:externals > does it mean that i'm guaranteed that only security fixes will be > updated in 1.0 tag or should i expect some other changes? The 1.0 tag is frozen for all time; no changes will ever be made to it, and it serves as a historical reference point. In the past we've branched off from the release tags to create support trees (e.g., "0.96-bugfixes", "0.95-bugfixes", etc.) for security issues. Since there are some quirks to be ironed out with post-1.0 development, we haven't yet done that for 1.0, but there will be a solution in place soon. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
using 1.0 instead trunk
trunk - http://code.djangoproject.com/svn/django/trunk/django/ 1.0 tag - http://code.djangoproject.com/svn/django/tags/releases/1.0/ since i'm using subversion for my sites in svn:externals i have django trunk and now i'm switching to 1.0 tag. so what i'm actually asking is if i'm using 1.0 tag in svn:externals does it mean that i'm guaranteed that only security fixes will be updated in 1.0 tag or should i expect some other changes? Aljosa --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: GeoDjango question
Thank you Ludwig! > Regarding your SRS questions you need to be aware that if you use different > SRS for different tables that unless you reproject to a common one distance > computations make no sense. So I guess I have to use the default srid in both models. Right? If I set the default srid, is the following code correct? qs = Places.objects.filter(location__distance_lte=(pnt, D(km=500))) or qs = Places.objects.filter(location__distance_lte=(pnt, 50) > There are routines in Postgis add-ons that will compute a great-circle > distance, > which I guess you are after. Do you know where can I find an example? I suppose you mean distance_sphere, but as I'm new to all this geographic stuff I have no idea how to use it. --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ANNOUNCE: Django 1.0 released
Thank you all for the great work done! Django is the best web framework ever written, it's really time to spread the word and use it everywhere! --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
How to filter objects by return value of Model's or AdminModel's method by list_filter?
Hi, Can I include my Model's or AdminModel's method into AdminModels list_filter? I don't want to store the value in database, since that value is calculatable on the fly. Thanks in advance and congratuation on 1.0 release. --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ManyToMany performance..
I modified the 'get_main_section' method in this way.. def get_main_section(self): try: sections = list(self.id_section.all().order_by('order')) if (len(sections) > 1): section_name = sections[1] else: section_name = sections[0] return section_name But my question is: is possibile to populate the id_section field in my Story object just one time? if in the same template i write: {{ story.get_main_section }} {{ story.get_main_section }} {{ story.get_main_section }} django make 3 query to mysql... I tried with select_related, but without success. Thanks --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: GeoDjango question
Hi Adrián, Regarding your SRS questions you need to be aware that if you use different SRS for different tables that unless you reproject to a common one distance computations make no sense. Likewise if you are computing the distance in an e.g. lat/long projection your distance will be not be in kilometres. There are routines in Postgis add-ons that will compute a great-circle distance, which I guess you are after. > 5-) Is available any widget to insert the points using GoogleMaps? As > far as I know I have to implement it all by myself. > Have a look in django/contrib/gis/maps/google and read through the embedded documentation, which shows you how to create views and templates that will put your geodata onto a Google map inside your page. A sample template is given in the __init.__py script, while maybe the examples given in overlays.py are best for view creation. It might take a moment to understand the mechanism and I suggest starting out with a view with some dummy data to make sure your template is correct, then to add the geo-database interaction to it. It can all be achieved with a minimum of code lines. Feel free to come back with more specific questions and I will try to give you a hand. HTH Ludwig --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ANNOUNCE: Django 1.0 released
James Bennett escribió: > The Django team is pleased to announce the release of Django 1.0 this evening: > > Download: http://www.djangoproject.com/download/ > Release notes: http://docs.djangoproject.com/en/dev/releases/1.0/ > > Have fun with it, and we'll see you in a few days for DjangoCon. > > Many thanks you all for this excellent framework!. Cogratulations! --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ANNOUNCE: Django 1.0 released
On 4 sep, 02:07, "James Bennett" <[EMAIL PROTECTED]> wrote: > The Django team is pleased to announce the release of Django 1.0 this evening: Champagne !-) --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ANNOUNCE: Django 1.0 released
Djangonauts - to boldly go where no man has gone before! --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
GeoDjango question
Hi, I've been checking geodjango and it looks very well, but I have some questions about it. If I have two models like: class UserProfile(models.Model): location = models.PointField(srid=2062) objects = models.GeoManager() class Places(models.Model): location = models.PointField() objects = models.GeoManager() I have the location of the user and I'd like to operate with the Places model. 1-) Can be the SRID of the location in places be different? SRID are places around the world so I think the best is use the default SRID 2-) Is the next code working as expected: qs = Places.objects.filter(location__distance_lte=(pnt, D(km=500))) or qs = Places.objects.filter(location__distance_lte=(pnt, 50) I need a queryset that contains all the places available in less than 500Km. 3-) I need to calculate some distances. I have a queryset with several places and I need to know the distance to the user, we are talking about distances in the earth. Do I have to use geopy or exists something implemented in geodjango? 4-) userprofile.location.distance(place.location) is returning a very small value, probably because the result is expressed in degrees. Is there any way to return the value in Km or m? This question is related to 3. It would be perfect if the value returned was the distance in Km or m. 5-) Is available any widget to insert the points using GoogleMaps? As far as I know I have to implement it all by myself. We'd appreciate if someone could write a short tutorial using this capabilities as this is the most common use of geodjango. I'm using a Debian lenny machine, latest django SVN (today is 1.0!), and PostgreSQL. Thank you very much. --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ANNOUNCE: Django 1.0 released
Excelent work! Well done! --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ANNOUNCE: Django 1.0 released
Awesome :D Congratulations and big kudos to everyone involved with getting there. -- Horst On Thu, Sep 4, 2008 at 8:28 AM, Ben Lyall <[EMAIL PROTECTED]> wrote: > Awesome news. This comes at a great time for an internal project I'm > working on. > > Congratulations and thank you to everyone involved. > > Ben. > > > > --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
XS XML to Django model
Hi, I was wondering whether there's an easy way to convert XS XML model definitions to Django models. Congrats on the new release! --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ANNOUNCE: Django 1.0 released
Awesome news. This comes at a great time for an internal project I'm working on. Congratulations and thank you to everyone involved. Ben. --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to access underscore starting attributes in templates
Dear Bruno, thank you very much for your help!! bruno desthuilliers wrote: [...] > Yeps : you're calling an instancemethod on a class. For what you're > trying to do, you need classmethods, ie: > >@classmethod > def verbosename(cls): > return unicode(cls._meta.verbose_name) It did the trick! Now everything's fine. And I advanced a small step into the Python world. See ya, -- Fabio Natali --~--~-~--~~~---~--~~ 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.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---