I tried getting these frameworks working on Windows Vista for a couple of days but to no avail.
Every single time I thought I had them working I would get some random error involving the PostgreSQL or MySQL setup, or the paths were screwed up or some other command line error "not recognized as an internal or external command" (or somet...
I am working on creating a website in Django which consists of two parts: the website itself, and the forum. They will both be on separate domains, i.e. example.com and exampleforum.com. How can this be done in Django, when the forum and main site are part of the same instance?
...
I would like to comment this with a line
{% if something.property %}
<table>
<tr>...
{% # this is a comment %}
{% if something.property %}
<table>
<tr>...
...
I want to apply the "ordering" Meta option to the Django model User from django.contrib.auth.models. Normally I would just put the Meta class in the model's definition, but in this case I did not define the model. So where do I put the Meta class to modify the User model?
...
I am trying to use the Django sessions to read and set my cookies, but when i do the following the program just does not respond!
sessionID = request.session["userid"]
The program does not pass this point!
Any ideas?
...
I'm using site wide caching with memcached as the backend. I would like to invalidate pages in the cache when the underlying database object changes.
If the page name changes then I would invalidate the whole cache (as it affects navigation on every page. Clumsy but sufficient for my needs.
If just the page content changes then I'd li...
Hi all.
I would like to merge one querysets related objects with another querysets related objects.
Some sample code to explain:
## Models
# sample models to illustrate problem
class PetShop(models.Model):
id = models.AutoField(primary_key=True)
shop_name = models.CharField(maxlength=255)
cats = models.ManyToManyField(Cat)
...
Hi stack overflow,
I guess this is a really novice question, still I'm having trouble with django templates and CharField models.
So I have a model with a CharField that creates a slug that replaces spaces with underscores. If I create an object
Somename Somesurname this creates slug Somename_Somesurname and gets displayed as expected ...
I'm not expierenced in python.
I need to define field 'year' with range restriction. Now i'm using this code, but I think there exists shorten way to do this.
YEAR_CHOICE = []
for year in range(2020,1899,-1):
YEAR_CHOICE += [(year, year)]
year = models.PositiveSmallIntegerField('Year', choices=YEAR_CHOICE, default=0)
Is therу any w...
A company I'm looking at claims to have made the website for an airline and a furniture store using Django, but when I look at the sites, there is no indication what the underlying web technology is. How can you tell?
...
I would like to do a SUM on rows in a database and group by date.
I am trying to run this SQL query using Django aggregates and annotations:
select strftime('%m/%d/%Y', time_stamp) as the_date, sum(numbers_data)
from my_model
group by the_date;
I tried the following:
data = My_Model.objects.values("strftime('%m/%d/%Y',
...
I am a beginner in developing websites by Django.
I run small discussion websites similar to SO.
I have an account at Bluehost which has been a nightmare in developing by Django.
I have found that Webfaction and Google App Engine seems to be the best choices for Django.
However, I am not sure which one is the best for me.
Is Google Ap...
I am trying to test the codes of the project.
I run the following code
$appcfg.py update masicode/
I get the following error
Scanning files on local disk.
Initiating update.
2009-04-06 21:58:42,401 ERROR appcfg.py:1235 An unexpected error occurred. Aborting.
Traceback (most recent call last):
File "/Applications/Coding/Google...
I have a blog-like application with stories and categories:
class Category(models.Model):
...
class Story(models.Model):
categories = models.ManyToManyField(Category)
...
Now I know that when you save a new instance of a model with a many-to-many field, problems come up because the object is not yet in the database. This ...
I'm using django and jquery to implement authenticated sessions and Ajax requests.
I have authenticated session timeouts to log authenticated users out after a long period of inactivity on my site. Some of the pages on my site have a lot of AJAX calls in them that require the user to be in an authenticated session. When a user leaves ...
Hi all,
in my Django app i have a Newsletter model. Now I'd like to be able to send the newsletter (and even resend it) from Django Admin.
I could do this with a hook on the Model.save() method but is there another way that is not tied to the Model?
Thanks
...
I have a model with field:
class Movie(models.Model):
genre = models.CommaSeparatedIntegerField(max_length=100, choices=GENRE_CHOICES, blank=True, default=0)
lang = models.CommaSeparatedIntegerField(max_length=100, choices=LANG_CHOICES, blank=True, default=0)
And I need to get multiple select fields (not checkboxes) from that....
Does a plugin exists for Python/Django into Dreamweaver? Just wondering since Dreamweaver is a great web dev tool.
...
I want to save some text to the database using the Django ORM wrappers. The problem is, this text is generated by scraping external websites and many times it seems they are listed with the wrong encoding. I would like to store the raw bytes so I can improve my encoding detection as time goes on without redoing the scrapes. But Django se...
Hi,
I found a link to have a 'switch' tag in Django templates, but I was wondering if this can be somehow achieved without it. Using only the stuff which comes with Django? Basically is there other way then using multiple 'if' or 'ifequal' statements?
Thanks in advance for any tips/suggestions.
...