django

Django shopping cart/basket solution (or should I DIM)?

Hi there. I'm about to build a site that has about half a dozen fairly similar products. They're all DVDs so they fit into a very "fixed" database very well. I was going to make a DVD model. Tag them up. All very simple. All very easy. But we need to be able to sell them. The current site outsources the whole purchasing system but that...

Best way to change behavior of collapsed fieldset in admin?

When an admin fieldset is given the class "collapse", it is rendered with a Show/Hide link installed by CollapsedFieldset.js which collapses or expands it. In all cases where the collapse class appears, I'd like the link to be the whole fieldset box (or a div of that dimension) instead of just the word "Show". What is the best way to "...

What limitations does NDjango templates have over regular Django templates?

Are there any differences, limitations or gotchas between NDjango and Django templates? I'm specifically interested in implementing them in future ASP.NET MVC projects. I'm certain I won't be able to use any of my custom template tags that I've written for Django, but would I be able to port them to NDjango? ...

Django Templates — passing value of a variable in a template to templatetags filter

name class an id, a first & a last attributes In my view.py, I fetch a name object from the database and pass it into the index.html template. In my templagetags/my_tags.py, I have a filter my_private_tag(value, arg) that takes value and an arg. It appends the arg to the value and returns the result. def my_private_tag(value, arg): ...

Understanding python imports

In the process of learning Django and Python. I can't make sense of this. (Example Notes:'helloworld' is the name of my project. It has 1 app called 'app'.) from helloworld.views import * # <<-- this works from helloworld import views # <<-- this doesn't work from helloworld.app import views # <<-- but this...

where do functions that don't display go in django

I have some links on an html page like , , currently I handle them as so <p> <a href="/cases/{{case.id}}/case_rate/-">rate down</a> and have a url.py entry: (r'^cases/(?P<case_id>\d+)/case_rate/(?P<oper>.)$', 'mysite.cases.views.case_rate'), then I have a view function that handles the logic and hits the DB, then does this: retu...

Django not picking up changes to INSTALLED_APPS in settings.py

I'm trying to get South to work - it worked fine on my PC, but I'm struggling to deploy it on my webhost. Right now it seems that any changes I make to add/remove items from INSTALLED_APPS aren't being picked up by syncdb or diffsettings. I've added south to my list of INSTALLED_APPS, but the tables it needs aren't being created when I ...

Eclipse/PyDev + Django debug

Eclipse/PyDev, Python 2.6, Django 1.1 All is working in run mode. If I put debug point inside manage.py file, breakpoint worked. But when I putted it in any action method, it causes nothing :( ...

How do I include image files in Django templates?

I'm new to Django and I'm trying to learn it through a simple project I'm developing called 'dubliners' and an app called 'book'. The directory structure is like this: dubliners/book/ [includes models.py, views.py, etc.] dubliners/templates/book/ I have a JPG file that needs to be displayed in the header of each Web page. Where shoul...

Best way to integrate PHP forum into Django site?

Suppose you are running a Django site, and have a legacy PHP forum to support and integrate into your site, since current Django forum solutions are not mature enough. What is the best way to do this? Currently I have a simple view, which renders a very simple template which extends my site's base template, and the content area has not...

How Can I Check the Size of a Collection with Django Templates?

I have a list in my Django template. I want to do something only if the size of the list is greater than zero. How can I check this? I have tried myList|length and myList|length_is but have not been successful. I've searched all over and don't see any examples. ...

Django, custom template filters - regex problems

I'm trying to implement a WikiLink template filter in Django that queries the database model to give different responses depending on Page existence, identical to Wikipedia's red links. The filter does not raise an Error but instead doesn't do anything to the input. WikiLink is defined as: [[ThisIsAWikiLink | This is the alt text]] Her...

Which is the better of the django event apps?

I've been looking at django-swingtime, django-schedule and django-agenda. Any recommendations of which is them easier to use, and if so any practical code examples out there? Couldn't find useful examples in the respective projects. My requirement is to have a number of events and track their occurrences, but the events are custom thin...

Django url template tage and variable values with dot (.)

why doesn't {% url myVar %} where myVar = 'jack.johnson' doesn't work ? The view is fine, the urls.py is: url(r'^(?P[A-Za-z0-9-._]+)/$', overview, name='user_profile'), ...

Django admin url.py

Hi all, Im following the Django tutorial, and ive got up to part 4. But when i went back to have a look at my admin page it mysteriously didnt work anymore. So i messed around a bit more and came up with this. from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', ...

HttpResponseRedirect django + facebook

Hi, I have a form with 2 buttons. depending on the button click user is taken to different url. view function is : friend_id = request.POST.get('selected_friend_id_list') history = request.POST.get('statushistory') if history: print "dfgdfgdf" return HttpResponseRedirect('../status/') else: return direct_to_template(reque...

How to make fields readonly while updating.

I have a form. Once the form is filled I don't want the user to change anything in the form. But the user can see the values. Meaning all the fields are non editable. I can do this by using instance method but this does not help in foreignkey. ...

Avoiding graphical CAPTCHA by checking against OpenStreetMap

I am writing a subscription app for a rallye site. As the subscription doesn't need former registration, a captcha should be useful. The subscription is team-based. One team include 1 to 3 person. for each person an postal address must be provided. Now I wonder, if it makes sense to check if the city exists and the provided street is ...

Is there a mature Django forum application?

I am looking for a forum solution for a Django site. I looked over the options in the Django wiki and I check about integrating non-Django solutions. As much as I do not feel comfortable with implementing an external PHP forum, I feel even less comfortable with going with a Django solution which is not mature enough. Do you have any re...

Image and video previews in admin inline forms for ManyToMany relation

A have 3 models: Project, Image and Video with ManyToManyField relation: class Project(models.Model): images = models.ManyToManyField('Image', through='Project_Images') video = models.ManyToManyField('Video', through='Project_Video') class Image(models.Model): original = models.ImageField() projects = models.ManyToManyF...