django

Django, generic relations, make fixtures

I'm trying to add generic relations and one-to-one relations support for django-test-utils makefixture command, here is the source http://github.com/ericholscher/django-test-utils/blob/master/test_utils/management/commands/makefixture.py Does somebody have ideas how to do this? Or may be there is another tool for such thing as: ./manag...

Django get_object_or_create() not working on deployment server

I'm having major trouble with a get_or_create call. I have it working locally absolutely fine, and the same script is working online on another site. Has anyone got an idea what's going on? I get "IntegrityError: (1062, "Duplicate entry '2147483647' for key 'PRIMARY'")" whenever I run the script... for tweet in TwitterSearchFeed.entri...

Django: How can I include the output of one view in another?

When a user visits mysite.com/articles, they see I a lists several articles. How can I include this list into another page, e.g. the home page, but so that I can still add extra content to the home page? This list of articles will only appear on those 2 pages, so a custom tag seems a bit like overkill. Thanks ...

how to manage lock-write mechanism in django

hello. i've been searching for a while for a way to handle the lock-write mechanism in( whenever user is updating , the record should be locked for the others ) . and i've been told that the web-frame work is responsible for this. check this out : http://serverfault.com/questions/184666/how-to-configure-apache-server my question is : h...

Filtering on the count with the Django ORM.

Hello, I have a query that's basically "count all the items of type X, and return the items that exist more than once, along with their counts". Right now I have this: Item.objects.annotate(type_count=models.Count("type")).filter(type_count__gt=1).order_by("-type_count") but it returns nothing (the count is 1 for all items). What am I...

How do I change a TextInput value through ModelForm in Django?

I have a ModelForm as follows: class ArticleForm(forms.ModelForm): title = forms.CharField(max_length=200) body = forms.CharField(widget=forms.Textarea) new_status = forms.CharField(label="Status", max_length=1, widget=forms.Select(choices=APPS_ARTICLE_STATUS)) tags = forms.CharField(label="Generic Tags", max_length=200...

Combine values from MultiWidget into one field for POST

I'm using the phone number MultiWidget provided by derek73. Question is: it puts three separate values in the POST - how should I recombine them into one value? class USPhoneNumberMultiWidget(forms.MultiWidget): """ A Widget that splits US Phone number input into three <input type='text'> boxes. """ def __init__(self,attrs=None): wi...

Handling Local and Remote DB in Django

I'm using Django and MySQL to serve a website. I have my own MySQL server on localhost for my site. Now I have a third-party MySQL database that I need to use to read and write to that is on a remote host. I set up the new database's information in my settings.py file, but a problem occurs when I try to access the remote DB. Because the ...

Changing tmp directory used by Haystack and/or Whoosh

I'm running Haystack + Whoosh under a Debian vserver setup with only 128MB for the /tmp directory and am running out of space in it during indexing (the individual Whoosh tmp files are 25MB+). I'd love to increase the tmp folder size, but that's out of my control. Is there a way to instruct Haystack or Whoosh to use an alternate tmp dir...

Django - Block tags in included templates get overridden by calling template

I have a template that includes another template. This included template has block tags in it. Example: base.html BASE {% block title %}Base Title{% endblock %} {% block content %}{% endblock %} template1.html {% extends 'base.html' %} {% block title %}Extended Title{% endblock %} {% block content %} Extended content {% incl...

schema in Django with sqlite

Hi, I am new to Django, i was going through this Django site for building up a basic app. They have explained the procedure's to use either SQLITE3 , MYSQL, postgresql... I used SQLITE3 as they tell about it being a single large file which makes it easy to use initially. The problem i am facing is to use .schema to check the database c...

Django with multiple database

I have a Django application with two configured databases first_DB and second_DB The configurations seems as following DATABASES = { 'default': { 'ENGINE' : 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME' : 'emonitor', # Or path ...

Django manager attribute error

Hello, I have a problem to add custom methods to my models. I found solution in django book but it does not work. Here is my code for models class NewsManager(models.Manager): def getLastNews(self): return self.objects.order_by('-id')[:3] class News(models.Model): title=models.SlugField() shortBody=models.CharField(...

python django how can i filter object_set.all by current user in template

http://pastebin.com/Aa5rJxv8 i have django problem above, i tried to explain i need to show ratings given by current user to books in user shelves thanks ...

How can I build a django homepage with updatable content?

I an building a kind of social network (think of it as last.fm, but gaming related). I want to have a homepage which will feature: site news, announcements etc. in the main part featured items in the right sidebar player of the week in the right sidebar I am trying to think of a way not to be hand coding these every time they need t...

How to query abstract-class-based objects in Django?

Let's say I have an abstract base class that looks like this: class StellarObject(BaseModel): title = models.CharField(max_length=255) description = models.TextField() slug = models.SlugField(blank=True, null=True) class Meta: abstract = True Now, let's say I have two actual database classes that inherit from StellarObjec...

[SOLVED] DjangoUnicodeDecodeError and force_unicode

I've simple Django model of news entry: class NewsEntry(models.Model): pub_date = models.DateTimeField('date published') title = models.CharField(max_length = 200) summary = models.TextField() content = models.TextField() def __unicode__(self): return self.title Adding new news (in Admin page) with english text wo...

How to call controller function from template in Django?

How to call controller function from template in Django instead of hardcoding URIs? ...

Django query using or condition

In django how to query the following profile_setting = pSetting.objects.get(module="my_mod",setting_value=1) or pSetting.objects.get(module="my_mod",setting_value=0) ...

"Zero Iteration" - end to end acceptance test in simple contact-form feature

I was reading "Growing Object-Oriented Software, Guided by Tests" lately. Authors of this book sugested to always start developing a feature with an end-to-end acceptance test (before starting TDD cycle) to not loose a track of progress and to make sure that you're still on the same page while unit-testing. Ok, so I've start writing a v...