Re: Cache witin a single transaction / session ?
Hi try johnny-cache http://pythonhosted.org/johnny-cache/ Thx Frank Am 24.05.2013 08:50, schrieb brycenesbitt: |Does there exist a lightweight cache option for django which persists data in a single session. For example: {{gallery.tiles.count}} item{% if gallery.tiles.count != 1 %}s{% endif %} Produces two count() operations on the underlying database. Is there a way to make that one operation? | -- -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Django's cascade delete is executing the DELETE SQL twice
On 22 touko, 18:57, Michael wrote: > I've got an odd situation here, any idea why the delete SQL for the > `myapp_entry_tag` table is being performed twice? > > >>> from myapp.models import Tag > >>> from django.db import connection > >>> from pprint import pprint > >>> Tag.objects.only('pk').get(pk=1).delete() > >>> pprint(connection.queries) > > [{u'sql': u'SELECT `myapp_tag`.`id` FROM `myapp_tag` ''WHERE > `myapp_tag`.`id` = 1 ', > u'time': u'0.000'}, > {u'sql': u'DELETE FROM `myapp_entry_tag` WHERE `myapp_entry_tag`.`tag_id` > IN (1)', > u'time': u'0.000'}, > {u'sql': u'DELETE FROM `myapp_entry_tag` WHERE `myapp_entry_tag`.`tag_id` > IN (1)', > u'time': u'0.000'}, > {u'sql': u'DELETE FROM `myapp_tag` WHERE `id` IN (1)', u'time': u'0.000'}] > > models.py: > > class Tag(models.Model): > ... > > class EntryTag(models.Model): > ... > tag = models.ForeignKey(Tag) The answer is: this should not happen, and I wasn't able to reproduce this using Django master. What version of Django is this? Could it be that you have some custom code running (signal handlers for example)? Can you produce a small self-contained Django project where this happens? - Anssi -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Testing with complex database setups
On 23 touko, 15:09, Jani Tiainen wrote: > Hi, > > I've product that uses complex setup scripts - tens of SQL scripts that > creates tables, views, complex triggers, grants permissions and such and > finally populates database with some pre-data. > > So how I should proceed with unit testing with database like that, since some > operations rely heavily that there really exists all that trigger-function > mess in the database? So that I don't need everytime to start from the > scratch but from some known state of the db? I have some code I run my tests by the doing the following: 1. dump schema + some data from production 2. create test database by loading the dump. 3. Apply any migrations I have (these are plain SQL scripts, no South involved here) 4. run tests using SimpleTestCase or plain unittest TestCases. So, I am not using Django's testing framework at all. There are two reasons: 1. I haven't found a nice way to create the database with custom scripts etc. loaded. 2. Django's test framework likes to flush all data from the database. This doesn't fit my needs. So, I suggest that you either hack a custom test runner for Django, or just run tests without Django's testing framework. There might exists something reusable in the ecosystem for this use case. It would be nice to have something that allows easy testing this way in Django. The problem is that once you enter complex database setups domain it is hard to find a minimal useful feature set. Unfortunately I don't have anything reusable for running tests this way, my scripts for managing the above steps are too hacky to reuse. - Anssi -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Django - Tastypie and mongoengine
Hi! Has anyone used Tastypie and mongoengine for an application in django and mongodb? It's just that I have a problem and needed help. I'm having trouble doing the many to many relationships. If someone has already done something with tastypie mongoengine and tell me to put my doubts. thank you -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
current transaction is aborted, commands ignored until end of transaction block
Hi all, I am working on upgrading our system from django 1.3.1 to django 1.5.1, and have run into a huge problem. The site we are running has multilingual support and the platform has multiple top level domain sites connected to it. Running locally on my machine I get an error when I try to switch languages. The error is : "current transaction is aborted, commands ignored until end of transaction block", so I guess that something is not being commited correctly to the database. If i change the database setttings to "autocommit = True" then the site works perfectly. It doesn't matter which page I go to, when there is a database lookup it will not work. It does work in english (default language) and oddly enough swedish (can be because that is "our" language, which I test first). I was wondering if there is anyone out there that has any ideas why a change from 1.3.1 to 1.5.1 would result in these errors or if anyone has any suggestions on what this could be? Regards, Andréas -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
upload image with Django
Hi guy, I've created a form in a page html that upload a image. After capturing the image and edit it, I need to have it appear in a window j How can i do? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Help with robots.txt
Hello, Can someone give me an example of configuring robots.txt? I want to block the admin site. and anything else? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Cache witin a single transaction / session ?
Use the 'with' template tag. That's what it is for. https://docs.djangoproject.com/en/dev/ref/templates/builtins/#with Also you should probably use |pluralize filter to add pluralization. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Django tutorial - change history 24h time format?
Hi, I changed my settings.py file like so but nothing happened after I restarted the server "$ python manage.py runserver". USE_L10N = False FORMAT_MODULE_PATH = 'config.locale' So I then followed this tutorial by creating some extra folders and files. http://www.epicserve.com/blog/2011/jul/15/change-datefield-format-django-admin/ And copying his formats.py file to * "~/Django/mysite/mysite/config/locale/en/formats.py"*. But I still don't see any difference in my admin history page, what else can I try? Because when I add a new Poll then the date and time information is how I want it which looked like that by default when following the official Django tutorial. Date: 2013-05-24 Time 14:18:46 But when I click on the History button then Date/time looks american using a.m/p.m time format. I want my history page to use the same Date/Time format like on the previous page. May 24, 2013, 2:18 p.m. Also all the multiple Time format options in the formats.py file confuses me, file was taken from the tutorial from Epicserve.com blogger. https://github.com/epicserve/django-base-site/blob/master/config/formats/en/formats.py On Thursday, May 23, 2013 4:14:22 PM UTC+2, vicherot wrote: > > https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-USE_L10N > > > > 2013/5/23 Pepsodent Cola > > >> Hi, >> >> I'm reading Part 2 and this chapter *"Explore the free admin >> functionality"* of the Django tutorial. >> >> https://docs.djangoproject.com/en/1.5/intro/tutorial02/#explore-the-free-admin-functionality >> >> I have a question regarding the *"Change history"* part where you can >> see a screenshot at the end of that chapter. >> >> The time format used in the "Change history" administration pages uses >> *AM/PM >> time format*. How can I make it display *24h time format* instead? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users...@googlegroups.com . >> To post to this group, send email to django...@googlegroups.com >> . >> Visit this group at http://groups.google.com/group/django-users?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > > -- > Rafael E. Ferrero > Claro: (03562) 15514856 > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Integrating NoSQL-persisted custom Models
On Friday, May 24, 2013 10:22:45 AM UTC+4, Russell Keith-Magee wrote: > You might get some traction using django-nonrel, but I can't comment on how well it works. It's a fork of Django 1.3 ..., I have an app up & running with django-nonrel 1.5, it's in beta but works perfectly with no problem, also mongodb-engine 1.5 beta is also available that can be used to support MongoDB database backend. for getting django 1.5 you just need 3 things. * [django-nonrel-1.5-beta][1] * [django-mongodb-engine-1.5-beta][2] * [djangotoolbox-1.5-beta][3] They're all in beta but really works with no issue. I really looking forward to see NoSQL support in django core, That would be awesome for such an awesome web framework. [1]: https://github.com/django-nonrel/django/tree/nonrel-1.5-beta [2]: https://github.com/django-nonrel/mongodb-engine/tree/mongodb-engine-1.5-beta [3]: https://github.com/django-nonrel/djangotoolbox/tree/toolbox-1.5-beta On Friday, May 24, 2013 10:22:45 AM UTC+4, Russell Keith-Magee wrote: > > > On Fri, May 24, 2013 at 1:26 PM, Kurtis > > wrote: > >> A project I am working on uses a hybrid SQL/NoSQL data backend. >> >> I'd like to build custom Models which "behave" exactly like the >> traditional Django Models but are tied into my MongoDB backend. >> >> Where should I start to make sure I cover all bases? Implementing my own >> instance Model? I imagine I'll also need custom Model Managers as well. >> >> I'm guessing there are some problems with this approach since they forked >> Django for a full non-relational release several versions ago. I imagine >> 3rd party components may also throw their own set of problems at me as well. >> >> If anyone has given this a shot before, can you share some tips or >> pitfalls you ran into during the process? >> > > It depends entirely on how "Django-like" you need your models to be. > > If you're expecting to be able to just drop a MongoDB store into your > project and have any arbitrary Django app run with it -- that's going to > cause problems. There are fundamental differences between SQL databases and > MongoDB, and it's not possible to abstract away those differences. In > particular, deep joins are very difficult/inefficient to implement on > Mongo, because Mongo hasn't been optimised for that lookup mode. > > However, if you're just looking to be able to do some light introspection > -- say, enough to use ModelForms, and maybe some light local attribute > querying -- then you should be able to duck type the Django model Meta > object and the model manager sufficiently to make simple operations work. > I'm not aware of anyone that has tried to do this, however, and the Meta > object in particular isn't currently a documented interface, so you're > going to need to get to know Django's internals in order to take this > approach. > > Is there anything you can use out of the box? You might get some traction > using django-nonrel, but I can't comment on how well it works. It's a fork > of Django 1.3 IIRC, so it's getting quite old in terms of feature set. > > There's also an old GSoC branch that introduced a MongoDB backend; > however, that effort stalled due to some complications with automated > primary keys and a few other areas. You might be able to resurrect some > code from this branch, but again -- it's somewhat stale, and not especially > well documented. > > Yours, > Russ Magee %-) > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: View pictures from the template via models.FilePathField
Hi Federico, Maby is better idea you use the models.ImageField(upload_to= path) ie: locandina = models.ImageField(upload_to= path) then in the template you can get the path: {{ object.locandina.url }} Also, you need to read some about configuration on settings.MEDIA_ROOT and settings.MEDIA_URL, for use the imageField. Regards, Ronny El jueves, 23 de mayo de 2013 03:57:02 UTC-4, Federico Erbea escribió: > > I'm not sure this is the correct method to use, so I'm open to suggestions. > Practically I want to display the image retrieving the path where they are > saved from the database. > > In a class in models.py I have inserted: > > locandina = models.FilePathField( path = "C:/Users/Federico.Erbea/Google > Drive/Umore/apps/Database/static/Film/Locandina/", recursive=True) > > In the Admin the pull-down menu perfectly recovers the files I'm > interested in, allowing me to select the appropriate one > I didn't understand very well how works FilePathField, so I don't know how > to pass the information to the template ... I need help, thanks > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Help with robots.txt
On 24/05/2013 10:04pm, frocco wrote: Hello, Can someone give me an example of configuring robots.txt? I want to block the admin site. and anything else? I needed this info recently and googled robots.txt. This was the second item ... http://www.robotstxt.org/robotstxt.html -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Help with robots.txt
Thank you On Friday, May 24, 2013 9:16:35 AM UTC-4, Mike Dewhirst wrote: > > On 24/05/2013 10:04pm, frocco wrote: > > Hello, > > > > Can someone give me an example of configuring robots.txt? > > > > I want to block the admin site. > > > > and anything else? > > I needed this info recently and googled robots.txt. This was the second > item ... http://www.robotstxt.org/robotstxt.html > > > > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Django users" group. > > To unsubscribe from this group and stop receiving emails from it, send > > an email to django-users...@googlegroups.com . > > To post to this group, send email to > > django...@googlegroups.com. > > > Visit this group at http://groups.google.com/group/django-users?hl=en. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Display each language in its own language.
In my settings.py I have #Used for translations gettext = lambda s: s #languages written as they would be displayed in the language selector form LANGUAGES = ( ('en', gettext('English')), ('fr', gettext('French')), ('ja', gettext('Japanese')), ) and I was thinking of writing each language in its own language LANGUAGES = ( ('en', gettext('English')), ('fr', gettext('Français')), ('ja', gettext('日本人')), ) But I get an error for having a non ascii character in settings.py On Thu, May 23, 2013 at 3:26 PM, Cody Scott wrote: > I would like the language selector to display each language in its own > language. So for example English will always be displayed as 'English'. > Even if the current language is French it will still be 'English' and not > Anglais. > > > {% csrf_token %} onchange="$('#locale_switcher').submit()" class="btn btn-inverse"> {% > for lang in LANGUAGES %} selected="selected" {% endifequal %}> {{ lang.1 }} > {% endfor %} > > > I think all language selector forms should be like this. > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-users/mBTgoUNIj30/unsubscribe?hl=en > . > To unsubscribe from this group and all its topics, send an email to > django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Display each language in its own language.
On Fri, May 24, 2013 at 2:54 PM, Cody Scott wrote: > In my settings.py I have > > #Used for translations > > gettext = lambda s: s > > #languages written as they would be displayed in the language selector form > > LANGUAGES = ( > > ('en', gettext('English')), > > ('fr', gettext('French')), > > ('ja', gettext('Japanese')), > > ) > > and I was thinking of writing each language in its own language > > LANGUAGES = ( > > ('en', gettext('English')), > > ('fr', gettext('Français')), > > ('ja', gettext('日本人')), > > ) > > But I get an error for having a non ascii character in settings.py > If you don't want language names to be translated into other languages, then don't mark them up as translatable strings that will have their values retrieved from the active message catalogue. IE: LANGUAGES = ( ('en', u'English'), ('fr', u'Français'), ('ja', u'日本人'), ) Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Display each language in its own language.
ok I also had to add # -*- coding: utf-8 -*- to the top of the file On Fri, May 24, 2013 at 10:03 AM, Tom Evans wrote: > On Fri, May 24, 2013 at 2:54 PM, Cody Scott > wrote: > > In my settings.py I have > > > > #Used for translations > > > > gettext = lambda s: s > > > > #languages written as they would be displayed in the language selector > form > > > > LANGUAGES = ( > > > > ('en', gettext('English')), > > > > ('fr', gettext('French')), > > > > ('ja', gettext('Japanese')), > > > > ) > > > > and I was thinking of writing each language in its own language > > > > LANGUAGES = ( > > > > ('en', gettext('English')), > > > > ('fr', gettext('Français')), > > > > ('ja', gettext('日本人')), > > > > ) > > > > But I get an error for having a non ascii character in settings.py > > > > If you don't want language names to be translated into other > languages, then don't mark them up as translatable strings that will > have their values retrieved from the active message catalogue. IE: > > LANGUAGES = ( > ('en', u'English'), > ('fr', u'Français'), > ('ja', u'日本人'), > ) > > Cheers > > Tom > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-users/mBTgoUNIj30/unsubscribe?hl=en > . > To unsubscribe from this group and all its topics, send an email to > django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Django's cascade delete is executing the DELETE SQL twice
Sure okay, I'll whittle my project down to the bare bones, investigate it further, and if I manage to get a simple project that reproduces it I'll let you know. Cheers! Oh, and it's Django 1.5.1 I'm running. On Friday, 24 May 2013 11:14:03 UTC+1, akaariai wrote: > > On 22 touko, 18:57, Michael wrote: > > I've got an odd situation here, any idea why the delete SQL for the > > `myapp_entry_tag` table is being performed twice? > > > > >>> from myapp.models import Tag > > >>> from django.db import connection > > >>> from pprint import pprint > > >>> Tag.objects.only('pk').get(pk=1).delete() > > >>> pprint(connection.queries) > > > > [{u'sql': u'SELECT `myapp_tag`.`id` FROM `myapp_tag` ''WHERE > > `myapp_tag`.`id` = 1 ', > > u'time': u'0.000'}, > > {u'sql': u'DELETE FROM `myapp_entry_tag` WHERE > `myapp_entry_tag`.`tag_id` > > IN (1)', > > u'time': u'0.000'}, > > {u'sql': u'DELETE FROM `myapp_entry_tag` WHERE > `myapp_entry_tag`.`tag_id` > > IN (1)', > > u'time': u'0.000'}, > > {u'sql': u'DELETE FROM `myapp_tag` WHERE `id` IN (1)', u'time': > u'0.000'}] > > > > models.py: > > > > class Tag(models.Model): > > ... > > > > class EntryTag(models.Model): > > ... > > tag = models.ForeignKey(Tag) > > The answer is: this should not happen, and I wasn't able to reproduce > this using Django master. > > What version of Django is this? Could it be that you have some custom > code running (signal handlers for example)? Can you produce a small > self-contained Django project where this happens? > > - Anssi > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
object is not iterable
Hello all, I have an insoluble problem when I try to use the formsets... *This is my models:* class Relais(models.Model): nom = models.CharField(max_length=100,blank=True) competition = models.ForeignKey(Competition) sport = models.ForeignKey(Sport) ordre = models.IntegerField() def __unicode__(self): if self.nom: return self.nom else: return "%s - %d - %s" % (self.competition.nom,self.ordre,self.sport.nom) *my forms.py:* class RelaisForm(ModelForm): class Meta: model = Relais *and the part of my views.py which cause this problem:* relaisList = competition.relais_set.all() RelaisFormSet = formset_factory(RelaisForm) formset = RelaisFormSet(initial=relaisList) # <== this line The error is: Exception Type:TypeErrorException Value: 'Relais' object is not iterable Have you got an idea on what cause this problem ? Thank you ;) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: object is not iterable
Hi Olivier, > The error is: > Exception Type:TypeErrorException Value: > > 'Relais' object is not iterable > > > > > Have you got an idea on what cause this problem ? It would really help to see a full traceback, could you provide one? Kind regards Michael -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: upload image with Django
Gianluca Dileo writes: > Hi guy, > I've created a form in a page html that upload a image. > After capturing the image and edit it, I need to have it appear in a window > j > How can i do? Does HttpResponseRedirect do what you want to achieve? Kind regards Michael -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: current transaction is aborted, commands ignored until end of transaction block
Hi Andreas, > The error is : "current transaction is aborted, commands ignored until end > of transaction block", I guess you use postgres. This is a standard error that postgres thows if you do any database action in a transaction after any other error. You need to find the previous error that triggers this. The error is probably in a different part than the one you currently suspect ... Kind regards Michael -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Problem with ~ in url prefix
Hi Hordur, it really *does* look like a bug, could you please open a ticket for this behaviour? Nice would be a minimal test case, like just reversing a url in this way when a ~ is in the path. Kind regards Michael -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Problem counting names by letter
With this simple database table: class Artist(models.Model): id = models.IntegerField(primary_key=True) name = models.CharField(max_length=255L, blank=True) prefix = models.CharField(max_length=32L, blank=True) class Meta: db_table = 'artist' I want to be able to get a list of the first letter of the names with a count, for example with these artists in the table: ABBA, America, Asia, Blondie, Billy Joel, Charo I want this result letter=A lcount=3 letter=B lcount=2 letter=C lcount=1 To complicate things, the database is not the default database. I've tried this raw query letters = Artist.objects.using('database_name').raw('SELECT id, UPPER(LEFT(name,1)) AS letter, COUNT(DISTINCT name) AS lcount FROM artist GROUP BY UPPER(LEFT(name,1)) ORDER BY UPPER(name)') but I get this error: AttributeError: 'QuerySet' object has no attribute 'raw' I've been able to do it using a cursor directly. Is that the only way? Or am I missing something. I'm trying to limit my use of raw and direct queries. I'd like to be able to do something like this: Artist.objects.using('database_name').aggregate(lc=Count('upper(left(name,1))')) but that doesn't work: FieldError: Cannot resolve keyword 'upper(left(name,1))' into field. Choices are: id, name, prefix Any ideas? Thanks! Brian -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Problem counting names by letters
With this simple database table: class Artist(models.Model): id = models.IntegerField(primary_key=True) name = models.CharField(max_length=255L, blank=True) prefix = models.CharField(max_length=32L, blank=True) class Meta: db_table = 'artist' I want to be able to get a list of the first letter of the names with a count, for example with these artists in the table: ABBA, America, Asia, Blondie, Billy Joel, Charo I want this result letter=A lcount=3 letter=B lcount=2 letter=C lcount=1 To complicate things, the database is not the default database. I've tried this raw query letters = Artist.objects.using('database_name').raw('SELECT id, UPPER(LEFT(name,1)) AS letter, COUNT(DISTINCT name) AS lcount FROM artist GROUP BY UPPER(LEFT(name,1)) ORDER BY UPPER(name)') but I get this error: AttributeError: 'QuerySet' object has no attribute 'raw' I've been able to do it using a cursor directly. Is that the only way? Or am I missing something. I'm trying to limit my use of raw and direct queries. I'd like to be able to do something like this: Artist.objects.using('database_name').aggregate(lc= Count('upper(left(name,1))')) but that doesn't work: FieldError: Cannot resolve keyword 'upper(left(name,1))' into field. Choices are: id, name, prefix Any ideas? Thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to stop internal django server
thanks Am Sonntag, 28. September 2008 14:44:22 UTC-7 schrieb Hingarajiya,Ravi: > > Jeff : > > Thanks for reply. > > Ravi Hingarajiya > > On Sun, Sep 28, 2008 at 2:41 PM, Jeff Anderson > > > wrote: > >> Hingarajiya,Ravi wrote: >> > Hi Alessandro, >> > >> >Thanks for your reply.I know kill command. >> > >> > But we are developing IDE for Django. So We want to know that how >> > to stop internal server using any command (example : /etc/init.d/httpd >> > stop in apache web server ). >> /etc/init.d/httpd stop is just a wrapper script that uses the kill >> command. You need to do the same thing to kill any process. ctrl+c sends >> signal 2 to the running process. kill is exactly what you need to >> use. >> >> Jeff Anderson >> >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Unable to access URL's query string using request.GET['next']
Hello, I can't seem to access request.GET['next'] (from a URL with a query string). Here's what I'm doing: localhost:8000/dashboard/ points to dashboard() view but the dashboard() view uses @login_required decorator. And so, if the user isn't logged in, localhost:8000/dashboard/ redirects to localhost/login/?next=/dashboard/ (but I can't access request.GET info after login). Here's my dashboard() view: http://dpaste.org/Z9dZX/ ... i.e. when dashboard view is loaded after successful login (from localhost/login/?next=/dashboard/), I see "You submitted an empty query string.", when in fact I expect to see the request.GET data from the URL query string. Can anyone point out the error(s) in my code? I can provide other parts of my code if you want. Thanks a lot! -- Amber Jain i.amber.j...@gmail.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Unable to access URL's query string using request.GET['next']
2013/5/25 Amber Jain > Hello, > > I can't seem to access request.GET['next'] (from a URL with a query > string). Here's what I'm doing: > localhost:8000/dashboard/ points to dashboard() view but the dashboard() > view uses @login_required decorator. And so, if the user isn't logged in, > localhost:8000/dashboard/ redirects to localhost/login/?next=/dashboard/ > (but I can't access request.GET info after login). > > Here's my dashboard() view: http://dpaste.org/Z9dZX/ ... i.e. when > dashboard view is loaded after successful login (from > localhost/login/?next=/dashboard/), I see "You submitted an empty query > string.", when in fact I expect to see the request.GET data from the URL > query string. > > Can anyone point out the error(s) in my code? I can provide other parts of > my code if you want. I can't say exactly what you're doing *wrong*, because this is the behavior I would expect. The ?next query parameter is used by the default login view to tell Django where it should send the user after the user has been logged in [1]. The ?next argument is dropped from the query string because it has already fulfilled its purpose at that point, it wasn't an argument for your dashboard view. Can you tell us what do you want to achieve with this? [1] https://github.com/django/django/blob/master/django/contrib/auth/views.py#L48 -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Unable to access URL's query string using request.GET['next']
You can't see next variable after login because the view that process "login form" don't return the variable in any form. You can modify this view. Regards, Ariel Calzada Homepage: http://www.000paradox000.com Blog: http://blog.000paradox000.com "If I had asked people what they wanted, they would have said faster horses." -- Henry Ford 2013/5/25 Felipe Coelho > 2013/5/25 Amber Jain > >> Hello, >> >> I can't seem to access request.GET['next'] (from a URL with a query >> string). Here's what I'm doing: >> localhost:8000/dashboard/ points to dashboard() view but the dashboard() >> view uses @login_required decorator. And so, if the user isn't logged in, >> localhost:8000/dashboard/ redirects to localhost/login/?next=/dashboard/ >> (but I can't access request.GET info after login). >> >> Here's my dashboard() view: http://dpaste.org/Z9dZX/ ... i.e. when >> dashboard view is loaded after successful login (from >> localhost/login/?next=/dashboard/), I see "You submitted an empty query >> string.", when in fact I expect to see the request.GET data from the URL >> query string. >> >> Can anyone point out the error(s) in my code? I can provide other parts >> of my code if you want. > > > I can't say exactly what you're doing *wrong*, because this is the > behavior I would expect. The ?next query parameter is used by the default > login view to tell Django where it should send the user after the user has > been logged in [1]. The ?next argument is dropped from the query string > because it has already fulfilled its purpose at that point, it wasn't an > argument for your dashboard view. Can you tell us what do you want to > achieve with this? > > [1] > https://github.com/django/django/blob/master/django/contrib/auth/views.py#L48 > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.