Hello,
I am experiencing an inconvenience in regards to working with signals
on model instances with deferred attributes. Specifically I am trying
to get a post_save signal to fire from a save() call on such a model
instance.
The problem is that the sender class (`origin` in
rocess to know what I did.
You could probably just read it from sys.argv ;)
/Christian
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users&q
set DEBUG to False
> - I defined an Admin user and entered my email address
> - I ensured that Postfix is installed and running
>
> Is there anything else I need to do? I will gladly provide any extra
> information to troubleshoot this.
Does postfix receive the e-mail? Check the m
;
> I looked at the queryset API, but it seems that there is no
> alternative to qs.exclude().
What's wrong with exclude() as it is now?
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to
I didn't know about that function. That is certainly prettier
than my "hack" :)
I assumed that was the default behaviour when iterating. There shouldn't
be any need to cache previous items, as there (to my knowledge).is no
way to retrieve previous items from a python iterator.
Regards
jects.all().values_list("id", flat=True)
for obj_id in objs:
obj = Model.object.get(pk=obj_id)
do_something(obj)
... and my RAM usage was below 30 MB at all time.
> Maybe it's getting late and I deserve a nice gin and tonic...
Cheers,
--
Christian Joergensen
http
b=t.techpubcombo.publications_set()
I believe this would work:
publications = Publication.objects.filter(techpubcombo__technology=t)
Regards,
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you ar
the date doesn't
> print. Is there something simple I am doing wrong?
Is `todaysdate` listed in your context?
/Christian
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
&q
What if one of the machines was unresponsive at the time of the upload?
Regards,
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to
'del request.session['percent']'. How do I check to see if
> 'request.session['percent']' has been created?
if 'percent' in request.session:
del request.session['percent']
Regards,
Christian
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~-
'field__iexact' actually come from?
> Is it part of MyModel or somewhere else?
You don't need getattr:
MyModel.objects.filter(**{
my_dict['search_field'] + '__iexact': my_dict['search_value']
})
I believe that will do the trick :)
Regards,
Christian
--
Christian Joergensen
respond to the SQL you are running?
/Christian
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email
burcu wrote:
> Him Team,
>
> i want to set session expiry time in settings.py. Could you please
> help me regarding this case?
http://docs.djangoproject.com/en/dev/topics/http/sessions/#session-cookie-age
--
Christian Joergensen
http://www.tec
vance ma wrote:
> Does the development enterprise application have the available report
> library?
What application? What library?
Regards,
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message becau
o `python manage.py syncdb`, as you have probably
installed the django.contrib.sessions application after you ran a syncdb
the last time.
Regards,
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subscr
sors activated and get any
context processor generated extra context variables available in your
template.
Use the RequestContext as a base context when using render_to_response:
return render_to_response('contact.html', {
'form': form,
}, context_instance=RequestContext(reque
te: var1 | var2 | var3
Another thing is - unless you use the key of the dictionary, a list
might be more appropriate for this ;)
Regards,
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subsc
setting going on in my settings.py file. Is this a python cache
> issue? I've tried pkill python, but doesn't work either. Is there a
> template/web page cache in Django?
No there isn't.
Could you show us the code for your view?
Regards,
--
C
int "album_uri_to_copy is", album_uri_to_copy
album_feed = gclient1.GetFeed(album_uri_to_copy)
More about debugging django here:
http://simonwillison.net/2008/May/22/debugging/
Regards,
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
bundled module in the standard library for python 2.5 (and 2.4)
Regards,
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, s
Lenny wrote:
> Hi!
> How can I assign a value to a model object field where the field name
> in a string?
As with any other python object, you can use setattr:
setattr(instance, "property", "value")
Regards,
--
Christian Joergens
must actually be like ForeignKey(Person
> or Phone or Email or Address or eAddress) .. Any ideas on how to achieve
> this?
Why aren't you using ManyToManyField's? It sounds like that's what
you're trying to emulate ;)
Regards,
Christian
--
Christian Joergensen
http://www.techno
Ethan wrote:
> In my first django project, use the apache server, in the admin page,
> it can't find the css file. and how does the admin css file generate?
http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#id3
--
Christian Joergensen
http://www.technobab
atabase instead,
and not so much whether you should use psyco or pyrex to speed up your
Python code.
Regards,
Christian
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
func is my javascript function which
> handles data from django. but I am mainly confused about url.
`url` is the URL where jQuery will request the JSON data from.
It could be `/json/somefeed/` or whatever you have configured the URL of
your Django view to in urls.py.
Regards,
Christian
--
C
mporting markdown and running the above snippet outside of django
in a python shell. Does that work?
Regards,
Christian
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Googl
ast where your project worked?
/Christian
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send em
rt commands
>>> [line.split()[0] for line in
commands.getoutput("/usr/bin/who").split("\n")]
['razor']
/Christian
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
d at driver
level, but is an application level problem.
Regards,
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group
go idiom.
If you insist, you could probably do (using 0.96):
from django.core.management import syncdb
syncdb()
Regards,
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to th
Ian wrote:
> I am .Net developer looking to switch over to Python.
>
> I have started looking at Django and was wondering if there is a
> widget equivalent to ASP.Net's GridView in terms of richness of
> functionality.
What does ASP.Net's GridView do?
Regards,
--
Christian
Greg wrote:
> Hello,
> I'm trying to add a record to a ManyToMany table in a script.
Use obj.m2mfield.add(related_obj).
/Christian
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subs
ts (root access) for that. So use
sudo og su if you have that kind of access. Else you need to contact
your administrator and have her do the updates for you.
Regards,
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this mess
urns a queryset. Methods on querysets that return
new querysets never raises DoesNotExist.
See which methods that returns what on:
http://www.djangoproject.com/documentation/db-api/
/Christian
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
Y
then
you could just as well import it at the top of the file as you would
otherwise.
* that is, `import ...` not `from ... import ...`.
/Christian
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you
import the model files as modules. That is, you need to do
`import foo.models` in bar/models.py and `import bar.models` in
foo/models.py.
Then you should be able to do `foo.models.Variable.objects...`.
HTH,
Christian
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~
nst the current nfa-branch and finish it off
some day ;-)
Regards,
Christian
--
Christian Joergensen
http://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" g
ere:
http://www.djangoproject.com/documentation/install/
Note the first paragraph of "Install Apache and mod_python". Developing
your applications under mod_python is quite a hassle IMO.
Regards,
--
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.
p?
Don't delete the Teacher.
Instead, I would add a boolean field 'active' to the model and change
the value on delete.
--
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk | Visit us at: http://www.gmta.info
--~--~-~--~~~---~--~~
Y
ng:
[...]
> Exception Type: SyntaxError
> Exception Value: invalid syntax (views.py, line 6)
What's on that line?
--
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk | Visit us at: http://www.gmta.info
--~--~-~--~~~---~
an entry like this in your urls.py:
(r'^events/(?P[^/]+)', 'project.application.views.view')
And in your view collect the slug and look it up:
def view(request, slug):
s = get_object_or_404(Event, slug__exact=slug)
I don't understand why you are talking about forms here :)
--
C
gth=30, choices =
> Choice.filter(""), null=False, blank=False)
Normally, one would use a foreign key in this case:
choice = models.ForeignKey(Choice)
Regards,
--
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk | Visit
w/scripts/cronjobs/mail_editors.py: line
> 5: syntax error near unexpected token `settings'
> /var/www/vhosts/mydomain.at/www/scripts/cronjobs/mail_editors.py: line
> 5: `setup_environ(settings)'
>
> Here´s the test-script:
>
> # coding: utf-8
You're missing the shebang
the template could be used.
Couldn't you just do href="/styles.css" ?
--
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk | Visit us at: http://www.gmta.info
signature.asc
Description: OpenPGP digital signature
David Reynolds wrote:
> Christian,
>
> SmileyChris has a rather cunning application that does just that:
>
> http://smileychris.tactful.co.nz/ramblings/django-documentation/
>
Great, thanks. :)
Regards,
--
Christian Joergensen | Linux, programming or we
?
If anyone else has not done this before, I could start working with
getting it integrated by getting the user to do a `svn export` of the
docs to somewhere before firing up the admin :)
Regards,
--
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk | Visit us
rtconner wrote:
> Oh yeah I also wrote a FlashMsgMiddleware that makes this even easier.
> It's not needed at all, but it'll save you a line of code here and
> there. I can't post it if anyone wants it.
Why not just post it to http://www.djangosnippets.org ? :)
--
Christian Joergense
e onclear on that issue.
I'll go with the DecimalField.
Thank you,
--
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk | Visit us at: http://www.gmta.info
signature.asc
Description: OpenPGP digital signature
lSoup(response.content)
response.content = soup.prettify()
return response
--
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk | Visit us at: http://www.gmta.info
signature.asc
Description: OpenPGP digital signature
Christian Joergensen wrote:
>>> Is it possible to have css classes attached to newforms widgets? I would
>>> like to be able to distinguish between fx. checkboxes, radio buttons,
>>> submit buttons, text fields (which are all 's).
>
>> well, yo
lution if anyone else is interested ;)
Also, please let me know if anyone else have an easier solution to this.
--
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk | Visit us at: http://www.gmta.info
signature.asc
Description: OpenPGP digital signature
uired" to make CSS styling easier.
Am I overlooking something, or is newforms missing this?
--
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk | Visit us at: http://www.gmta.info
signature.asc
Description: OpenPGP digital signature
__setattr__', '__str__', 'capitalize', 'center', 'count',
> 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'index',
> 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle',
> 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind',
> 'rindex', 'rjust', 'rst
ng preventing me from using render_to_response in
> this way?
>
> Any advice welcome - it's driving me crazy!
Could it be a case of tab vs. spaces indentation? What more that Syntax
Error does the django error page tell you?
--
Christian Joergensen | Linux, programming or web consultanc
Russell Keith-Magee wrote:
> On 1/20/07, Christian Joergensen <[EMAIL PROTECTED]> wrote:
>> I suspect there is some django magic happening behind the scenes, and
>> maybe the setattr trick is not at all possible. Can anyone shed some
>> light on this?
>
> Yes
is not at all possible. Can anyone shed some
light on this?
Thank you!
[1] Like: setattr(MyModel, 'foo', models.IntegerField())
--
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk | Visit us at: http://www.gmta.info
signature.asc
Description: OpenPGP
Fabio Gomes wrote:
I m liked the simplicity of generic views, but i can´t find a way to set up
how many rows and cols my textarea have, is there a way to do it?
I believe you can style them using CSS. Please correct me if i am wrong.
--
Christian Joergensen | Linux, programming or web
is that your database
driver does not support unicode. Try to encode it to something.
--
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk | Visit us at: http://www.gmta.info
--~--~-~--~~~---~--~~
You received this message because you
sandro.dentella wrote:
> Hi all,
>
> how can I test from within settings.py if I'm running via mod_python
> or in standalone way? I need to set a variable, accordingly.
You could import os and look in os.environ for differences. Maybe
somthing differs.
--
Christian Joerge
Christian Joergensen wrote:
> You could do a simple:
>
> def my_view(request):
> return render_my_view(request, request.session.LANGUAGE_CODE)
>
> def render_my_view(request, language_code):
> # do stuff
>
> render_my_view = cache_page(render_my_view, ca
experience goes, this isn't possible.
--
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk | Visit us at: http://www.gmta.info
signature.asc
Description: OpenPGP digital signature
rfectly.
>> Gave me a speedup factor of about 250k :)
>>
>> Thanks,
>
> Alternatively you could use the normal django syntax:
> Country.objects.filter(soccerteam__name__isnull=False)
But the thing is, I can have multiple SoccerTeam relations. Doesn't that
rule out this sol
soccerteam.country_id = appname_country.id) > 0']
> )
Great idea! I did not think about the 'extra' method. Works perfectly.
Gave me a speedup factor of about 250k :)
Thanks,
--
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk | Visit us at: http://www.gmta.info
signature.asc
Description: OpenPGP digital signature
lly need to use custom SQL here, or does the django ORM provide
the means to solve this problem?
Thanks,
--
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk | Visit us at: http://www.gmta.info
signature.asc
Description: OpenPGP digital signature
64 matches
Mail list logo