django

setup payment for django satchmo

Hi all, this is a newbie satchmo question...so I've implemented satchmo for a django e-shop I am building. I have setup sathcmo following the tutorials, created some products, tested that I can make an order, and then switched to 'real mode', on http://site/settings, clicking on 'accept real payments'. The question is how I can setup t...

Django/jQuery - read file and pass to browser as file download prompt

I've previously asked a question regarding passing files to the browser so a user receives a download prompt. However these files were really just strings creatd at the end of a function and it was simple to pass them to an iframe's src attribute for the desired effect. Now I have a more ambitious requirement, I need to pass pre existi...

Updated: How to span multile tables in Django for a backwards relationship

The Django documentation gives en example like so: b = Blog.objects.get(id=1) b.entry_set.all() Which from what I understand results in 2 queries. What if I wanted to get the blog, the blog entries and all the comments associated with that entry in a number of queries that does not depend on the number of entries? Or do I have to drop...

I keep Getting KeyError: 'tried' Whenever I Tried to Run Django Dev Server from Remote Machine

I am running django 1.1.1 on python2.6.1, and did start the django web server like this manage.py runserver 192.0.0.1:8000 then tried to connect to the django dev web server on http://192.0.0.1:8000/ keep getting this message on the remote computer Traceback (most recent call last): File "C:\Python26\Lib\site-packages\django...

How to display total record count against models in django admin

Is there a neat way to make the record/object count for a model appear on the main model list in the django admin module? I have found techniques for showing counts of related objects within sets in the list_display page (and I can see the total in the pagination section at the bottom of the same), but haven't come across a neat way to ...

Babel Django Off By 1 Cent

I ran into a problem today while using BabelDjango and thought I would ask if anyone has ran into anything similar. I was using the tags in my templates, {% load babel %} and then {{amount_owed|currencyfmt:"USD"}} which returned the amount_owed minus one-cent. I thought maybe the returned value was 9.949999 which should still be $9.95 b...

How do I get User.message_set messages to show up for the built in test client?

I'm aware that the old Django messages framework is deprecated, but I still would like to know the answer to this. When I go to a certain url to my broswer, a message is created, I am redirected to a different page, and I see the message correctly displayed by my template. When the test client goes to the same url, the message is creat...

Django OR Rails

I am an ASP.NET developer, but want to learn other frameworks/language (open source). Django and Rails both seem promising, but I am confused which one I should choose to start, or whether I should choose some other framework. I know learning the language (python or ruby) is a must before starting with Django or Rails. ...

Django model timerange filtering method

I saw the next two method on old question here but it is not clear for me what is the difference between: {'date_time_field__range': (datetime.datetime.combine(date, datetime.time.min), datetime.datetime.combine(date, datetime.time.max))} and YourModel.objects.filter(datetime_published__year='2008', ...

Problem with Django styling

Hi new to django but I'm having issues with the stylesheets (CSS) of pages. my settings.py contains MEDIA_ROOT = '' MEDIA_URL = '' TEMPLATE_DIRS = ( os.path.join(os.path.dirname(__file__), 'templates'), ) please can someone help me shed some light on what I need to do to get the CSS styles working in my templates Thanks ...

Showing updated content on the client

Hi, I have a file on server which is viewed by the client asynchronously as and when required . The file is going to get modified on server side . Also updates are reflected in browser also In my views.py the code is : def showfiledata(request): somecommand ="ls -l > /home/tazim/webexample/templates/tmp.txt" with open("/h...

django manytomany filter question

Hay, I have a Model which looks like this class Person(models.Model): name = models.CharField(blank=False, max_length=100) friends = models.ManyToManyField('self', blank=True, null=True) How would i filter out a Person how has friends? I tried people_with_friends = Person.objects.filter(friends=True) but had no luck. Any...

In django : how to renew expiry date for current session ?

I have a user logged in. How can i extend/renew expiry date of session received from the request ? Thanks in advance! ...

django DateTimeField list records by day

Hay, i have a field in one of my models which saves the creation date of an object created_on = models.DateTimeField(blank=False, auto_now_add=True) This works as expected. In my templates i want to list objects like this June 15 {{ objects here which was created on June 15 }} June 14 {{ objects here which was created on June 14 }}...

How to register a model in django-tagging anywhere not in the applications?

Is it possible to register a model in django-tagging not in tagging app, nor in my app? The standard way is to edit apps/myapp/models.py this way: from apps import tagging tagging.register(MyModel) I want to keep both applications without changes, for example, to be able to pull new versions and just replace them. So I tried putting ...

Get QuerySets from Many2ManyField (include related fields)

Hay, i have a model which houses a board class Board(models.Model): parent_board = models.ForeignKey('self', blank=True, null=True) Each board can belong to another board So say Linux Windows OS X can belong to a board called Computing These boards house a Thread object class Thread(models.Model): board = models.Forei...

Django: how to create sites dynamically?

Hi, I need to create an application for the company where I can create sites dynamically. For example, I need an admin interface (Django's admin is enough) where I can setup a new site and add some settings to it. Each site must hold a domain (domains can be manually added to apache conf, but if Django can handle it too would be awesome...

Django model class and custom property

Howdy - today a weird problem occured to me: I have a modle class in Django and added a custom property to it that shall not be saved into the database and therefore is not represent in the models structure: class Category(models.Model): groups = models.ManyToManyField(Group) title = defaultdict() Now, when I'm within the she...

How to exclude results with get_object_or_404?

In Django you can use the exclude to create SQL similar to not equal. An example could be. Model.objects.exclude(status='deleted') Now this works great and exclude is very flexible. Since I'm a bit lazy, I would like to get that functionality when using get_object_or_404, but I haven't found a way to do this, since you cannot use excl...

Django: How do I go about changing my simple app to use Ajax?

I currently have a web page where the user enters some data and then clicks a submit button. I process the data in views.py and then use the same Django template to return and display the original data and the results. What I would like to do is try to give it a bit more of a modern look and feel. You know the sort of thing, the page doe...