django

how can I group on converted values?

so far I have this query: q = Foobar.objects.values('updater','updated') q = q.annotate(update_count=Count("id")) which seems to generate a query like: select updater, updated, count(id) from foobar group by updater, updated "updated" is a date-time field, and I'd like to do my counts by day, with a query that looks like: select u...

Can I use django.contrib.gis on GAE?

Can I use GeoDjango with GAE / BigTable? ...

Get image from Flickr using django-syncr

Hello guys, I have my photos located on Flickr. I want to sync them between Flickr and my Django app using django-syncr. It's installed, Flickr section is visible in Admin site. I can sync photo data from Flickr to my local database. In a few words -- it works. But, I don't understand how to get these data from my database using views.py...

How do you store accented characters coming from a web service into a database?

I have the following word that I fetch via a web service: André From Python, the value looks like: "Andr\u00c3\u00a9". The input is then decoded using json.loads: >>> import json >>> json.loads('{"name":"Andr\\u00c3\\u00a9"}') >>> {u'name': u'Andr\xc3\xa9'} When I store the above in a utf8 MySQL database, the data is stored like the...

Django, get fully serialized object. All properties from many to many relationships

I'm looking for a way to serialize an entire object with all of it's relationships. I seem to be only able to get the primary key from the serializer now. This is my model: class Action(models.Model): name = models.CharField('Action Name', max_length=250, unique=True) message = models.TextField('Message', blank=True, null=True...

Django caching seems to be causing problems

Hey guys, i have just implemented the Django Cache Local Memory back end in some my code, however it seems to be causing a problem. I get the following error when trying to view the site (With Debug On): Traceback (most recent call last): File "/usr/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 279, in run ...

In Django, can I always force browser and provider caches to load new pages with a global setting?

I have a handful of users on a server. After updating the site, they don't see the new pages. Is there a way to globally force their browsers and providers to display the new page? Maybe from settings.py? I see there are decorators that look like they do this on a function level. ...

Form for Profile models ?

Is there a way to create a form from profile models ? For example... If I have this model as profile: class blogger(models.Model): user = models.ForeignKey(User, unique=True) born = models.DateTimeField('born') gender = models.CharField(max_length=1, choices=gender ) about = models.TextField(_('about'), null=True, ...

Fulltext search for django : Mysql not so bad ? (vs sphinx, xapian)

I am studying fulltext search engines for django. It must be simple to install, fast indexing, fast index update, not blocking while indexing, fast search. After reading many web pages, I put in short list : Mysql MYISAM fulltext, djapian/python-xapian, and django-sphinx I did not choose lucene because it seems complex, nor haystack as ...

Django Per-site caching using memcached

So I'm using per-site caching on a project and I've observed the following, which is kind of confusing. When I load a flat page in my browser then change it through admin and then do a refresh (within the cache timeout) there is no change in the page--as expected. However when I stat a new session in a different browser and load the page...

Django Admin drop down combobox and assigned values

I have several question for the Django Admin feature. Im kind of new in Django so im not sure how to do it. Basically what Im looking to do is when Im adding information on the model. Some of the fields i want them to be combo-boxes with AutoCompleteMode. Also looking for some fields to have the same information, for example if i ha...

Django cannot find my templatetags, even though it's in INSTALLED_APPS and has a __init__.py

I just installed django-compress into /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/compress. I added 'compress' to INSTALLED_APPS. In my template file, I wrote {% load compressed %}. I got the error: 'compressed' is not a valid tag library: Could not load template library from django.templat...

Difference between URLLIB2 call in IDLE and from Django?

The following piece of code works as expected when running in a local install of django apache 2.2 fx = urllib2.Request(f); fx.add_header('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.36 Safari/525.19'); url_opened = urllib2.urlopen(fx); However when I enter that...

how to do server side form validation for dynamic inputs with Django

Hi, all. I am using django.forms.Form to validate form data in a survey applications. In a survey-creating form, a user can submit multiple questions that belong to the survey being created. Names for the question inputs are in the form of 'question_seq' , where seq is maintained using Javascript. Back in the server side, my code doe...

How do I construct a Django reverse/url using query args?

I have URLs like http://example.com/depict?smiles=CO&width=200&height=200 (and with several other optional arguments) My urls.py contains: urlpatterns = patterns('', (r'^$', 'cansmi.index'), (r'^cansmi$', 'cansmi.cansmi'), url(r'^depict$', cyclops.django.depict, name="cyclops-depict"), I can go to that URL and get...

How can I find "week" in django's calendar app?

MyCalendar.py Code: from django import template imort calendar import datetime date = datetime.date.today() week = ??? ... The question is that I want to get the week which contains today's date. How can I do? Thanks for help! Ver: Django-1.0 Python-2.6.4 ...

[SOLVED] How translate some text that come form a Django app?

Hi guy's im using a Django app newsletter, but i want to translate the message's from the app to Spanish.. how ill translate in my template? thanks ...

Content management recommendations for website?

Hello I am working on a website that has a wide range of content. (News, FAQs, tutorials, blog, articles, product pages etc.) Currently a lot of this content is static or uses special-purpose scripts. I would like to move most of it under the wing of a single content manager. I have not used out of the box content management softwar...

Why is alert not run even though $.getJSON runs fine? (Callback not executed, even though the request works fine with getJSON)

I have a snippet of code such as: $.getJSON("http://mysite.org/polls/saveLanguageTest?url=" + escape(window.location.href) + "&callback=?", function (data) { var serverResponse = data.result; console.log(serverResponse); alert(serverResponse); }); It works fine in the sense that it makes a ...

django convert list of objects to list of primary keys

Hi, As the title says I have a list of Django objects and I want to get a list of primary keys. What is the best way of doing this? I know I could do my_list = [] for item in object_list: my_list.append(item.pk) but was wondering if there is Django or Python specific way of doing this better. Thanks ...