Ok, imagine a typical scenario, - there is a thread object and comments, attached to it. It can be expressed in django ORM's terms very roughly like this:
class Thread(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=255)
class Comment(models.Model):
id = models.AutoField(primary_key...
Hello,
is there some pythonic way to load a django app trough an alias name? This I think would be one way to make an app more "pluggable-friendly".
there is a pattern used in settings.py:
INSTALLED_APPS = ('... ','...', )
where INSTALLED_APPS is a tuple containing names of apps.
That's fine, but I don't want to put in certain apps ...
I am trying to find the best way (most efficient way) to return large files from Django back to an http client.
receive http get request
read large file from disk
return the content of that file
I don't want to read the file then post the response using HttpResponse as the file content is first stored in RAM if I am correct. How can ...
I'm building a Blog in Django (using Generic Views) and I use the same template for both my date based and list detail views. I'm trying to setup pagination, but I want to do so with URL patterns rather than using an ugly ?page=1 url suffix.
The problem is in the actual html template, I cannot find a way to determine which view was used...
I have the following models:
class Territory(models.Model):
name = models.CharField(max_length=30)
power = models.ForeignKey(Power, null=True, blank=True)
is_supply = models.BooleanField()
class Subregion(models.Model):
territory = models.ForeignKey(Territory)
subname = models.CharField(max_length=10, blank=True)
...
When researching Google App Engine (GAE), it's clear that using Django is wildly popular for developing in Python on GAE. I've been scouring the web to find information on the costs and benefits of using Django, to find out why it's so popular. While I've been able to find a wide variety of sources on how to run Django on GAE and the v...
Hi,
This is a framework/programming language challenge. I'm looking for programming language that would be best approach for the next project. I want to get some score (out of 10) of their Time to Develop, Scalability, and Security.
Form Builder that will read and write to Database(MYSQL)
User Authentication and User Management
Easy f...
Hi,
I want to create dynamic menus according to user permissions. As was already discussed here and by the the documentation itself, I know that I can achieve this in the templates using the following snippet:
{% if perms.polls.can_vote %}
<li>
<a href="/polls/vote">Vote</a>
</li>
{% endif %}
But the problem is that f...
I'm not sure but I believe that Python is -next to Objective-C- somewhat natural to Mac OSX and the Xcode IDE. I might be wrong. So is it a good idea to use Xcode for Django / Python web development when I'm already a bit familiar with Xcode? Actually I only do iPhone dev with it, but now I need a website and I stumbled over Django / Pyt...
Hi, I'm trying to redirect to a swf file because I need to embedd that in a fb:swf which wants its absolute path. When I handle the swf in url's somehow it doesn't work.
In url.py
(r'^flash/','lastproject.yofacebook.flashtest.flash'),
In flahstest.flash
def flash(request):
return render_to_response('as3.swf')
I want to open the ...
I want to integrate my Django web application with other web based products (most likely 3rd party non-django applications.) How can I let other sites sign in their users to my site with a single sign-on? How would I store the usernames and passwords for the 3rd party sites users securely on my site to sign on my users to the 3rd part ...
Hi.
I have model like this:
class Kaart(models.Model):
name = models.CharField(max_length=200, verbose_name="Kaardi peakiri", help_text="Sisesta kaardi pealkiri (maksimum tähemärkide arv on 38)", blank=False, null=False)
url = models.CharField(max_length=200, blank=False, null=False, verbose_name="Asukoha URL", help_text="Täisa...
Hi,
I would like to create dynamically the destination of my uploaded files.
But, it seems that the 'upload_to' option is only available for a models, not for forms. So the following code is wrong.
class MyForm(forms.Form):
fichier = forms.FileField(**upload_to='files/%m-%Y/'**)
In the view handling the uploaded file, the ...
The Django docs (http://docs.djangoproject.com/en/dev/topics/testing/#django.test.client.Client.post) say to do this:
>>> c = Client()
>>> f = open('wishlist.doc')
>>> c.post('/customers/wishes/', {'name': 'fred', 'attachment': f})
>>> f.close()
But when I do that the field has the error message "The submitted file is empty." That sme...
Im getting strangest error in django so far:
'if' statement improperly formatted
Template that raises the error is this:
{% if diff >= 0 %}
<span class="pos">+{{ diff }}
{% else %}
<span class="neg">-{{ diff }}
{% endif %}
</span>
<span>{{ a }}</span>
view that has a and diff in context is this:
def add(request, kaart_id):
if ...
why does model.diff return 18446744073709551615 in template, when model is like this and model.pos is 0 and model.neg is 1?:
class Kaart(models.Model):
neg = models.PositiveIntegerField(default=0)
pos = models.PositiveIntegerField(default=0)
def diff(self):
return self.pos - self.neg
...
Hi
I need to add key/value to queryset per each object based on stuff in request.session.
How to do that?
Alan
...
I need to attach a significant number of additional properties to every user in my Django project. Some of these properties are simple CharFields, others are more complex ManyToManyFields. The trouble for me, is that in my digging around of ways to do this, I've found two options: The user profile method explained in the documentation,...
hi, I'm trying to render a string into a javascript ( which usually works fine for me ) here's my code
HTML:
THE USER NAME IS : {{name}} has added app {{has_added_app}}
JAVA SCRIPT:
<script>
<!--
var userName = {{name}}
The html version works the javascript fails when I have tried the same rendering in javascript before an...
Hello, I need some help with sending email when an order is placed. To illustrate the problem, following is the abstract code:
class Order(models.Model):
user = models.ForeignKey(User)
class OrderItem(modes.Model):
order = models.ForeignKey(Order, related_name='items')
item = models.CharField(max_length=255)
unit_price ...