Django Migrations: Converting a PK field to ID + PK for Multi-table Inheritance

2020-09-22 Thread Julian Klotz
Dear Django community,

in a project, I’m struggling to fix a problem with my database schema and 
data migrations.

Here’s what I want to do:

My application used to have a “Person” model. As time went by, it turned 
out that we would also need an model for “Organization”. Both should 
inherit the (non-abstract) model “Actor”, that holds attributes that are 
common between Organizaztions and Persons.

That’s what it should look like in the end:

class Actor(models.Model):
# Actor is new!
name = models.CharField(...)

class Organization(Actor):
 # organization is new, too!
 # organization attributes ...

class Person(Actor):
biography = models.TextField(...)

To keep existing data, I created an Actor-instance for each person (using 
the person’s PK value) and used a data migration to copy the attribute 
values that are common for both Organiation and Person to Actor.

Next, I turned the Person model’s PK field into a PK + FK field, thereby 
linking it with the Actor table:

class Migration(migrations.Migration):
dependencies = [
('resources', 'xxx'),
]

operations = [
migrations.RenameField(
 model_name='person',
 old_name='id',
 new_name='actor_ptr_id',
)
migrations.AlterField(
model_name='person',




*name='actor_ptr_id',
field=models.OneToOneField(auto_created=True, default=0, 
on_delete=django.db.models.deletion.CASCADE,
   
parent_link=True, primary_key=True, serialize=False, 
to='resources.Actor',   
db_column='actor_ptr_id'),preserve_default=False*
),
]


My Django app does everything it should – data from both tables (persons 
and actor) are join when loading person instances from the database.

Here’s the hard part:

Whenever I run ./manage.py makemigrations now, a new migration is created. 
The migration first drops my *actor_ptr_id field and then re-creates it* 
(see migration code below). This is quite annoying, because it would break 
the links between actor and person table. The point seems to be that Django 
doesn't accept creating xxx_ptr_id links manually. Any ideas how to prevent 
Django from re-creating this migration over and over again?

class Migration(migrations.Migration):

dependencies = [
('resources', 'xxx'),
]

operations = [
migrations.RemoveField(
model_name='person',
name='actor_ptr_id',
),
migrations.AddField(
model_name='person',
name='actor_ptr',
field=models.OneToOneField(auto_created=True, default=0, 
on_delete=django.db.models.deletion.CASCADE, parent_link=True, 
primary_key=True, serialize=False, to='resources.actor'),
preserve_default=False,
),
]

Thanks for any ideas and help!

Best regards
Julian

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7577e3de-a20e-455a-8931-a04728209900n%40googlegroups.com.


Re: What's the Better approach to do these?

2018-08-19 Thread Julian
Hello Fellipe,

sounds like you're developing a multi-tenancy webapp. Maybe 
https://github.com/bernardopires/django-tenant-schemas is the right tool 
for you.

Regards,
Julian

Am Sonntag, 19. August 2018 17:29:16 UTC+2 schrieb Fellipe Henrique:
>
> Hello,
>
> I need to build a system.. each user will be a customer.. and each 
> costumer will be products and sales...
>
> I do not want to build a system, and create "sub-domais" and for each 
> sub-domains a create a "new" clone of my system... it's hard maintenance..
>
> I think these:  each model, I create a FK, and change the Model Manager, 
> to filter all query with User ID... so, show only models to each User.. 
> (thanks for help me here on these)
>
> But I found a issue... for each record, django will use ID.. so, for 
> example:
>
> User 1  - Product 1 - Product ID: 1
> User 1  - Product 2 - Product ID: 2
> User 2  - Product 1 - Product ID: 3
> User 3  - Product 1 - Product ID: 4
>
> Any idea how to do that better?!
>
> Thanks!
> T.·.F.·.A.·. S+F
> *Fellipe Henrique P. Soares*
>
> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 
> 's/(.)/chr(ord($1)-2*3)/ge'
> *Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh 
> <https://fedoraproject.org/wiki/User:Fellipeh>*
> *Blog: *http:www.fellipeh.eti.br
> *GitHub: https://github.com/fellipeh <https://github.com/fellipeh>*
> *Twitter: @fh_bash*
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/953c1fff-e3bb-4eba-b621-5e5a7b2be1fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Intuition about (potentially) sending multiple password reset emails

2014-12-03 Thread Julian Gindi
I'm working with Django's built-in password reset capabilities, and noticed 
this curious line...

https://github.com/django/django/blob/master/django/contrib/auth/forms.py#L231

can someone explain the intuition behind this line? It seems weird to 
potentially send multiple password reset emails. Is this expected behavior? 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/57a0dbdf-a68d-49cb-b4df-20dc04fe7d59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: URLField and Web Sockets URLs

2012-10-05 Thread Julian Cerruti
Thanks Kurtis and Russ.

For now, since this is a very minor feature of my app, I decided to go the 
easy route and turn my field into a CharField.

When I get some more time I will try to exercise the contribution mechanism 
as a way to get more familiarized with it.

Thank you guys both for your orientation.

Best,
Julian

On Thursday, October 4, 2012 5:43:41 PM UTC-3, Kurtis wrote:
>
> Looks like this is similar and shows that people want other protocols as 
> well: 
> http://stackoverflow.com/questions/8778416/what-are-the-valid-values-for-a-django-url-field
>
> You could modify the validator's regex but I imagine the cleanest way to 
> do this would be to make a copy of it in your own code base and modify/use 
> accordingly.
>
> I'm not sure on the best way to make proposals. Hopefully someone else can 
> chime in there for you.
>
> On Thu, Oct 4, 2012 at 12:51 PM, Julian Cerruti 
> <jcer...@willowgarage.com
> > wrote:
>
>> Apparently the current implementation of URLField rejects Web Sockets 
>> URLs such as ws://my.server.com/
>>
>> This seems to be due to the implementation of the underlying 
>> URLValidator, which has a regex to search for ftp or http based URLs only.
>>
>> Is there any chance the URLValidator regexp can be updated to include ws 
>> as a valid protocol qualifier too?
>>
>> Also, more generally, what is the recommended procedure for proposing 
>> changes (and accompanying code) such as this?
>>  
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/ap-_kaacEngJ.
>> To post to this group, send email to django...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> django-users...@googlegroups.com .
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ZfZtVrajjvEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



URLField and Web Sockets URLs

2012-10-04 Thread Julian Cerruti
Apparently the current implementation of URLField rejects Web Sockets URLs 
such as ws://my.server.com/

This seems to be due to the implementation of the underlying URLValidator, 
which has a regex to search for ftp or http based URLs only.

Is there any chance the URLValidator regexp can be updated to include ws as 
a valid protocol qualifier too?

Also, more generally, what is the recommended procedure for proposing 
changes (and accompanying code) such as this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ap-_kaacEngJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Test DB Connection

2011-10-14 Thread Julian Hodgson
I've go some python modules which automatically connect to the database then
they are loaded beacuse they  have an __init__.py with

from django.core.management import setup_environ

import passion.settings

def loadSettings():
s = setup_environ(passion.settings)
print s

# this should only be run from the workbox not on the server
loadSettings()

This works fine even when it can't connect.

But later if I do:

from passion.cg.models import *
users = User.objects.filter( username='julian')
print users

then I get

# OperationalError: (1044, "Access denied for user ''@'localhost' to
database 'djangostack'")
#  - [line 3]

So I need a way to test the connection before trying to use the django
models.

I can just check for exceptions, but is there a better way?

Julian

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Model caching per python session

2011-08-23 Thread Julian Hodgson
FYI: this does the trick:

from django.db import connection
connection.close()



On Tue, Aug 23, 2011 at 12:29 AM, Julian Hodgson <
julian.of.lon...@googlemail.com> wrote:

> Ok, that makes sense.
>
> The thing is, we've written some python plugins for Softimage to read and
> write to the db that get loaded and stay in memory.   When the plugins are
> loaded, the django models are imported.  So during the lifetime of the host
> application, the python session is the same.
>
> So I really need a way of closing the transaction or flushing the sql in
> django,  without starting a new python session.
>
> Any ideas warmly received.
>
> Julian.
> On Aug 22, 2011 8:30 PM, "Daniel Roseman" <dan...@roseman.org.uk> wrote:
> > On Monday, 22 August 2011 17:16:24 UTC+1, Julian Hodgson wrote:
> >>
> >> Hi there,
> >>
> >> I'm running a production linux django server using wsgi, and have found
> the
> >> following issue. Django version (1, 2, 5, 'final', 0).
> >>
> >> If I open a python shell I get:
> >>
> >> >>> from passion.cg.models import *
> >> >>> print Sequence.objects.all()
> >> [, , , ]
> >>
> >>
> >> But if I go into the admin and delete sequence DD, leaving the python
> >> session running, then I still get
> >>
> >> >>> print Sequence.objects.all()
> >> [, , , ]
> >>
> >> so the Sequence table doesn't appear to be updated as far as the model
> is
> >> concerned.
> >>
> >> It's pretty fundamental that this can be resolved since many different
> >> users will be using the database at the same time, and it should be
> possible
> >> for each user to see the latest state of the DB.
> >>
> >> Any suggestions welcomed.
> >>
> >> Cheers,
> >>
> >> Julian
> >>
> >
> > This isn't anything to do with caching. It's a result of the fact that
> the
> > shell session is running within a single transaction, and therefore
> doesn't
> > see changes from outside that. If you quit the shell and restart it,
> you'll
> > be able to see the change.
> >
> > This isn't a problem in production, because transactions in views are
> tied
> > to the request/response cycle, which is short-lived.
> > --
> > DR.
> >
> >>
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/qX11CSPon3MJ.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



What is Django?

2011-08-23 Thread Julian
Is there any document available that describes WHAT Django is? I am
not looking for an installation guide, neither for tutorial, nor for
"Django is a high-level Python Web framework". But: What does this
framework include? What is it used for? How does it increase
productivity? Why shouldn't I use directly Python to create web apps/
pages? How could a sample app look like (without giving source code)?

Such explanations would be extremely helpful and maybe even worth to
be linked into https://www.djangoproject.com/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Model caching per python session

2011-08-22 Thread Julian Hodgson
Ok, that makes sense.

The thing is, we've written some python plugins for Softimage to read and
write to the db that get loaded and stay in memory.   When the plugins are
loaded, the django models are imported.  So during the lifetime of the host
application, the python session is the same.

So I really need a way of closing the transaction or flushing the sql in
django,  without starting a new python session.

Any ideas warmly received.

Julian.
On Aug 22, 2011 8:30 PM, "Daniel Roseman" <dan...@roseman.org.uk> wrote:
> On Monday, 22 August 2011 17:16:24 UTC+1, Julian Hodgson wrote:
>>
>> Hi there,
>>
>> I'm running a production linux django server using wsgi, and have found
the
>> following issue. Django version (1, 2, 5, 'final', 0).
>>
>> If I open a python shell I get:
>>
>> >>> from passion.cg.models import *
>> >>> print Sequence.objects.all()
>> [, , , ]
>>
>>
>> But if I go into the admin and delete sequence DD, leaving the python
>> session running, then I still get
>>
>> >>> print Sequence.objects.all()
>> [, , , ]
>>
>> so the Sequence table doesn't appear to be updated as far as the model is

>> concerned.
>>
>> It's pretty fundamental that this can be resolved since many different
>> users will be using the database at the same time, and it should be
possible
>> for each user to see the latest state of the DB.
>>
>> Any suggestions welcomed.
>>
>> Cheers,
>>
>> Julian
>>
>
> This isn't anything to do with caching. It's a result of the fact that the

> shell session is running within a single transaction, and therefore
doesn't
> see changes from outside that. If you quit the shell and restart it,
you'll
> be able to see the change.
>
> This isn't a problem in production, because transactions in views are tied

> to the request/response cycle, which is short-lived.
> --
> DR.
>
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/qX11CSPon3MJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Model caching per python session

2011-08-22 Thread Julian Hodgson
Hi there,

I'm running a production linux django server using wsgi, and have found the
following issue. Django version (1, 2, 5, 'final', 0).

If I open a python shell I get:

>>> from passion.cg.models import *
>>> print Sequence.objects.all()
[, , , ]


But if I go into the admin and delete sequence DD, leaving the python
session running, then I still get

>>> print Sequence.objects.all()
[, , , ]

so the Sequence table doesn't appear to be updated as far as the model is
concerned.

It's pretty fundamental that this can be resolved since many different users
will be using the database at the same time, and it should be possible for
each user to see the latest state of the DB.

Any suggestions welcomed.

Cheers,

Julian

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Initial save()

2011-03-12 Thread Julian Hodgson
I need to set up some default values on a ManyToMany field only when a model
is first created.

How can I find out in the save() override if the object is being created for
the first time?

Do I check the table for rows which have self.id or is this not defined till
after the save?

Julian

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Server HTTP Client

2011-03-03 Thread Julian
Hmm, yeah I heard about that. I was hoping to get something in Python.  So I'm 
can stay with one technology and language. 



On Mar 3, 2011, at 3:47 PM, Marwan Al-Sabbagh wrote:

> mechanize is a very powerful library that can help you do this stuff. the 
> project page is at http://wwwsearch.sourceforge.net/mechanize . I've used it 
> in my work place and it works quite well.
> 
> cheers,
> Marwan
> 
> On Thu, Mar 3, 2011 at 9:59 PM, Julian <j...@itree.org> wrote:
> Hi,
> 
> Is there anything on in Python or Django that can be used as a server
> side HTTP Client. Something like  HTTP Unit and jsdom from NodeJS.
> 
> I'm trying to log into some custom site and scrap the data from them.
> It would be a plus if the client also support javascript.
> 
> Thanks.
> 
> 
> Julian
> 
> --
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 
> -- 
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Server HTTP Client

2011-03-03 Thread Julian
Hi,

Is there anything on in Python or Django that can be used as a server
side HTTP Client. Something like  HTTP Unit and jsdom from NodeJS.

I'm trying to log into some custom site and scrap the data from them.
It would be a plus if the client also support javascript.

Thanks.


Julian

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



TypeError: unhashable type: 'ManyToManyField'

2011-02-24 Thread Julian Hodgson
I'm getting this error message when I try to validate even a brand new
project and application.

Does this ring any bells with anyone?

Windows XP 64
I'm using Django 1.1.1 (but it still happens with 1.1.4)
Python 2.6 (winxp 64)

In my actual database I can only connect when I remove by ManyToMany
fields.

I don't mind hacking the code to fix this but I need some pointers as
to what's happening!

Check here for the error:

http://dpaste.com/444668/

Best,

Julian

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



combine two testrunner

2010-10-06 Thread Julian
Hi,

I'm testing an app doing it with django-nose.NoseTestSuiteRunner. Now
I want to use django-coverage by default, it got an own test-runner
function. Is there a way to concat those two testrunner? ATM I'm doing
it as follows:

from django_nose import NoseTestSuiteRunner

def runtests(*test_args):
if not test_args:
test_args = ['tracking.tests']
parent = dirname(abspath(__file__))
sys.path.insert(0, parent)
nosetestsuite = NoseTestSuiteRunner(verbosity=1, interactive=True,
failfast=False)
failures = nosetestsuite.run_tests(test_labels=test_args)

sys.exit(failures)

the runtests-function is set as test_suite in my setup.py.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: overriding the admin's template sucks

2010-09-20 Thread Julian
thanks for that simple solution, but I'm very reluctant to do this,
because putting template-logic in python-files reminds me of my PHP-
days. nevertheless, it's a quick way to solve my problem.

another problem will be to remove the admin-action-checkbox, because
it's displayed even though I'm not displaying the admin-action-
selectboxes.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



overriding the admin's template sucks

2010-09-20 Thread Julian
Hi,

I want to display a customized table for a model in the admin. I've
just written a customized filter, which works very well.

The problem: My model has a field 'timestamp' which is a
datetimefield. It may be null, so in the admin it's displayed as
'(None)'. I want to replace '(None)' with 'All'. The problems:

- In change_list.html the table is not generated. It's generated in
change_list_results.html. Well, the first one may be put in myapp/
templates/myapp/mymodel/ and overwrites the default one. The latter
one not.
- So I have to write a custom template tag, which uses 'admin/
templatetags/admin_list/result_list', just to tell it which custom
template to use.
- Then I realize that the whole

(None)

is NOT generated in a template but anywhere deep down in some python
code. It's not that there's a

{% if not result.value %}
(None)
{% endif %}

which I could replace with

{% if not result.value %}
All
{% endif %}

(or similar), but it seems I have to write my own customized
items_for_result-function, which just replaces with the
EMPTY_CHANGELIST_VALUE (it's '(None)') with 'All'.

so now my final question: Isn't there an easy, not-hurting way to
solve my problem?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



custom filter -- automatically apply first option

2010-09-17 Thread Julian
hi,

I've written successfully an custom filter for the admin-interface. if
I visit

http://localhost:8000/admin/usertracking/analyze/

coming from http://localhost:8000/admin/), none of the filters is
applied, although it's marked as "selected" on the right side on the
website. the reason is probably because you have to make a request
like

http://localhost:8000/admin/usertracking/analyze/?timestamp_year__isnull=True

to apply the filter. how can i automatically apply the filter? the
solution in my mind is hooking the changelist_view-method of the admin
and manipulate request.GET.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



tracking changes of a model's attributes

2010-09-17 Thread Julian
hi,

i'm writing a little statistical app for a django-project. everytime a
very model is saved, something's stored in the db, depending on the
model's attributes. if one of the attributes changes, I have to change
the statisitical data otherwise it would leed to inconsistency. I need
to know the old value of the attribute. how do I get it?

for example: I have a model

class AModel(models.Model):
a = models.CharField(...)

class StatisticModel(models.Model):
a_value = models.CharField(...)
a_counter = mdoels.IntegerField(...)

on post_save() of a = AModel(a='a') I select the StatisticModel with
a_value = 'a' and increase a_counter by 1. If then a is saved again
with a = 'b', I have to decrease a_counter of the StatisticModel with
a_value = 'a' by 1 and increase it by 1 on another instance.

How can I do this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: problem with block tag and autoescaping

2010-09-16 Thread Julian Moritz
Am Donnerstag, den 16.09.2010, 11:18 +0100 schrieb Nuno Maltez:
> On Wed, Sep 15, 2010 at 4:50 PM, Julian <maili...@julianmoritz.de> wrote:
> > before returning, all paramaters in the urls are separated by & as
> > they should be. in the template the & occur as . for example, the
> > url is print'ed in the tag:
> >
> > /go/to/url?
> > utts=-1=trackuser=f6730dc992ee9a23c24ed0adae0eb5f6
> >
> > and in the template it looks like
> >
> > test > a>
> 
> Sorry I can't help you much (never happened to me) but:
> 
> a) are you sure it's not beautifulsoup that's replacing your &?
> 
> b) shouldn't they be really separated by ""? Using & will cause
> validation errors:
> http://htmlhelp.com/tools/validator/problems.html#amp
> 

Hi there,

I've just realized that it's not a bug but a feature. The browsers
handle it correctly.

Thanks & Regards
Julian

> Nuno
> 


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



problem with block tag and autoescaping

2010-09-15 Thread Julian
Hi,

I'm a little bit confused. I'm writing a block tag which manipulates
all the included urls in a special way to track users. therefor I've
written a custom template-tag which does mainly the following in the
render-method:

1. render the nodelist
2. parse the html with beautifulsoup
3. manipulate the links
4 return the beautifulsoup

before returning, all paramaters in the urls are separated by & as
they should be. in the template the & occur as . for example, the
url is print'ed in the tag:

/go/to/url?
utts=-1=trackuser=f6730dc992ee9a23c24ed0adae0eb5f6

and in the template it looks like

test

how do I disable the escaping when displaying the template?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Testing custom inclusion tag

2010-07-11 Thread Julian
Hi,

I've written a custom inclusion tag for a project of mine. The problem
is: how can i test it? I've got a TestCase which has some methods:

def get_tagcloud_template(self, argument):
return """{%% load taggit_extras %%}
  {%% include_tagcloud %s %%}
""" % argument

My approach for testing template-tags was:

def test_taglist_project(self):
t = Template(self.get_taglist_template(""))
c = Context({})
t.render(c)

and then I tested the members of `c`, for example

self.assertEquals(c.get('tags'), ['somelist'])

But the template-variables exist only in the scope of the included
template, not in the template that contains the include-statement. How
do I test if everything's working? Do I have to read the file that
contains the include-statement and render it?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Best Practice for developing djangoapp in a repository

2010-01-21 Thread Julian
Hello,

my problem is maybe not very specific but more a problem with an
approach. Let's say I want to work on a djangoapp (in this case django-
tagging, the famous tagging app). I'm not very satisified with the
code and want to simplify it.

if I clone the repository I have a folder 'django-tagging' wich
contains several files (e.g. the LICENSE.txt, the setup.py) and a
folder with the djangoapp itself called tagging.

when working on the code i want to test the tagging app with ./
manage.py test tagging. so atm I see two possibilities:

1.) the folder django-tagging is a djangoproject and all the files not
concerning the djangoapp (e.g. the manage.py) are not in the
repository. then I can change the code, test it, submit the changes
and everything is cool except I mess the djangoproject files and the
files of the app.

2.) I could install the app with the setup.py and everytime I change
the code I have to reinstall it in order to test it within a
djangoapp. this is another possibility, but makes me not happy.

3.) ??? so what's the best practice to solve that problem? extending
sys.path and keeping the folder its own place?

Regards
Julian
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




using cache.set with large object

2010-01-07 Thread Julian
hi,

i'm using the low level caching for caching a very large object, in
this case a defaultdict with several 100.000 key-value-pairs. the
problem is, everytime I try to retrieve the data with cache.get, it
returns None. I'm using memcached and the caching time is set to one
week. caching smaller objects works fine.

is there any restriction to the size of cached objects? how can I
check if the value was successfully set?

regards
Julian
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




how to cache a generic view?

2009-06-14 Thread Julian

hi,

I've read much about caching in django but I cannot solve a problem:
cache a generic view. I find only this one about caching generic views
via google: 
http://luddep.se/notebook/2008/09/22/cache-generic-views-django/?dzref=117698

but there's the problem that if something on that page changes the
cache isn't deleted. So I've implemented some low-level caching: in my
blog always if an entry is saved or deleted the cache-value for key
"blog_entry_list" is set to None.

on the urls.py-side I've tried to do the following:

def get_entries():
entries = cache.get("blog_entry_list")
if entries == None:
entries = Entry.objects.filter(online=True)
cache.add("blog_entry_list", entries)

return entries

and in the dict for the archive-index-page:

'queryset': get_entries(),

but the following sql is still executed:

 executed sql: time: 0.001, query: SELECT `blog_entry`.`id`,
`blog_entry`.`timestamp_edited`, `blog_entry`.`timestamp_created`,
`blog_entry`.`headline`, `blog_entry`.`slug`, `blog_entry`.`content`,
`blog_entry`.`online`, `blog_entry`.`allow_comments` FROM `blog_entry`
WHERE (`blog_entry`.`online` = True  AND
`blog_entry`.`timestamp_created` <= 2009-06-14 11:45:24 ) ORDER BY
`blog_entry`.`timestamp_created` DESC LIMIT 10

The main issue in my eyes is that the urls.py is read only once after
restarting the server. how can make the list of blogentries being
retrieved from cache and not from db?
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to switch of autosaving for a m2m-relationship

2009-06-06 Thread Julian

hi russell,

thanks, this is what I've found studying the code but not in the
documentation. thanks a lot!
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



how to switch of autosaving for a m2m-relationship

2009-06-06 Thread Julian

hello,

i have a queryset and a model with a manytomany-relationship, let's
say a pizza has toppings.

my pizza margharita has already some toppings and now i retrieve a
queryset of some more and want to add them to the pizza:

for topping in toppings:
pizza.toppings.add(topping)

the problem is: everytime i call add, the pizza is stored again in the
database and an insert statement is done. how can I avoid this? for my
case it would be much better if I could do something like:

pizza.toppings.add(toppings)

to add all toppings in one step.

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



doctest testing with templatefilters

2009-04-12 Thread Julian

hello,

I am testing some of my filters with doctests. it's very easy, but I
have to call the module with the filters manually:

python /foo/bar/templatetags/eggs_extra.py -v

to let the doctest run.

Now I've added at the end of the egg.py the following code:

def run_doctest():
import doctest
doctest.testmod()

and at the beginning of the tests.py the following:

from foo/bar/templatetags/eggs_extra.py import run_doctest

run_doctest()

but nothing happens.

what can I do that that the doctests in the template filters are run
with ./manage.py test?


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Reverse foreign key lookup with unknown model

2009-01-31 Thread Julian

hi there,

I have a problem I really cannot solve on my own. lets say I have
three models:

class A(models.Model):
 ...

class B(models.Model):
fk = models.OneToOneField("A")

class C(models.Model):
fk = models.OneToOneField("A")

If I have then a single A-instance, how can I determine to wich model
it is connected _without_ knowing wich models do have a OneToOneField
to A (or a ForeignKey to A)???

my instance

a = A()

has to methods in this case: a.b and a.c wich either return an
instance of B respectivly of C or throw an exception...but I have to
know their names to call them ;-)


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: faking a cron job

2008-09-28 Thread Julian

okay guys, you've convinced me - it'll do a cronjob!
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



faking a cron job

2008-09-28 Thread Julian

hi there,

i have written a middleware-class wich is doing what a cronjob should
do. it is doing some backup-stuff, and repeats that every 12 hours. it
is a thread and is placed in the list of middleware-classes, but not
processing any request or overwriting any typical method for a
middleware class.

my problem is: with the devlopment-server it's created once. with
mod_python and _three_ apache instances, there are three instances of
my backup-thread, but i want to have only one.

how can i start a thread (without having an extra cronjob) in my
django-app only once on the whole server??? the hackish solution would
be to store the actual PID on a special place.
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



problem with generic views (monthly archive) and different languages

2008-09-13 Thread Julian

hi there,

in my settings.py there is the language specified as "de_de", wich
works well with things like:

{{{
blog_entry.timestamp|date:"b"
}}}

in may, it returns "Mai", wich is german for may.

but i am using the generic views for my blog archive, and monthly
based i'm doing things like:

{{{
Vorheriger Monat
}}}

but i receiven an url like:

blog/2008/mai/

wich turns into an 404 error page, because in this case it should be
blog/2008/may

what's a solution for my problem?
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django hosting website

2008-03-24 Thread Julian DeFronzo
Yeah for more flexibility Slicehost or any VPS would be a better option, but
like the others said if something breaks you gotta fix it.

However, if you do decide to go with a VPS, you can just send me an email,
and I'd be happy to set it up and maintain it for you ;)

On Mon, Mar 24, 2008 at 2:09 PM, Bryan Veloso <[EMAIL PROTECTED]> wrote:

>
> >Lots more flexibility, but when things break its your fault.
>
> Well at least you're able to rebuild instead of begging customer
> service to do it for you. I'll definitely submit my +1 for Slicehost.
>
> -Bryan
> >
>


-- 
~Julian D.

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django hosting website

2008-03-24 Thread Julian DeFronzo
webfaction.com, has great reviews. But I personally don't use them.

On Mon, Mar 24, 2008 at 1:11 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:

>
> Anyone kows a good and cheep django hosting service website?
>
> Thanks.
> >
>


-- 
~Julian D.

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



add RequestContext automatically to each render_to_response call

2008-03-10 Thread Julian

hi,

I've been writing a django-application and now I need the
RequestContext for some new features. I don't want to add
context_instance=RequestContext(request) to each render_to_response
call manually in my views.py.

How can I can I solve my problem?

I could do this with retrieving the request-object and do something
like this:

from django.shortcuts import render_to_response as _render_to_response
from django.template import RequestContext
from django.anywher import request

def render_to_response(*args, **kwargs):
kwargs['context_instance'] = RequestContext(request)
return _render_to_response(*args, **kwargs)

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



dynamic choices in a ChoiceField

2008-01-13 Thread Julian

Hi there,

I have cards and decks, decks have ManyToMany cards, and if you want
to add a card, you have to chose a deck; quite simple.

my forms.py contains something like that:

class CardForm(forms.Form):
deck = forms.ChoiceField(required=True,choices=[(d.id,d.name) for
d in Deck.objects.all()])
question = forms.CharField(required=True,max_length=1)
answer = forms.CharField(required=True,max_length=1)

obviously this doesn't work if i add a new deck, it doesn't appear in
the select-list of the deck-form-field.

Correct me if i'm wrong: the CardForm is not rendered each time I
import it but each time i change the forms.py file.

how do i avoid this?

my solution is to create the list with the choices in the view...but i
have to do it here and there, so i could save some lines of code.
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



how to access the permalink-decorator in the settings.py with a named url pattern?

2007-12-21 Thread Julian

hi,

i have a name url pattern:

url( r'^login/', 'login', {'template_name': "config/templates/
login.html"},name="config-login"),

this works perfectly in the template for

{% url config_login %}

but wouldn't it hurt the dry principle to write the login-url in the
settings.py? right, so i want to do something like this:

from django.db.models import permalink
LOGIN_URL = permalink("config-login",())

but the first line raises an import error (don't know if i can use
permalink just as url with a named url pattern):

 ./manage.py runserver
Error: Can't find the file 'settings.py' in the directory containing
'./manage.py'. It appears you've customized things.
You'll have to run django-admin.py, passing it your settings module.
(If the file settings.py does indeed exist, it's causing an
ImportError somehow.)

tanks for your help!
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to access a tuple in a template

2007-12-20 Thread Julian

thanks, great!
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to handle a zero-based pagination in templates as one-based?

2007-12-20 Thread Julian

okay, thanks. i think this will bring me to a comfortable solution.
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



i18n in modells

2007-12-15 Thread Julian

Hi there,

is there any tutorial/howto/example for a smart solution to bring i18n
into django models?

i have an object A with a property name. this name should be available
in any languages specified in settings.LANGUAGES. until now i have an
I18NNameValueField with the properities

languagecode
value
a (ForeignKey to A)

but i don't think this is very smart
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: admin interface broken

2007-12-13 Thread Julian

this one solved it:

http://groups.google.com/group/django-users/browse_thread/thread/ed22e4efc279d68d/d72a2e2f79156e01
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



admin interface broken

2007-12-13 Thread Julian

Hi there,

i haven't been developing my django project for some weeks and so i
continued my work today.

there are three links on the right upper corner of the admin interface
(documentation, change password, logout) but all of them point to
"http://127.0.0.1:8000/admin/; and nothing happens if i click them.

have i anything missed or done wrong?
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



how to access the host-name in settings.py

2007-09-13 Thread Julian

hello,

in a view it's easy to find out under wich host the django-project ist
running:

{{{
def view(request):
 from django import http
 hostname = http.get_host(request)
}}}

hostname ist set to localhost:8000 running the django-app with ./
manage.py runserver

but how do i access the full host-name (in this case: http://localhost:8000)
in the settings.py?

reason: i don't want to change the media-url constant when i upload it
to another server...


--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



i18n: Has anyone experienced that but too?

2007-09-07 Thread Julian

Hi there,

I opened a ticket yesterday, now I'm wondering about being alone with
that bug.

Please look here:

http://code.djangoproject.com/ticket/5347

Thanks
Julian


--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



stupid problem with subfolder

2007-09-01 Thread Julian

hi there,

i am relativly new to django, everything's quite fine until now, so
here's my problem:

i've developed a django-application with the development server. now i
want to deploy it in a subdirectory of my domain, lets call it
www.domain.com/appl/ fastcgi is running, apache's right configured.

on the root-folder www.domain.com/appl/ i get my start page, but when
i switch to www.domain.com/appl/admin/ i can see the login-form, but
the css-is vanished (the html reads "http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to postpone HttpResponse but still get new requests

2007-02-14 Thread Julian Romero
Did you tried twisted?

http://twistedmatrix.com/projects/core/documentation/howto/async.html

On 2/9/07, Dill0r <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
> i got a producer-consumer class which await new items from the
> clients, does sth with them and provides them to all clients.
>
> the url "getNewItems" is for getting the new Items and vice versa.
>
> my problem is: when i wait for new items, i cant get new, cause this
> stuff is all in one thread.
> is there a way to save the request so i can send a response later
> (when the are new items).
> or maybe i could start 2 threads per client or sth ...!?
>
> any idea?
>
>
> from foo import producerConsumer
>
> def getNewItems(request):
>p = producerConsumer()
>newItems = p.consume() # wating for new items here
>return HttpRespone(newItems)
>
>
> def putNewItem(request):
>p = producerConsumer()
>p.produce(request.__getItem__("item")) # notifyAll here
>#no response needed here
>
>
> >
>


-- 
Julián

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Cheat Sheet

2007-02-14 Thread Julian Romero
On 2/13/07, John Sutherland <[EMAIL PROTECTED]> wrote:
>
>
> Hi all,
>
> Firstly, sorry for the cross-post.
>
> My employer, Mercurytide [1], as some of you may have seen in the
> past, publishes white-papers on a monthly basis. This month it's
> another Django themed one: a Django cheat sheet:
>
> 
>
> We've spent a fair bit of time on it and would really appreciate the
> following:
>
> 1. That you download it; try it out and enjoy it!
> 2. Give us feedback, we know it's not going to be perfect first time,
> so let us know: [EMAIL PROTECTED]
> 3. You publicise it: it would be awesome to get it on the digg front
> page [2]; but put it on your blog, your del.icio.us or where ever...
>
>
> Great work, thanks.
A couple suggestions here:
 * if you give away the original format (it seems it's InDesign) others can
improve, adapt, make new versions and you will get more publicity (add a
by-attribution license)
 * move the legend to your web site, symbols are quite obvious and you will
save lot of space for additional stuff like usual command line options or
whatever
-- 
Julián

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Tools for writing HTML templates

2007-01-30 Thread Julian Romero
On 1/28/07, Paulo <[EMAIL PROTECTED]> wrote:
>
>
> For quick and dirty wireframes OmniGraffle <
> http://www.omnigroup.com/applications/omnigraffle/ > is great (not
> sure of a Windows alternative). You can use Photoshop or Illustrator
> (or their open source brethren) as well but it is overkill if you just
> need to play with ideas before you dive into design.


I use vim for all my editing tasks (code, html, e-mail...) but I wish I
could use something like http://dub.washington.edu/denim/ for app
wireframing. It didn't work properly for me (perhaps because I don't have a
tablet PC nor watcom) I like the ability to produce a "live" site, see
example http://dub.washington.edu/denim/denim_daily_files/page149.html

I'm still looking for an (open source) alternative.

regards,
-- 
Julián

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem getting Apache/mod_Python to work with Django

2007-01-27 Thread Julian Romero
On 1/27/07, Pramod Subramanyan <[EMAIL PROTECTED]> wrote:
>
>
> File
> "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg
> /django/db/backends/postgresql/base.py"
> in cursor
>   43. self.connection = Database.connect(conn_string)
>
>   OperationalError at /mysite/admin/
>   FATAL: role "daemon" does not exist
>
> I've no clue what this means - so could you please help?
>
>
> I guess you need to create a role (the user in the connection) named
"daemon" in your database. Test it in the command line (or in your favorite
app) to be sure it's working and then with the dev server.
AFAIK it has nothing to do with mod_python.
-- 
Julián

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Debugging Django: print statements?

2007-01-23 Thread Julian Romero
On 1/22/07, rzimerman <[EMAIL PROTECTED]> wrote:
>
>
> What's the best way to do debugging in Django? Usually when I program,
> I use  "print" statements to identify problems. But Django seems to
> surpress all output to stdout.


The best way, no doubt, is a graphical debugger that remotely connects to a
running django. I am still looking for such beast (for linux
environment...perhaps pydev is able to do that)

In the meantime I usually use two aproaches:
1) a dev server with print statements in the console
2) I have the base template ready to dump debug data as javascript block,
basically sentences calling firebug's extension console.log method. The
debugging code only runs when a specific parameter (__debug__=1) is added to
the URL. You need collect data in the problematic view and add it to the
context, then cycle over it on the template generating the javascript code.
For IE lovers (or firebug haters) the same approach works dumping the data
in a hidden HTML element. Valid for any server deployment. It doesn't annoy
the users unless they add the parameter to the URL..

You can also write to the server (mod_python, fcgi) error log if you have
access to it.

regards,
j.

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Weird apache problem

2007-01-06 Thread Julian Romero

On 1/6/07, Chris Brand <[EMAIL PROTECTED]> wrote:



I got apache with mod_python up and running ok.

Then I used manage.py reset on one of my apps.

Since then, I can't see that app in the Admin page. It was showing up fine
before. It also shows up fine if I use the development server.

I've restarted apache, my browser and even mysqld, all to no avail.


If you just restarted apache (literally) you can try to stop+start. Some

times a hard stop is required.
You can also inspect "manually" the db (from the command line or you gui of
choice) to check if the tables are still there.

--
Julián

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---