I have a model containing items, which has many different fields. There is another model which assigns a set of this field to each user using a m2m-relation.
I want to achieve, that in the end, every user has access to a defined set of fields of the item model, and he only sees these field in views, he can only edit these field etc.
Is ...
http://www.djangobook.com/en/beta/chapter10/
"Note that django.core.exceptions.ObjectDoesNotExist, which is the base class for all Django database API DoesNotExist exceptions, has silent_variable_failure = True. So if you’re using Django templates with Django model objects, any DoesNotExist exception will fail silently."
Whilst I'm dev...
Hi Djangonauts,
I am almost done developing a Django project (with a few pluggable apps).
I want to offer this project as a SaaS (something like basecamp).
i.e: project1.mysaas.com , project2.mysaas.com etc
I seek your expertise in showing me the path.
Ways I have thought of are:
1 use Sites to define site specific settings.py
2 a...
Hi to all!
I have a question regarding editing/saving data in database using Django.
I have template that show data from database. And after each record i have link that link you to edit page.
But now is the question how to edit data in db without using admin panel?
I run thought tutorial in djangobook but i didn't see how to achieve...
Can somebody please explain to me how to properly test Postgres DB errors, particularly IntegrityError. For example i have next test:
class TestSlugs(TestCase):
# This slug must be unique
b = BookPublisher(slug=self.duplicate_slug)
self.assertRaises(IntegrityError, b.save)
#check if there's only one BookPublisher
s...
>>> import psycopg2
Traceback (most recent call last):
File "", line 1, in
File "C:\Python26\lib\site-packages\psycopg2\__init__.py", line 60, in
from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: DLL load failed: The application has failed to start because its si
de-by-side configuration is incorrect. P...
We know about "extend" inheritance tag and inclusion tags. What about the combination of it, like an asp.net grid templates.
Like this:
{% template %}
{% content top %}some html{% endcontent %}
{% content bottom %}some html{% endcontent %}
{% endtemplate %}
UPD:
Is there such tags already developed?
...
Just fishing for ideas here.
Do any of the major template presentation frameworks (such as Smarty, Django) have prebuilt login/security handling? I want to save time on the security handling because it will consume a lot of time to worry about that. I want to build a site from ground up but I dont really want to go so far as starting ...
I want to store which user invited another user to a group... but django is telling me this is ambigous and against the rules (which makes sense).
groups.group: Intermediary model
Group_to_Member has more than one
foreign key to User, which is
ambiguous and is not permitted.
So how do I do this correctly? Maybe a generic rel...
Is there a good way provide user configurable app settings in Django admin?
Basically I would like to have a nice forms where site owner can easily edit such one off information as his contact information, front page text content, etc. Sort of like a normal admin interface of a model, but limited to only one undeletable item in the mode...
Manual example: http://docs.djangoproject.com/en/1.0/topics/forms/formsets/#formset-validation (I'm using Django 1.0.3 to run on Google App Engine)
Code:
from django import forms
from django.forms.formsets import formset_factory
class ArticleForm1(forms.Form):
title = forms.CharField()
pub_date = forms.DateField()
class ArticleFo...
I have theses models:
class Year(models.Model):
name = models.CharField(max_length=15)
date = models.DateField()
class Period(models.Model):
name = models.CharField(max_length=15)
date = models.DateField()
class Notice(models.Model):
year = models.ForeignKey(Year)
period = models.ForeignKey(Period, blank=True, ...
I have a Django model with some fields that have default values specified. I am looking to grab the default value for one of these fields for us later on in my code. Is there an easy way to grab a particular field's default value from a model?
...
Ok, I've tried about near everything and I cannot get this to work.
I have a Django model with an ImageField on it
I have code that downloads an image via HTTP (tested and works)
The image is saved directly into the 'upload_to' folder (the upload_to being the one that is set on the ImageField)
All I need to do is associate the already ...
We have three models, Artist:
class Artist(models.Model):
family_name = models.CharField(max_length=50)
given_name = models.CharField(max_length=50)
Group:
class Group(models.Model):
name = models.CharField(max_length=50)
members = models.ManyToManyField(Artist, through='Membership')
and Membership:
class Membershi...
is there similar syntax to php's $$variable in python? what I am actually trying is to load a model based on a value.
for example, if the value is Song, I would like to import Song module.
I know I can use if statements or lambada, but something similar to php's $$variable will be much convenient.
what I am after is something similar t...
I'm trying to make a Django application to handle events. The view below handles the editing of already created events.
@login_required
def event_admin(request, event_id):
event = get_object_or_404(Event, pk=event_id)
if request.method == 'POST' and request.user == event.organiser:
event_form = EventAdminForm(request.PO...
I have a django project which is laid out like this...
myproject
apps
media
templates
django
registration
sorl
typogrify
I'd like to change it to this...
myproject
apps
media
templates
site-deps
django
registration
sorl
typogrify
When I attempt it the 'site-dependencies' all break. Is there a way to implement this structur...
I've looked at vObject, iCalendar and the official list of CalDAV libraries, including 3 in python. However, I can't find any code that can get me an event object from a given CalDAV (i.e. google, exchange, etc.) server using a username/password. Most of the django calendar related code uses native code libraries and not WebDAV.
An idea...
I have a script which uses the Django ORM features, amongst other external libraries, that I want to run outside of Django (that is, executed from the command-line).
Edit: At the moment, I can launch it by navigating to a URL...
How do I setup the environment for this?
...