Hello,
I have a more complex dialog within the django admin, which requires a
redirect to an intermediate page, when a certain model is saved. It
seems as the django ModelAdmin does not provide any hooks for this
purpose.
I found a workarround here:
http://joshourisman.com/2008/10/27/modifying-d
Hello,
I have a model that I want to have an optional generic relation to any
other kind of model.
content_type = models.ForeignKey(ContentType, null=True, blank=True)
object_id = models.PositiveIntegerField(null=True, blank=True)
content_object = generic.GenericForeignKey(null=True, blank=Tr
Hi there,
I am using django tagging and have problems adding tags to an object.
There are 2 methods that enable adding a tag:
- add_tag()
- update_tags()
--
for tag in parse_inputs(form.cleaned_data['tags']):
Tag.objects.add_tag(tag)
---
Hi lapain,
yes, this solved the TypeError, but now I am running into a "No such
file or directory".
I opened a new thread:
http://groups.google.com/group/django-users/browse_thread/thread/b0d3e55398f2906d.
Thanks for your answer.
-Toni
--~--~-~--~~~---~--~~
You
Hello, I am using Stdimage in combination with Django 1.0.
Picture(models.Model)
image = StdImageField(upload_to ='multimedia/pictures',
null=True, size=(573, 441), thumbnail_size=(100, 100, True))
...
in my view I do this:
picture = Picture(gallery = gallery, image =
request.
Hello, I am using Stdimage in combination with Django 1.0.
Picture(models.Model)
image = StdImageField(upload_to ='multimedia/pictures',
null=True, size=(573, 441), thumbnail_size=(100, 100, True))
...
in my view I do this:
picture = Picture(gallery = gallery, image =
request.
Hello,
I am using Stdimage instead of the native models.ImageField to have
scaling and thumbnail support. With the former 0.97 release Stdimage
just worked perfect. Now I tried to use it with Django 1.0, and of
course I also updated Stdimage to the newest svn-release.
But when uploading an Image
Hello,
I am using Stdimage instead of the native models.ImageField to have
scaling and thumbnail support. With the former 0.97 release Stdimage
just worked perfect. Now I tried to use it with Django 1.0, and of
course I also updated Stdimage to the newest svn-release.
But when uploading an Image
Hi,
I my scenario users can only edit some model if thy are also the
authors.
With the permission_required_decorator this is not possible.
So what about the user_passes_test-decorator.
I want to do something like this:
def user_can_edit(user, model):
if user.is_authenticated and user == mode
Hi,
I my scenario users can only edit some model if thy are also the
authors.
With the permission_required_decorator this is not possible.
So what about the user_passes_test-decorator.
I want to do something like this:
def user_can_edit(user, model):
if user.is_authenticated and user == mode
Hello, I am trying to use djangos authentication system.
Former I always did the login-stuff manually, but now I stumbled over
the built-in authentication-functionality described in
http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.views.login.
But when I am trying this I got
Hello,
I use a modelchoicefield and want to remove the entry that represents
"no item selected"(--), because in my
scenario I will only allow to select between existing entries.
Is there a way to do this?
Thanks,
-Toni
--~--~-~--~~~---~--~~
You received this
This solved the problem:
http://groups.google.com/group/django-users/browse_thread/thread/63c2058c7892f865
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to dj
With the ModelChoiceFiled you can represent relationships between
models.
So my form looks something like this:
class MyForm(forms.Form):
name = forms.CharField()
trials = forms.ModelChoiceField(...)
According to the documentation I have to pass the queryset to the
modelchoicefield.
But
Is there a way to determine whether the model´s save()-method
performs an insert or an update?
I want to do something like this:
create modelA_Instance --> create modelB_Instance.
So my plan is to do this in the save() from modelA.
--~--~-~--~~~---~--~~
You r
Oh thanks,
I think I have overlooked it :-)
On 2 Sep., 16:35, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
> Wiadomość napisana w dniu 2008-09-02, o godz. 16:23, przez mwebs:
>
>
>
>
>
> > Hello,
>
> > I want to perform a lookup an getting the object with the h
Hello,
I want to perform a lookup an getting the object with the highest
integer value.
The Model looks something like this:
MyModel:
name =
number = models.PositiveIntegerField()
class Meta:
ordering = [-number]
So I figured out this:
highest = MyModel.objects.all()[0]
Is t
When I use the TemporaryFileUploadHandler I get the following
exception:
[Errno 13] Permission denied
The problem is that the temporary-upload files dkhskjds.upload cannot
be deleted
When taking a look on the stack-trace I discovered this:
82. try:
83. os.remove(old_file_name) ...
When I use the TemporaryFileUploadHandler I get the following
exception:
[Errno 13] Permission denied
The problem is that the temporary-upload files dkhskjds.upload cannot
be deleted
When taking a look on the stack-trace I discovered this:
82. try:
83. os.remove(old_file_name) ...
solved :-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For
Hello,
this is more a python-specific problem then a django one.
I have 2 modules
#a.py:
global filebuffer
filebuffer = []
#b.py
print filebuffer
--> filebuffer not defined
___
Do I have to import a.py? but I want to work on the same instance of
filebuffer from both mo
I wrote a custom FileUploadHandler to process uploaded data on the
fly.
My problem is that there are no exceptions raised.
No matter if I am referencing a variable before I assign it, or if I
do something like raise Exception(). The server seems to get stuck.
The Exception does not bubble to the
Hi Karen,
for me it seems very very strange.
The code I used is so simple and theoretical does not contain any
bugs. I deleted every file that I uploaded in a former trial, so I
dont have any file with the - for test purposes static - filename
test.txt in my media-directory.
What happens is what
Thanks for your help.
Datafile is a model and just contains a CharField, a FileField a
ForeignKey and some Booleanfields.
---
class DataFile(models.Model):
name = models.CharField(max_length=255, null = True)
file = models.FileField(upload_to="
Hello,
I wrote a custum Uploadhandler for processing the chunks of an
uploaded file during upload.
class MyFileUploadHandler(MemoryFileUploadHandler):
...
def receive_data_chunk(...):
convert_data(raw_data)
___
def convert_data(...):
raise Exception()
The exceptions
Hello,
I already posted a message describing this problem. For me solving
this problem is very important because I cant proceed for hours.
http://code.djangoproject.com/ticket/8333
in a few words: when I want to upload a file with
temporaryFileUploadHandler than in fact I have 215 copies of the
Hm,
now I have the newest Revision 8618, but still the missbehaviour that
the file is copied in an endless loop.
any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group,
Hi Karen,
yes I also stumbled over this ticket 3 minutes ago.
My Revision is 8423 - so I better check out a new one :-)
Hope this will fix it, but I guess.
Thank you!
Toni
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Gr
Hello,
I have a class that looks like this:
--
class MyUploadHandler(TemporaryFileUploadHandler):
pass
--
my view looks like this:
---
request.upload_handlers = [uploadhandlers.MyUploadHandler()]
datafile = DataFile(...)
dat
Yes,
I tried this but the problem still exists.
it s the same when I do like this:
@permalink
def get_url(self):
return ('experiment_view', (), {'exp_id': self.id})
and the same when I do it like in the example [1]:
def get_url(self):
return ('experiment_view', (), {'exp_id': self.
Hello,
I have a very strange problem with the permalink-decorator:
model:
def get_url(self):
return permalink('experiment_view', (), {'exp_id': self.id})
urls.py:
...
url(r'^(?P\d+)$', 'edit_experiment', name='experiment_view'),
in my template {{exp.get_url}} returns an empty stri
Hello,
I am trying to generate models at runtime. For this purpose I am using
the method create_model() provided at
http://code.djangoproject.com/wiki/DynamicModels
create_model(name, fields, module='app.models' )
When I am doing like this i get a keyError '__module__'
then I tried to pass the
Hello,
I have a serious validation problem with a form using a
ModelSchoiceField.
Forms:
class MyModelChoiceField(forms.ModelChoiceField):
def label_from_instance(self, obj):
return "%s" % obj.name
class PictureForm(forms.Form):
image = forms.ImageField(label='Picture')
Hello,
I try to set data for a ModelChoiceField() manually. This means the
data is not in my db, so it s not in a Queryset.
my form:
class PictureForm(forms.Form):
image = forms.ImageField(label='Picture')
gallery= MyModelChoiceField(models.Gallery.objects.none(),
empty
Thanks Nathaniel,
but where and how do I pass the Queryset? From my view?
I am sorry but I dont understand completly
class MyModelChoiceField(forms.ModelChoiceField):
def label_from_instance(self, obj):
return "My Object #%i" % obj.id
class PictureForm(forms.Form):
image
Hello,
I am trying to do something like this
class PictureForm(forms.Form):
image = forms.ImageField(label='Picture')
gallery= forms.ChoiceField(Gallery.objects.all())
this just works fine, but I only want to pass several Galleries to the
ChoiceField...
something like:
Hi,
thanks for your answer but I already tried this and it returns
something like this:
But I only need the Name of the class. And it seems that __class__
returns the parent class of my model...
is there any other way?
--~--~-~--~~~---~--~~
You received this mes
I have an object that represents a modelClass.
when I do print(obj) then I obviously get something like this:
Is there a way to retrieve only the name of the model?
Thanks, Toni
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Go
I have an object that represents a modelClass.
when I do print(obj) then I obviously get something like this:
Is there a way to retrieve only the name of the model?
Thanks, Toni
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Go
So,
I found the solution for the problem by myslef.
dispatcher.connect(makeSeoble, signal=signals.post_save,
sender=model)
... my makeSeoble method needs to look like this:
def makeSeoble(sender)
:-)
--~--~-~--~~~---~--~~
You received this message because you
Hello,
I am trying soething like this:
dispatcher.connect(makeSeoble(model), signal=signals.post_save,
sender=model)
but I get an exception: cannot create weak reference to 'NoneType'
object
so it seems that you cannot pass a param to your "callback function"
the classical way.
when I am doing
Hi,
It seems as if these signals have to be used in management.py, but
what I need is something I can use directly in my model code.
Something like overloading a method. The fact that this should be
happen in the model-class is very important. E.g I dont want every
model to be registerd in my "me
I saw this an I had no other chance than to join the THANKS-Post.
Django is a revolution for all the webdeveloppers that had a
undesirable life under the lordship of all these php-frameworks.
I LOVE DJANGO, and python too. Poetry pure!
THANK YOU DJANGO-PEOPLE
--~--~-~--~~
I want to register a specific model(not an object of the model, the
model itself) in another model.
This should be done the first time the model is deployed with syncdb.
So what I need is the function that is called the first time a model
is deployed, so that I can extend this function and regist
Wed, Jun 11, 2008 at 3:20 PM, mwebs <[EMAIL PROTECTED]> wrote:
>
> >
> > I want to add a custom validation rule for a newforms form.
> > I could not figure out how to do this. Can someone give me an advice
> > how to do this. thanks, toni
> > >
> >
--
I want to add a custom validation rule for a newforms form.
I could not figure out how to do this. Can someone give me an advice
how to do this. thanks, toni
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django use
Hello,
I have a model that looks like this
class Picture(models.Model):
tags = Tagfield(maxlength=255)
In my view I want to display how many pictures have been tagged with a
specific tag.
In the docs of django-tagging I read about an additional attribute
calles "counts = True". Bu
Hello,
i get an "Error binding parameter 4 - probably unsupported type."-
Interface error
my model looks like this
name = models.CharField(max_length=100, unique = True)
active = models.BooleanField()
image= models.ImageField(upload_to = 'scroller/', null=True)
image_thumbnai
Hello,
I try to deserialize Json.
--
data = request.POST['configuration']
print data
for obj in serializers.deserialize("json", data):
print obj
--
I found the solution:
bla.objects.filter(..).exclude(...)
On 28 Mai, 10:19, mwebs <[EMAIL PROTECTED]> wrote:
> I want to do something like that, but with the Django DB api:
>
> SELECT * FROM foo WHERe name!='Default'
>
> How can I do this without falling
I want to do something like that, but with the Django DB api:
SELECT * FROM foo WHERe name!='Default'
How can I do this without falling back to raw sql.
any ideas?
Thanks Toni
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Goog
I could figure out why this error was thrown.
You have to remove
tagging.register(object)
after that the modelField TagField works perfectly.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To
Hello,
I am using django-tagging and just added a tagging.fields.TagField to
a Model. When running syncdb, everthinks works fine, but
when saving a model-instance I get this error
Error binding parameter 6 - probably unsupported type.
Any idea?
Thanks, Toni
--~--~-~--~~
Yes, I just forgot to import tagging.fields.
Thanks for your help
Toni
On 28 Mai, 08:27, "Alex Ezell" <[EMAIL PROTECTED]> wrote:
> On Wed, May 28, 2008 at 1:21 AM, mwebs <[EMAIL PROTECTED]> wrote:
>
> > Hi Alex,
>
> > I was trying to use this
Hi Alex,
I was trying to use this, but I got an no-attribute-tag-field-error...
I also tried tagging.TagField() and models.TagField()
Any idea?
On 28 Mai, 08:05, "Alex Ezell" <[EMAIL PROTECTED]> wrote:
> On Wed, May 28, 2008 at 1:00 AM, mwebs <[EMAIL PROTECTED]> wrote:
Hello,
I am using the django-tagging application which allows to tag any
instance of any model within your project.
What I want to to is prepopoulate a form with data using :
form = forms.BlaForm(initial = {'description' = a.description, 'tags'
= a.tags} )
My problem is that a.tags returns a li
I am sorry :-) could answer this by googling after "django
Querydict"
__getitem__(key) is the solution.
mwebs schrieb:
> Hello,
>
> I am performing an ajax-post-request.
>
> When I print request.POST I get this: [u'wew'], u'tags': [u'weew
Hello,
I am performing an ajax-post-request.
When I print request.POST I get this:
How can I access the values?
Thanks for your help.
Toni
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
T
Sorry, but this does not work. Maybe I am doing some mistakes.
Could you please post me a snippet?
On 20 Mai, 12:18, Tomás Garzón Hervás <[EMAIL PROTECTED]> wrote:
> Hi, you must use get_list function on QueryDict
>
> mwebs escribió:
>
>
>
> > Hello,
>
> >
Hello,
I am sending JSON to the serverbackend.
When I print reuqest.POST I get .
Thats exactly what I was expecting.
But now I want to access the 'elems'. When I do request.POST['elems']
I get'1'.
But I was expecting getting 2, 1.
Thanks for your help.
Toni
--~--~-~--~~---
I got the solution by myself.
I just used pathon reflection:
getattr(m, field.name) just returned the value of the field.name and
field.name is the name of the ForeignKey.
On 18 Mai, 11:31, mwebs <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have the following problem:
>
Hi,
I have the following problem:
code++
lookUpDict = {sequence:new_sequence, field.name : m.}
++
In this context +field+ is the ForeignKey-Field of a modelObject. With
field.name I get the name of the FK-Field, e.g 'category'. Now I
Hello,
I need something like this:
modelObject.fk// returns the FK-value of the modelObject
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-use
Thank you Scott and Ronny!
This was a great help.
On 17 Mai, 13:20, "Ronny Haryanto" <[EMAIL PROTECTED]> wrote:
> On Sat, May 17, 2008 at 6:11 PM, mwebs <[EMAIL PROTECTED]> wrote:
> > I am using something like this:
>
> > model.objects.filter(field = va
Hello,
I am using something like this:
model.objects.filter(field = variable)
Is it possible to pass the field that is used for the lookup
dynamically, so that field is also a variable ?
Thanks, Toni
--~--~-~--~~~---~--~~
You received this message because you ar
I found the soultion:
news._meta.fields[x].get_internal_type()
this returns 'ForeignKey' if the field is a FK.
On 17 Mai, 12:06, mwebs <[EMAIL PROTECTED]> wrote:
> Thank you,
>
> thats exactly what I was looking for.
> But how can I test if a field is a Fore
Thank you,
thats exactly what I was looking for.
But how can I test if a field is a ForeignKey?
On 17 Mai, 11:01, Matthias Kestenholz <[EMAIL PROTECTED]> wrote:
> On Sat, 2008-05-17 at 00:59 -0700, mwebs wrote:
> > Hi,
>
> > is there any possibility to get the field fr
Hi,
is there any possibility to get the field from a model instance that
speciefies a foreignkey-relationship.
something like this:
news.__foreignKey__ # returns 'category'
Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to t
Perfect!
that is what I was searching for!!!
Thanks, Toni
On 17 Mai, 09:50, Matthias Kestenholz <[EMAIL PROTECTED]> wrote:
> Hi,
>
> On Sat, 2008-05-17 at 00:44 -0700, mwebs wrote:
> > Hi,
>
> > is there any possibility to get the db table name of a
Hi,
is there any possibility to get the db table name of a model instance
at runtime
(news.get_table_name())?
Thanks, Toni
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this grou
Hello,
I want to do something like this:
UPDATE news SET sequence = sequence-1 WHERE sequence > 5
With the database-api I tried the following:
News.objects.filter(sequence__gt = msequence).update(sequence =
sequence-1)
But thats not possible, beacause the assignment parameter sequence-1
must
Hello,
what I need is a modelField that provides sequence-functionality for a
model.
This field should have the following features:
- auto_increment when a new instance of the Model is created
- a method move_up() // Increments the sequence of the object
- a method move_down() // Decreases the se
Hi,
its just the same error when using django.utils.simplejson.
any idea, whats going wrong?
On 13 Mai, 23:30, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> On May 13, 5:11 pm, mwebs <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello,
>
> > I have some problems dese
Hello,
I have some problems deserializing a json.object. I am quite new in
using json, an I think the json is not formatted correctly.
When I print:
request.POST[elems]
I get a String like this: "1,2,3"
But when I try to to do
for elem in serializers.deserialize("json", data ):
I just get a
here'd be a shell command that would allow you to
> drop database tables without having database access since that would be a
> security flaw.
>
> If you reply with which DBMS you're using, we can give you specific
> instructions for how to drop tables.
>
> On Mon,
Hi,
is there anyway to drop all tables without falling back to raw sql. I
mean with an shell command or something like that?
Thank you
Toni
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To p
Mai, 09:15, Alex Morega <[EMAIL PROTECTED]> wrote:
> On May 11, 2008, at 09:58 , mwebs wrote:
>
>
>
>
>
> > In my application I need to build a dynamic menu. For this purpose I
> > have to pass a dict that contains the menu-entries that will be
> > displa
In my application I need to build a dynamic menu. For this purpose I
have to pass a dict that contains the menu-entries that will be
displayed at my index.html
The not elegant way to do this, is to pass the menu-entries in every
view-function. What I want to do is to pass these menu-entries per
78 matches
Mail list logo