Hi!
I am deploying my django application on a server, and on last stages I am getting this error:
ExtractionError at /admin/
Can't extract file(s) to egg cache
The following error occurred while trying to extract file(s) to the Python egg
cache:
[Errno 13] Permission denied: '/.python-eggs'
The Python egg cache directory is current...
I'm trying to make the following fit in the Django ORM. Having a Publish model which manages the publication of different kind of types of content (other models). This so I can easily do Publish.objects.all() and order them by date. I made a generic model as the following:
class Publish(models.Model):
""" Intermediary model for disp...
I'm installing Django on Bluehost and one of the steps to install it was to install flup on their server. I did so and everything works great when I'm logged in via the SSH. However when I actually hit the page in my browser it can't find flup. I get this error in the server log:
ERROR: No module named flup. Unable to load the flup p...
I have a custom model manager that looks like this:
class MyManager(models.Manager)
def get_query_set(self):
'''Only get items that are 'approved' and have a `pub_date` that is in
the past. Ignore the rest.'''
queryset = super(MyManager, self).get_query_set()
queryset = queryset.filter(status__in=('a...
I need to do something like
{{ article.product.images.first.image.url }}
In my template, but there is no "first" (images is a RelatedManager for which I found very little documentation).
Is there another way to do this? I can get the first model with
{{ article.product.images.get_query_set|first }}
But then I need to dig a few pro...
I am currently working through the tutorial on Django's website. Upon completing the following command:
python manage.py startapp polls
it creates the following structure:
polls/
__init__.py
models.py
tests.py
views.py
As I was going through the tutorial it occurred to me that the views file could grow to this huge ...
I need to populate my database with a bunch of dummy entries (around 200+) so that I can test the admin interface I've made and I was wondering if there was a better way to do it. I spent the better part of my day yesterday trying to fill it in by hand (i.e by wrapping stuff like this my_model(title="asdfasdf", field2="laksdj"...) in a b...
Django lays out the mapping of Django model data types to Django form widgets nicely here, but I can't find a similar mapping for Google App Engine data types. For instance what does a db.TextProperty() map too and how would I know that?
...
I created a form class based on a model:
class MyModel(models.Model):
increasing_field = models.PositiveIntegerField()
class MyForm(forms.ModelForm):
class Meta:
model = MyModel
I created a form to change an existing MyClass instance using POST
data to populate the form:
m = MyModel.objects.get(pk=n)
f = MyForm(reque...
I created a Django app that had its own internal voting system and a model called Vote to track it. I want to refactor the voting system into its own app so I can reuse it. However, the original app is in production and I need to create a data migration that will take all the Votes and transplant them into the separate app.
How can I ...
Consider the following situation: -
Suppose my app allows users to create the states / provinces in their
country. Just for clarity, we are considering only ASCII characters
here.
In the US, a user could create the state called "Texas". If this app
is being used internally, let's say the user doesn't care if it is
spelled "texas" or "T...
I'm building a Django app, which I comfortably run (test :)) on a Ubuntu Linux host. I would like to package the app without source code and distribute it to another production machine. Ideally the app could be run by ./runapp command which starts a CherryPy server that runs the python/django code.
I've discovered several ways of doing ...
Using Django 1.1, how could I create a crosstab (pivot table) SQL query using the ORM?
UPDATED:
These are the models and output requirements:
class Store(models.Model):
name = models.CharField(max_length=255)
...
class Order(models.Model):
store = models.ForeignKey(Store, blank=True, null=True, related_name='orders')
description =...
Is there a easy way to add a search capability on fields in Django? Also please let me know what is Lucene search.
...
when i print the sql generated in connection.queries:
i found some sql like this:
SELECT (1) AS `a` FROM `auth_user` WHERE `auth_user`.`id` = 2
what's that mean?
...
Hi all,
I'm using a Modelform for User to edit first_name and last_name, but I want an extra field from UserProfile (which has a 1-to-1 relation with User) added to this.
class UserProfileInfoForm(forms.ModelForm):
""" Profile Model field specifications for edit.
"""
class Meta:
model = User
fields = ('firs...
I want to create a search box in Django that is situated at the URL /search, and redirects to a friendly URL like /search/queryterm - rather than having ?q=queryterm in the URL)
So the user types in a query term, it takes them to /search/queryterm, and shows a list of results.
I can get and display the results OK given a URL like /sear...
Can I use a variable declared in the Django project's settings.py in one of my module files?
For instance, using DATABASE_HOST = 'databasename' ?
I'm trying to get the name of the server the application is currently deployed on you see.
...
Hi. I've got a problem here with a join and pagination. I have 3 Models:
Pad
Tag
TagRelation
I use Tag relation to manage a ManyToMany relationship betweent Pads and Tags (with the through attribute of te ManyToMany field).
Now when i do a join on the Pad and Tag tables it gives me something like this...
pad.name tag.name etc
...
I don't see any possibility for creating a table in django-cms. I need this functionnality so I am evaluating the possibility to write my own plugin.
I am getting started with this product. I've read the documentation carefully and I see more or less how to do that.
However, I would be happy to hear some tips and tricks before starting...