Creating an app to track time off accrual. Users have days and days have types like "Vacation" or "Sick"
Models:
DayType
Name
UserDay
Date
DayType (fk to DayType)
Value (+ for accrual, - for day taken)
Note
Total
I'm trying to generate the following resultset expanding the daytypes across columns. Is this possible in the ...
I'd like to build a custom admin action into a model defined by Django. Let's say I wanted to add the action "Activate selected User(s)" on django.contrib.auth.models.User in the Django admin interface. What would be the clean and proper way to accomplish this?
I had a look at the documentation but it's just about implementing admin act...
I have declared models in AppEngine's models.py:
class Post(db.Model):
topic = db.ReferenceProperty(Topic, collection_name='posts', verbose_name=_('Topic'))
(..)
class Topic(db.Model):
(..)
last_post = db.ReferenceProperty(Post, collection_name='last_topic_post')
Problem is ReferenceProperty must have Model class but Topic class is u...
I'd like to check if a certain variable is set inside my template...if it is set, an image will be displayed...I have written this as below in my template, but apparently it's not working.
{% if request.session.chosen_year %}
<a href="/undo_year/">
<img src="{{ MEDIA_URL }}img/undo.gif" border="0" alt="Reset" />
</a>
{% e...
hi folks!
I'm trying to bulk generate 4 thumnails for each of around 40k images with sorl-thumbnail for my django app. I iterate through all django objects with an ImageWithThumbnailsFieldFile, and then call its generate_thumbnails() function.
This works fine, except that after a few hundred iterations, I run out of memory and my loop ...
I am following the tutorial on the DJango site, which I previsouly did using Windows XP and everything went fine, but on Windows 7 I get the following error:
sqlite3.OperationalError: unable to open database file
I use the following:
python manage.py sql Blog
Does any one have any ideas what might be wrong. The database file is lo...
My model is:
class Subscription(models.Model):
user = models.ForeignKey(User, related_name='subscription', editable=False)
following_content_type = models.ForeignKey(ContentType, editable=False)
following_id = models.PositiveIntegerField(editable=False)
following = generic.GenericForeignKey('following_content_type', 'following_id')
cre...
Hi,
I'm using Django's User management in combination with UserProfiles that are linked to the User model with ForeignKeys. Now, I'd like to make fields from the users' profiles searchable from the UserAdmin.
My best guess was to user something like this:
class UserAdmin(auth.admin.UserAdmin):
def field_name(self, obj):
r...
I've followed the Djapian tutorial and setup everything "by the book" so that the indexshell commandline supplied by Djapian shows successful queries.
However, when integrating the sample search from the Djapian tutorial I get this nonsense error:
TemplateSyntaxError at /search/
Caught an exception while rendering: (13, 'Permis...
Trying to work with a trivial navigation menu using django templates, I'm having trouble setting the current class on a particular menu item. Here's my base template:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
...
Is there a GUI tool using which I can design new Django models graphically? For example, drawing lines between fields in different models to indicate a foreign key.
Modifying existing models graphically would also be nice.
...
In django, I'm trying to do something like this:
# if form is valid ...
article = form.save(commit=False)
article.author = req.user
product_name = form.cleaned_data['product_name']
try:
article.product = Component.objects.get(name=product_name)
except:
article.product = Component(name=product_name)
article.save()
# do some more form...
Unless I'm missing something, it seems django-tagging (0.3) doesnt work on Django 1.1.x. I was having issues then search around and it seems to be the general concensious.
What are other people using? Just in case here is all I'm doing.
class Article(models.Model):
title = models.CharField(max_length=200)
tags = TagField()
tag...
After I set a session object, how can I access the value of the given object in my templates?
...
I'm using this code for my pagination, and I'd like the user's choice to be persistent throughout the site (this has been solved so far)...the only problem now is that the session variable now is permanent until the session is cleared by closing the browser. Also, how can I get the adjacent pages displayed...like in the digg-style Djang...
hi i am using django app engine patch i have set up a simple model as follows
class Intake(db.Model):
intake=db.StringProperty(multiline=False, required=True)
#@permerlink
def get_absolute_url(self):
return "/timekeeper/%s/" % self.intake
class Meta:
db_table = "Intake"
verbose_name_plural = "Intake...
Is there an existing plug-in to produce daily or weekly digest emails in Django? (We want to combine many small notifications into one email, rather than bother people all the time.)
Django-mailer claims to support this, but I'm told it doesn't really.
...
Hi,
I am currently working on a bespoke e commerce Django project. The site works fine right up until the part when it passes the card details to Sagepay for processing and then it throws a 500 error and emails me the following:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", lin...
_mysql_exceptions.Warning: Incorrect string value: '\xE7\xB9\x81\xE9\xAB\x94...' for column 'html' at row 1
def getSource(theurl, moved = 0):
if moved == 1:
theurl = urllib2.urlopen(theurl).geturl()
urlReq = urllib2.Request(theurl)
urlReq.add_header('User-Agent',random.choice(agents))
urlResponse = urllib2.urlop...
I have a web site in closed beta, developed in Django, runs with Mysql on Debian.
In the last few days, the main page has been showing a slowdown. For every ten clicks, one or two receives extremely slow response (10 secs or more), others are as fast as they used to be.
When I was searching for the problem, I ran into this issue that ...