django

Django: Are the anti-spam measures in the comments framework sufficient? Or will I need to use a captcha or akismet?

I'm going to be implementing the comments framework and I'm wondering what I should expect to run into. If someone could specifically explain the methods they've tried/tested for anti-spam measures in django and give recommendations I'd greatly appreciate it. And yes, I have read some of the questions here but I haven't run into a detai...

What is the appropriate numeric field to use

I have a field that sometimes contains integers, sometimes contains decimals and sometimes contains a list of integers. I have been using CommaSeparatedIntegerField and multiplying the decimals by 1000 to get to reasonable integers. Is there a better way? ...

Security and API implementation - REST

Hi folks, I'm implementing an API using Django. One 1 service should be able to access 1 API url. I am wondering if there are any popular security practices that go beyond using username/password and SSL? Is using sequential signature generation a popular practice? ...

How to span lookup relationship in django?

Where am i goofing in the following lookup? My models: Class Item(models.Model): item_code = models.CharField(max_length=10) name = models.CharField(max_length=255) .... Class Stock(models.Model): item_code = models.ForeignKey( Item ) qty = models.IntegerField() ... Now i want to get all Stock obje...

Initial populating on Django Forms

I decide to learn Django Forms. For awhile now been using HTML forms because its hard for me to come terms with django forms. How could i populate initial data to django forms? Example: Consider if these models are populated. Contain data. models.py class Game(models.Model): title = models.CharField() genre = models.CharField()...

django manytomany through

If I have two Models that have a manytomany relationship with a through model, how do I get data from that 'through' table. class Bike(models.Model): nickname = models.CharField(max_length=40) users = models.ManyToManyField(User, through='bike.BikeUser') The BikeUser class class BikeUser(models.Model): bike = models.F...

Django - can you make a subclass of a model just to alter behavior?

I'm looking to do the opposite of what Django's proxy model does. I want to subclass Model, add some extra methods to it, add behavior to save(), set a default manager that adds some my-application-specific methods, and then subclass that to create most of the models in my application. Is this possible? ...

copy all fields of a django model instance

Hello everybody, ok i think this is very basic, but since i'm new to django i don't know how to handle this.. I need to copy an instance of a django-model. As explained here, there is a problem with copying many2many relations. But the attachment "django-model-copying.diff" has that function i guess. So i don't know - does my django alr...

django generic view pagination by item id (not page number)

I love the ease of django's pagination system, but is there anyway to tweak it where it's paginating by item id instead of page number? Because I am ordering in descending order, if there is an update on a page while a user is going through the pages, the ordering is off. For instance, if each page had 3 items Item #1 Item #2 Item #3 ...

Serving static files with logic in django (keeping a downloadcount)

I have a site which enables the user to download certain files. However I want to keep a download count for each file so going the usual way by putting the static files on a different subdomain and then letting apache do the heavy lifting is not a way as well as HttpResponseRedirecting the user to a subdomain isn't good because then the ...

Dynamically 301 old urls to new url pattern?

I have updated my url pattern from: (r'^(?P<slug>[-\w]+)/$', 'bugs.views.bug_detail'), to (r'^issue/(?P<id>[0-9]+)/(?P<slug>[-\w]+)/$', 'bugs.views.bug_detail'), So I'm now relying on the primary key in the URL since the slug can change at any time. I have about 40-50 links that I need to 301 to spiders/crawlers. What's the easies...

How to return multiple objects related with ForeignKey in Django

I have the following in my models.py: class HostData(models.Model): Manager = models.ForeignKey(Managers) Host = models.CharField(max_length=50, null=True) HostStatus = models.CharField(max_length=200, null=True) Cpu = models.PositiveIntegerField(max_length=10, null=True) Disk = models.FloatField(null=True) I would like to r...

Why are my Django GAE requests returning "Property details must be a str or unicode instance, not a BoundField"

Why does the commented out code work, while the other code returns a BoundField error? Shouldn't they be equivalent? form = PostForm(request.POST) post = Post(title = form['title'], details = form['details']) #post = Post(title = request.POST['title'], details = request.POST['details']) Also, I fear the title to this question makes n...

Updating sitemap from django to google webmaster doesn't work.

Our website gets updated almost everyday. We need to update the sitemap to the google webmasters every time there are new pages added. We have tried using ping_google() along with the required set of arguments and google and it never seem to update the sitemap on webmasters. To log the response, we re-wrote the function and logged the ...

django python: How to use the source instead of the egg?

Hi there, I was having some issues with a Django app called "django-categories" The developer told me to use the source instead of the egg. How do I do that? ...

Bulk updating a table

I want to update a customer table with a spreadsheet from our accounting system. Unfortunately I can't just clear out the data and reload all of it, because there are a few records in the table that are not in the imported data (don't ask). For 2000 records this is taking about 5 minutes, and I wondered if there was a better way of doin...

Facebook integration... Where to start?

I recently put a django project of mine into its beta stages and would really like to integrate more with social media, particularly facebook. Now there are so many facebook integrations out there... I don't know where to start but, I'll tell you what I am after. My sites publishes content with photos and also user related data (which ...

Django: Refactoring template view to include count?

TEMPLATE: <ul id="bugs-list"> {% for group in groups %} <h2>{{ group.name }}</h2> <span></span> {% for data in group.grab_bugs %} <li><a href="{{data.get_absolute_url}}">{{data.name }}</a></li> {% endfor %} {% endfor %} </ul> models.py: class BrowserGroups( models.Model ): name = models.CharF...

Django ManyToMany in one query

Hi, I'm trying to optimise my app by keeping the number of queries to a minimum... I've noticed I'm getting a lot of extra queries when doing something like this: class Category(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=127, blank=False) class Project(models.Model): categorie...

Django must be a "User" instance.

I get a Must be a User Instance error message. TRACEBACK Traceback: File "/Library/Python/2.6/site-packages/django/core/handlers/base.py" in get_response 92. response = callback(request, *callback_args, **callback_kwargs) File "/Users/ApPeL/Sites/Django/omu2/../omu2/friends/views.py" in add 13. if form.is_v...