Sunday, October 31, 2010

cannot setup database

When i run the command python manage.py syncdb i got the follwing error

self.connection = Database.connect(**kwargs)
sqlite3.OperationalError: unable to open database file
Exception exceptions.AttributeError: '_shutdown' in <module 'threading' from 'D:
\Python25\lib\threading.pyc'> ignoredDATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add
'postgresql_psycopg2', 'postgresql', 'mysql',

MY DB SETUP LOOKS LIKE THIS
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add
'postgresql_psycopg2', 'postgresql', 'mysql',

'sqlite3' or 'oracle'.
'NAME':
'D:\Python25\Lib\site-packages\django\bin\flyp\sqlite3',
# Or

path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for
localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for
default. Not used with sqlite3.
}
}

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

Free Blog built on Django and run in AppEngine

Hi,


I just released a source code of my own blog as open source (called
'MeBlog'). Built the blog in django 1.2.3 and run in appengine.
This blog has common features for blog, such as manage posts, manage
pages, and manage media file. This is the first release, hope anyone
enjoy.
Feel free to write me any comment, sugggestion, bug report, or feature
request.

Source code available at http://bitbucket.org/hudarsono/meblog

Preview and Real site : http://blog.hudarsono.me (my own blog)

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

Re: Multiple Django/Python developer Positions- Atlanta, GA

On Fri, 2010-10-29 at 22:32 +0530, Venkatraman S wrote:
> On Fri, Oct 29, 2010 at 10:27 PM, Kenneth Gonsalves
> <lawgon@au-kbc.org>wrote:
>
> > On Fri, 2010-10-29 at 07:18 -0700, Jack wrote:
> > > only US Citizens or Greencard holders need apply
> >
> > please do not put things like this on an international list
> >
>
> I hear that there are many many unclaimed H1B slots :)
> But OTOH, i dont think its much of a problem when the recruiter
> clearly
> mentions the criteria; you dont want to get loads of applicants which
> do not
> satisfy the basic criteria.

sorry, I got a bit upset - it is better to put criteria like this in the
subject line - not at the end of the mail. Save us some time reading.
--
regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

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

Add admin action to Django User

Hi, I want to add an customized action to user management in django
admin site. I can see that only delete selected user is available, how
can I add more to that?

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

Re: minimum system requirements

On Sun, Oct 31, 2010 at 12:10 PM, Peter Herndon <tpherndon@gmail.com> wrote:
> but I would not expect that single VPS to be able to handle more than a very small number of visitors at once.

only if you consider several dozens "a very small number"

--
Javier

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

Apache config. admin page displays without stylesheets

Django runs as expected using manage.py runserver, but when I run it
from apache certain files are not found.

This is because the apache user has a different base directory than
the user running manage.py. So, I added absolute paths to my
setting.py and other files. Now through apache one can access all the
modules and pages just fine. But when I try to go to /admin I see
there is no css formatting. everything is very plain and not like the
version through runserver at all.

I assume this is because the css file is not being found. But if the
admin code is found, and allows me the properly add items and
everything, why isn't the css found?

granted, the html code I've written doesn't have any css going on, so
I cant say that only the admin pages aren't rendering right.

my apache setup looks like:
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['/home/libadmin/library/django-ils/','/home/
libadmin/library/django-ils/bookshare'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE bookshare.settings
PythonOption django.root /home/libadmin/library/django-ils/bookshare/
PythonDebug On
</Location>

Thinking that a relative path to the css file was being misused I
checked the source of the admin login page in firefox. The admin site
is looking for <link rel="stylesheet" type="text/css" href="/media/css/
login.css" />

this file exsists in both
/usr/share/python-support/python-django/django/contrib/admin/media/css/
login.css
/var/lib/python-support/python2.5/django/contrib/admin/media/css/
login.css

so, is django not finding this file because of an irrendered relative
path? and if so, what is wrong with my configuration that this isn't
found?

(This is being run from a cloned mercurial repo, so I did not start
this project on this machine with the django scripts. if this is the
issue, is there a way to manually do what the startproject or startapp
scripts are supposed to do?)

thanks,
Elliot

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

Re: Call a function after a model with inlines is created

On Oct 31, 4:46 pm, Martin Tiršel <dja...@blackpage.eu> wrote:
> Hello,
>
> I have two models BillingRequest and BillingRequestItem. I am using admin  
> and inlines, so when I am creating BillingRequest, I have some fields for  
> BillingRequestItems. Now, I need to send an email with some information  
>  from both models when I create new BillingRequest record. But I don't  
> know, where I should put the code. It have to be after all models are  
> saved, but where/when is it?
>
> Thanks,
> Martin

If this is only needed for the admin, you probably want to override
the ModelAdmin's response_add method. This is called after the add
form has been processed and all the resulting objects saved. Be sure
to call (and return) the super method after you've done your
processing.
--
DR.

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

Re: Third party object like model field

http://docs.djangoproject.com/en/dev/howto/custom-model-fields/

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

Re: minimum system requirements

On Oct 31, 2010, at 7:19 AM, ozgur yilmaz wrote:

> Hi,
>
> I'm developing a project by django 1.2.3. Now it's time to bring the
> project to production. I'm looking for dedicated servers but i dont
> know the minimum hardware requirements. There are dedicated options
> with P4 cpus. Is there any information about requirements?

Hi Ozgur,

Minimum hardware requirements are relative to the amount of traffic you will be receiving. It is certainly possible to host a Django web site on a single 256MB VPS from e.g. Rackspace, but I would not expect that single VPS to be able to handle more than a very small number of visitors at once. On the other hand, 2 load-balanced 512MB instances serving the Django app plus a larger instance running the database should suffice to handle a much larger number of concurrent users -- depending on how you architected the site. If you have particular views that run lots of database queries and perform a large number of calculations, and those views turn out to be popular destinations for your visitors, you can very rapidly run out of resources. On the other hand, if you have a good caching strategy in place and minimal required computation for your site, small servers can potentially handle a much larger load.

You will need determine for yourself how much computing hardware will suffice to handle your particular requirements. You should approach this task by load-testing your application, using such tools as httpperf (http://code.google.com/p/httperf/) and Tsung (http://tsung.erlang-projects.org/) to simulate usage of your app. You will want to test all your views, and also simulate what you think will be the normal use pattern. With the knowledge of how each view responds to load, you can then tune those views individually for better performance. With the knowledge of how your app responds to the normal use pattern, you can gauge how much hardware will be required to handle your estimated number of visitors. In short, profile your app, and make decisions based on that knowledge.

As with many questions regarding deployment, the answer is "It depends".

---Peter Herndon

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

Third party object like model field

Hello!
I'd like to ask a bit newbie question but cannot realize how to do it.
How I can implement following model:

class Something(models.Model):
   name = models.CharField(max_length = 50)
   #  and so on..
   #  next fields have predefined Django types
   #...............
   ts = # where ts should be the object created by scikits.timeseries module (http://pytseries.sourceforge.net/)

So, in short words, how can I create model with field that contains third party object? Please point me the directions,

Thanks in Advance
Best Regards
Alex

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

Call a function after a model with inlines is created

Hello,

I have two models BillingRequest and BillingRequestItem. I am using admin
and inlines, so when I am creating BillingRequest, I have some fields for
BillingRequestItems. Now, I need to send an email with some information
from both models when I create new BillingRequest record. But I don't
know, where I should put the code. It have to be after all models are
saved, but where/when is it?

Thanks,
Martin

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

Re: Tracking changes of a model

First, I thought that I don't need all the functionality provided by
similar applications but after I spend some hours trying to do it myself
not being very successfull, I tried this app and after five minutes all
was up and running :)

Thanks,
Martin

On Sat, 30 Oct 2010 15:03:48 +0200, Daniel Roseman <daniel@roseman.org.uk>
wrote:

> On Oct 30, 11:15 am, Martin Tiršel <dja...@blackpage.eu> wrote:

>
> Sounds like django-reversion would fit the bill:
> http://github.com/etianen/django-reversion
>
> --
> DR.

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

Re: How to make base.html a little more useful?

That switched the lightbulb on above my head. Thanks!

-Wes


On Oct 31, 8:16 am, Shawn Milochik <sh...@milochik.com> wrote:
> Context processors, or a custom template tag, as described in James Bennett's book, "Practical Django Projects."

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

Re: How to make base.html a little more useful?

Context processors, or a custom template tag, as described in James Bennett's book, "Practical Django Projects."

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

Re: django-registration question: activation_key_expired.boolean = True

> This particular object is used by the admin:
>
> http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#django.contri...
>
> Read through that carefully and you'll see the 'boolean' option and a
> few other useful tricks.

Well, this is embarrassing. I had actually read (err, skimmed?) that
page looking for the answer, and did not see the needle in the
haystack. After a more careful reading, it's perfectly clear.

The attribute name 'boolean' threw me off a bit. I thought maybe there
was some Python magic happening related to the fact that the function
returned a boolean. Now all is clear. Thanks very much.

Alan

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

How to make base.html a little more useful?

I am somewhat new to Django, but I have been able to figure out the
form, model, view, session flow etc fairly well. I am going to ask
this question in an abstract sense, because I really think a simple
abstract answer is enough to get my mind in the right place.

I have a base.html that has a header, left nav bar, main content area,
footer, etc. Of course some views override these sections to
drastically alter their content, etc (the main content being the most
common of course).

One thing that I would like to do is put some more useful nav links in
the left sidebar for users who are authenticated. Such as a list of
their friends who are also online (even if the data is pulled from
third party) or a list of projects they are currently working on so it
has hyperlinks to take them directly to those project editing pages.

What I am mentally missing is how to get that data fed into base.html
with every view call. Each time the left nav in base.html would be
rendered it would need to draw data from a couple different apps I
have installed on the site.

Can someone point me in the right direction?

-Wes Wagner

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

Re: django-registration question: activation_key_expired.boolean = True

On Sun, Oct 31, 2010 at 8:48 AM, adj7388 <adj7388@gmail.com> wrote:
> What does that last line do? I have looked high and low in Django and
> Python documentation, but I can't find an example or explanation of
> this pattern. It appears to be clobbering the method
> 'activation_key_expired()' with a boolean that is always True. Surely
> there's something else at work here, isn't there?  Sorry if this is
> obvious to everyone but me, but I can't find the answer anywhere.

It sets an attribute on the instancemethod object
'activation_key_expired'. Remember: everything is an object, and you
can fiddle with attributes on any object.

This particular object is used by the admin:

http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display

Read through that carefully and you'll see the 'boolean' option and a
few other useful tricks.


--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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

Executing ssh scripts with django

Hi guys, 
I'm developing an ISP control panel for my organization. I just finished the web interface based on django admin and now it's time to introduce calls to the "system scripts" in order to make the changes effective on the ISP servers (add users, manage virtualhosts, domains, and all this stuff). To achieve that I was thinking in overriding the save and delete methods from my models ( virtualhost model, domain model..). For example. before saving a new "apache virtualhost" I want to run a proper "create vhost" script through ssh using Paramiko library and if it is successful save the new virtualhost into the database, otherwise send a message to enduser telling that an error has occurred. 


class Virtualhost(models.Model):
    ....

    def save(self, *args, **kwargs):
         if not self.id:
             ssh = Ssh('create_new_virtualhost', self)
             if ssh.errors: 
                  message.add(self.user, 'something wrong was happend')
             else:
                   super(self, Virtualhost).save(*args, **kwargs)


I'm wondering if this approach is the right way for the interaction between django and ISP servers. 
Moreover, I read that is highly recommended to use a message queue like celery in order to avoid a possible 'long wait' until ssh command ends [1]. Would you execute the save function through celery? Is it safe? or maybe if save() is executed asynchronously it can cause some unexpected behavior?

I need some "expert" opinion here :) Would you affront this situation in a similar way or would you take a completely different approach?

Many thanks!!







--
Marc

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

django-registration question: activation_key_expired.boolean = True

This question refers to line 205 here:
http://bitbucket.org/ubernostrum/django-registration/src/b6b213d84d32/registration/models.py

In a nutshell:

class RegistrationProfile(models.Model):

def activation_key_expired(self):
...
expiration_date =
datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)
return self.activation_key == self.ACTIVATED or \
(self.user.date_joined + expiration_date <=
datetime.datetime.now())
activation_key_expired.boolean = True ##### <- what does this do?

What does that last line do? I have looked high and low in Django and
Python documentation, but I can't find an example or explanation of
this pattern. It appears to be clobbering the method
'activation_key_expired()' with a boolean that is always True. Surely
there's something else at work here, isn't there? Sorry if this is
obvious to everyone but me, but I can't find the answer anywhere.

Thanks.
Alan

btw: James Bennett's django-registration app is great. Elegant, well
designed, and does exactly what it needs to. I learned a lot about
django and django testing just by reading the 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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

minimum system requirements

Hi,

I'm developing a project by django 1.2.3. Now it's time to bring the
project to production. I'm looking for dedicated servers but i dont
know the minimum hardware requirements. There are dedicated options
with P4 cpus. Is there any information about requirements?

Thanks all,

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

Local testing setup with Python 2.7 OS X installer, mod_wsgi and Apache?

the Python 2.7 OS X installer builds a 'fat' Python install, which
*should work* with the OS X Apache2 install and mod_wsgi. The Python
2.6 OS X installer didn't support 64 bit architectures, necessitating
Apache2 to be trimmed 32 bit (
http://groups.google.com/group/modwsgi/browse_thread/thread/cacddadc0c3c8e93/c92475afc0cc31eb?q=
).

For a local mod_wsgi/Django/Apache testing environment with the
minimum of work (in this case using the OS X Apache and an OS X Python
2.7 installer), I'd like to hear from anyone with this setup on OS X
10.5, before I ditch my Python 2.6, rebuild mod_wsgi with Python 2.7
and restore 64 bit Apache2.

I originally posted this on StackOverflow but had no response, so
hopefully someone on this list has been there first:
http://stackoverflow.com/questions/4028394/python-2-7-os-x-installer-mod-wsgi-and-apache

Dave Everitt

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

Re: Import csv file in admin

> I try to follow the ideas, but i feel like taking the dirty way.
> Here's my work:
> Because i can't replace the modelform created by the admin for the
> "Data" model with a standard form as the Django docs says, i created a
> view to replace the "add" view generated by the admin and put a
> standard form:

Jorge,

I think you need to get back to basics and try to understand what is
run where. All the code you are writing for Django is run on the
server and only web pages are *displayed* to users on their machines.
This means that in order to import a CSV file, you need to transfer it
to the server first and then you'll be able to import it there.

Note that this has nothing to do with the admin site. This is a
fundamental think to understand.

I'd suggest that you forget the admin site for the moment and focus
on the "transfer CSV file to server first". Take a look at the email
Felix has sent you regarding FileField and try to code the part that
handles file upload to the server. Once you have that, you can start
thinking about importing the contents of the file into the database.

Cheers

Jirka

P.S. OK, there is a way to import data without uploading them to
server first, but it's much more complicated than the one outlined
above and involves multiple different technologies that have to work
together.

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

Saturday, October 30, 2010

Re: Import csv file in admin

Felix

I try to follow the ideas, but i feel like taking the dirty way.
Here's my work:
Because i can't replace the modelform created by the admin for the
"Data" model with a standard form as the Django docs says, i created a
view to replace the "add" view generated by the admin and put a
standard form:
class DataAdmin(admin.ModelAdmin):

change_form_template = 'admin/data/data/change_form.html'

def get_urls(self):
urls = super(DataAdmin, self).get_urls()
my_urls = patterns('',
('^add/$',
self.admin_site.admin_view(self.add_view)),
)
return my_urls + urls

def add_view(self, request, extra_content=None):
FormInput = DataInput()
context = {'form': FormInput}

return super(DataAdmin, self).add_view(request,
extra_context=context)

And the form is:
import csv
from datetime import datetime

class DataInput(forms.Form):
file = forms.FileField()
place = forms.ModelChoiceField(queryset=Places.objects.all())

def save(self):
records = csv.reader(self.cleaned_data["file"])
for line in records:
input_data = Data()
input_data.place = self.cleaned_data["place"]
input_data.time = datetime.strptime(line[1], "%m/%d/%y %H:
%M:%S")
input_data.data_1 = line[2]
input_data.data_2 = line[3]
input_data.data_3 = line[4]
input_data.save()

In the template are the "multipart/data" and "csrftoken" orders.

But again... this is a karma.... the IntegrityError: datas_data.time
may not be NULL

As i say at the beginning, i feel like taking the dirty way, and
obviously not seeing something.

Regards!

On Oct 30, 5:55 pm, Felix Dreissig <f...@f30.me> wrote:
> The ordinary user won't have to deal with the command line, you just
> need to get the CSV file. A ModelForm to which an FileField is added
> doesn't really have anything to do with that.
>
> Instead, you should create a standard form with a single FileField to
> upload the CSV file, save it temporarily or just keep it as a file
> object and then process it as Jirka pointed out.
>
> Regards,
> Felix
>
> On 29.10.2010 18:31, Jorge wrote:
>
> > Jirka
>
> > I need an easy method inside the admin to upload the csv file with an
> > web interface. I guess with your method the admin will need access to
> > the server and the command line, and something like this is not what i
> > try to do, because the admin (not me) is not a django developer, not
> > even a user get used to command lines. But if my guessing is wrong how
> > can i do a web interface for your method?
>
> > Regards!
>
> > On Oct 29, 5:44 am, Jirka Vejrazka <jirka.vejra...@gmail.com> wrote:
> >> I must still be missing something here. If all you want to do is to
> >> read CSV file and save the data in the database, I still don't
> >> understand why you use the forms machinery.
>
> >> You only *need* to use the data model, e.g.
>
> >> from myapp.models import Data
>
> >> csvfile = csv.reader('something.csv')
>
> >> for line in csvfile:
> >>   do_necessary_data_conversions_or_checks(line)
> >>   try:
> >>     Data.objects.create(field1=line[0], field2=line[1], ...)
> >>   except (IndexError, IntegrityError):
> >>     print 'Invalid line encountered:\n%s' % line
>
> >>   What am I missing?
>
> >>    Jirka

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

Re: overriding save-method

Write a custom model field:
http://docs.djangoproject.com/en/dev/howto/custom-model-fields/

Or even better, take already written one:
http://djangosnippets.org/snippets/377/

On Oct 27, 9:14 am, Patrick <ptrckdn...@googlemail.com> wrote:
> hi,
>
> i am trying to override the save-method of one of my models. i want to
> save the json-representation of any object in a text field. somehow it
> doesn't seem to work.
>
> class Setting(models.Model):
>     name = models.CharField(max_length=100)
>     value = models.TextField()
>
>     def save(self, *args, **kwargs):
>         self.value = json.dumps(self.value)
>         super(Setting, self).save(*args, **kwargs)
>
> any ideas?! thank you..

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

Re: Tracking changes of a model

Check out http://bitbucket.org/mhall119/django-audit/wiki/Home
--
Michael <mhall119@gmail.com>

On Sat, 2010-10-30 at 12:15 +0200, Martin Tiršel wrote:
> Hello,
>
> I am using Django admin to create/update some records. Now, I need to
> track changes. After somebody updates a record, I need to see what was
> changed and then create a text log like:
>
> changed `name`: oldvalue -> newvalue,
> changed `email`: old@mail.xy -> new@mail.xy
>
> Where is the right place, where I have access to unchanged model values
> and validated values from the submit form? The place before the model is
> updated by form values? Another approach would be to save all values into
> a dictionary after the model is loaded from database and in save() method
> compare old and new values, but I don't know how how to call a code after
> load.
>
> Thanks,
> Martin
>

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

Re: Cherokee for home developing

Yes, absolutely. :D Good luck!

On Oct 30, 2010, at 5:04 PM, Karim Gorjux wrote:

> Yes, I noted that when I edit a url and sometimes the code, I have to
> kill the fastcgi process to see the result in the browser. I think
> that I could run the fastcgi as explained in the django documentation:
>
> ./manage.py runfcgi method=prefork socket=/home/user/mysite.sock
> pidfile=django.pid
>
> and map in vim file a kill command
>
> kill `cat $PIDFILE`

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

Poll about geodjango

Hi guys, 
 
i will like to much if the users of geodjango (aka django.contrib.gis) can make this poll

http://goo.gl/l2od

Is for a exposition in college.

thanks.

--
Diego Andrés Sanabria
Ingeniería de Sistemas Universidad Distrital
about:me http://www.google.com/profiles/diegueus9
cel 3015290609


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

Re: Cherokee for home developing

Thanks for all your answer, the topic get a little divergence, but
it's ok, I still use Cherokee for developing even if is not so
comfortable as I thought.

> The best way to save yourself time and effort is really to use the
> Django development server when testing out alterations.

Yes I guess so, but I had many problems to serve static files, and the
:8000 port wasn't so cool so I tried to work with a production web
server even for the developing.

> Karim, you may find that refreshing your project is easier with uWSGI as opposed to something
> like FastCGI, in reference to your question about having to restart Cherokee each time you make changes.

Yes, I noted that when I edit a url and sometimes the code, I have to
kill the fastcgi process to see the result in the browser. I think
that I could run the fastcgi as explained in the django documentation:

./manage.py runfcgi method=prefork socket=/home/user/mysite.sock
pidfile=django.pid

and map in vim file a kill command

kill `cat $PIDFILE`

Another solution is take a look at the uWSGI configuration

Anyway is a nice topic ;-)

--
K.
Blog Personale: http://www.karimblog.net

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

Re: Import csv file in admin

The ordinary user won't have to deal with the command line, you just
need to get the CSV file. A ModelForm to which an FileField is added
doesn't really have anything to do with that.

Instead, you should create a standard form with a single FileField to
upload the CSV file, save it temporarily or just keep it as a file
object and then process it as Jirka pointed out.

Regards,
Felix


On 29.10.2010 18:31, Jorge wrote:
> Jirka
>
> I need an easy method inside the admin to upload the csv file with an
> web interface. I guess with your method the admin will need access to
> the server and the command line, and something like this is not what i
> try to do, because the admin (not me) is not a django developer, not
> even a user get used to command lines. But if my guessing is wrong how
> can i do a web interface for your method?
>
> Regards!
>
> On Oct 29, 5:44 am, Jirka Vejrazka <jirka.vejra...@gmail.com> wrote:
>> I must still be missing something here. If all you want to do is to
>> read CSV file and save the data in the database, I still don't
>> understand why you use the forms machinery.
>>
>> You only *need* to use the data model, e.g.
>>
>> from myapp.models import Data
>>
>> csvfile = csv.reader('something.csv')
>>
>> for line in csvfile:
>> do_necessary_data_conversions_or_checks(line)
>> try:
>> Data.objects.create(field1=line[0], field2=line[1], ...)
>> except (IndexError, IntegrityError):
>> print 'Invalid line encountered:\n%s' % line
>>
>> What am I missing?
>>
>> Jirka
>

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

Re: how to develop cms on django

Please try out Live Demo for Django CMS Classcomm ...
http://code.google.com/p/classcomm/ and http://classcomm.geekshack.net/handin/

On Oct 29, 1:47 pm, Oivvio Polite <myli...@polite.se> wrote:
> > i dont have time i need to start development within  a month..
>
> > plz tell me all those crucial topics that i should learn
>
> From the little information I have about your situation I'd say your
> better of using a readymade CMS like Wordpress. As much as I love
> Django, I do think that you'll be settings yourself up for a world of
> pain if you need to have a site up withing a month and have no
> previous experience with python.
>
> oivvio
>
> --http://pipedreams.polite.se/about/

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

Re: server configuration

> Actually there is nothing about that is not possible to use worker MPM
> and daemon mode.
Sorry. I meant prefork MPM :)

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

Re: server configuration

http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide#Apache_Requirements
>For Apache 2.0 and 2.2, either the single threaded 'prefork' or multithreaded 'worker' Apache MPMs can be used.
>To be able to make use of daemon mode of mod_wsgi, either Apache 2.0 or 2.2 is required and the corresponding Apache runtime (APR) libraries must have been compiled with support for threading.

Actually there is nothing about that is not possible to use worker MPM
and daemon mode.
So, I'm using it and have no problem at all.

...
ServerName vspolny.ru
WSGIDaemonProcess vspolny user=www group=www

httpd -V
Server version: Apache/2.2.15 (FreeBSD)
Server built: Jun 12 2010 21:08:00
Server's Module Magic Number: 20051115:24
Server loaded: APR 1.4.2, APR-Util 1.3.9
Compiled using: APR 1.3.9, APR-Util 1.3.9
Architecture: 32-bit
Server MPM: Prefork
threaded: no
forked: yes (variable process count)

On Oct 29, 7:22 pm, "bax...@gretschpages.com" <mail.bax...@gmail.com>
wrote:
> I'm finding conflicting info regarding preferred server
> configurations.
>
> I'm using Nginx for static, passing off to Apache/mod_wsgi for django
> stuff. Currently, wsgi is in daemon, and I'm using the worker MPM.
> From some sources I've seen that is ideal, but I notice in the django
> docs that prefork MPM is better. But then I read you can't use prefork
> if wsgi is in daemon mode.
>
> So I'm confused, and hoping someone can clarify for me.

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

Re: Using new classbased generic views in contrib.databrowse

On Sat, Oct 30, 2010 at 2:01 AM, Michael <michael.hurni@gmail.com> wrote:
> Hi,
>
> Do you think it is relevant to rewrite databrowse to use the new class-
> based generic views ?
> I'm motivate to work around this and submit a patch, but want first to
> discuss about what to do..
> IMHO, contrib.databrowse (using class-based views) can provide a
> reusable/extendable "base" for rapid development.
>
> Do you use databrowse ? and how (extending the classes ? , or just by
> providing your own the template ?)
> a JSON/CSV/XLS output could be useful too in databrowse (theses two
> last formats could also become core.serializers btw.)

Hi Michael,

Databrowse hasn't seen a whole lot of attention since it was
originally added, so there is almost certainly room for improvement.
Moving to class-based views might be part of that process. If you want
to adopt databrowse as a pet project and improve it, I certainly
encourage you to do so.

However, please don't just submit a patch that 'replaces function
views with class-based views'. Change for the sake of change isn't
something we generally encourage. Unless there's a compelling reason
to migrate to class-based views, there's not a lot of reason to make
changes to code that works. There was a recent discussion about
porting the contrib.auth views to class-based views which received a
simliar reception.

I look forward to any proposals you may have for improving databrowse!

Yours,
Russ Magee %-)

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

Re: Tracking changes of a model

On Oct 30, 11:15 am, Martin Tiršel <dja...@blackpage.eu> wrote:
> Hello,
>
> I am using Django admin to create/update some records. Now, I need to  
> track changes. After somebody updates a record, I need to see what was  
> changed and then create a text log like:
>
> changed `name`: oldvalue -> newvalue,
> changed `email`: o...@mail.xy -> n...@mail.xy
>
> Where is the right place, where I have access to unchanged model values  
> and validated values from the submit form? The place before the model is  
> updated by form values? Another approach would be to save all values into  
> a dictionary after the model is loaded from database and in save() method  
> compare old and new values, but I don't know how how to call a code after  
> load.
>
> Thanks,
> Martin

Sounds like django-reversion would fit the bill:
http://github.com/etianen/django-reversion

--
DR.

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

Re: Tracking changes of a model

Hi Martin,

i think this should give you the basic idea:
http://stackoverflow.com/questions/1365963/diff-django-model-objects-with-manytomany-fields

Greetings,
Andreas

On 30 Okt., 12:15, Martin Tiršel <dja...@blackpage.eu> wrote:
> Hello,
>
> I am using Django admin to create/update some records. Now, I need to  
> track changes. After somebody updates a record, I need to see what was  
> changed and then create a text log like:
>
> changed `name`: oldvalue -> newvalue,
> changed `email`: o...@mail.xy -> n...@mail.xy
>
> Where is the right place, where I have access to unchanged model values  
> and validated values from the submit form? The place before the model is  
> updated by form values? Another approach would be to save all values into  
> a dictionary after the model is loaded from database and in save() method  
> compare old and new values, but I don't know how how to call a code after  
> load.
>
> Thanks,
> Martin

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

Re: write a filter for latex that escapes some chars

thx for that.
It's not quite what I was looking for but it led me to the solution

Thank You.

On 29 Paź, 15:42, Brian Bouterse <bmbou...@gmail.com> wrote:
> We have done this before and used something like the code below.  This
> sample is pretty basic.
>
>    def fixchar(string,char):
>
>     #fixes chars for latex
>
>     if char == '<':
>
>         newchar = '$<$'
>
>     elif char == '>':
>
>         newchar = '$>$'
>
>     elif char == '~':
>
>         newchar = '\\~{}'
>
>     else:
>
>         newchar = '\\' + char
>
>     string = string.replace(char,newchar)
>
>     return string
>
>
>
>
>
>
>
>
>
> On Fri, Oct 29, 2010 at 9:03 AM, SlafS <slaf...@gmail.com> wrote:
> > Hi there!
>
> > I'm trying to write a filter that can be used inside of a template
> > that is used for generating latex files.
>
> > The filter should replace the '|' char with '\'. Simple:
>
> > @register.filter("verb_safe")
> > def verb_safe(val):
> >    return str(val).replace('|', '\|')
>
> > is outputting me '\\|'
>
> > I'm littlle confused about that.
>
> > Please help
>
> > Regards
>
> > --
> > 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+unsubscribe@googlegroups.com<django-users%2Bunsubscribe@google groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Brian Bouterse
> ITng Services

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

Tracking changes of a model

Hello,

I am using Django admin to create/update some records. Now, I need to
track changes. After somebody updates a record, I need to see what was
changed and then create a text log like:

changed `name`: oldvalue -> newvalue,
changed `email`: old@mail.xy -> new@mail.xy

Where is the right place, where I have access to unchanged model values
and validated values from the submit form? The place before the model is
updated by form values? Another approach would be to save all values into
a dictionary after the model is loaded from database and in save() method
compare old and new values, but I don't know how how to call a code after
load.

Thanks,
Martin

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

Re: can't open file 'django-admin.py': [Errno 2] No such file or directory'.

On Oct 30, 6:00 am, sami nathan <itssami.g...@gmail.com> wrote:
> Whenever I try to execute a python script that is located in the
> /usr/local/bin, python gives me the error 'python: can't open file
> 'django-admin.py': [Errno 2] No such file or directory'.

That makes no sense. That message is a Windows error, and Windows
doesn't have a /usr/local/bin/ directory.
--
DR.

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

Re: can't open file 'django-admin.py': [Errno 2] No such file or directory'.

On Oct 30, 1:00 am, sami nathan <itssami.g...@gmail.com> wrote:
> Whenever I try to execute a python script that is located in the
> /usr/local/bin, python gives me the error 'python: can't open file
> 'django-admin.py': [Errno 2] No such file or directory'.

Please type the following commands (without the $ prompt) and post the
results:

$ type python
$ type django-admin.py
$ head -3 /usr/local/bin/whatever-script-you-want-to-run

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

Friday, October 29, 2010

table namespace hygiene: should I try to rename auth_* tables, or should I use a separate database?

django 1.2, python 2.6, mysql 5.1, etc.

I am sharing a database with others on my project, and I would like to
keep the table namespace neat and tidy.

After poking around the archives for a while, I can't see any good way
to specify names other than the default auth_group,
auth_group_permissions, etc. for the auth module.

I don't want my tables to get confused with someone else's. "auth" is
unfortunately a very generic prefix. One can imagine lots of people
making tables named auth_something.

Is this renaming something that can be done in a reasonable way?

If not, I could create a new database, and devote it to the django
stuff. Is that a good solution? Are there significant disadvantages to
using a separate mysql database just for the django stuff? Is there
maintenance overhead for the dba? (I don't know.) Are there any
disadvantages, say, to doing trans-database joins, or having trans-
database key constraints, vs. within a single database?

Does anyone see any other optimal ways to keep my table namespace
clean?

Thanks
Alex

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

can't open file 'django-admin.py': [Errno 2] No such file or directory'.

Whenever I try to execute a python script that is located in the
/usr/local/bin, python gives me the error 'python: can't open file
'django-admin.py': [Errno 2] No such file or directory'.

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

Re: Django admin for call center support?

Hi,

Yes. I wrote a customer care app with django for a call center with 40+ agents. It is now mostly have custom views and actions but the default django admin was used for a couple of months without any issues. I used proxy models to only show fields in the add client view they need to see(again I did it that way so I don't have to write any views for it).
I also over wrote the admin class queryset method to only show their own clients etc...
So yes it can be done just plan it out properly what they should have access to and use groups for user permissions.

lzantal

On Oct 29, 2010, at 1:54 PM, mack the finger <nbvfour@gmail.com> wrote:

> I'm responsible for writing a customer service application for a
> django project, and it needs to be done by Monday (it's friday now).
> I'm currently getting it built with the Django Admin, but the bosses
> think the interface is too complex for the "knuckle-draggers" that
> commonly answer phones. I'm wondering is anyone out there has ever
> used the Django Admin for such purposes? Did you have to modify the
> interface in any way? Did your customer service agents have trouble
> navigating between the pages? Actually, has anyone out there ever had
> to deploy a Django Admin instance to a group of computer illiterate
> people? Were they able to cope?
>
> --
> 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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: admin usage

I have always had the notion that the admin interface is more about
adding data to the system quickly rather than being the system itself,
the admin interface is very powerful indeed, but I think you may have
better customization/simplification options on your own and reserve
the admin interface for certain tasks (such as adding data like
inventory part numbers) that are not your daily use case o central
functionality.

Regards,
Carlos Daniel Ruvalcaba

On Fri, Oct 29, 2010 at 1:55 PM, Frank Wiles <frank@wiles.org> wrote:
> On Fri, Oct 29, 2010 at 3:13 AM, Alex Kreimer <alex.kreimer@gmail.com> wrote:
>> Hi All,
>>
>> I'm building an app for small retail chain management.  It requires
>> inventory/salespeople/wages etc. management.  There 2 kinds of users:
>> updaters (non-tech managers that are responsible sales locations) and
>> viewers (main office managers that control the organization).
>>
>> 1 Would django admin be suitable for all the update tasks (it looks
>> like admin would be seriously tweaked for this) or should a separate
>> interface be built?
>>
>> 2 Is there a ready piece of code that could be used as a stub for such
>> a task?
>
> While you could definitely shoe horn this into the admin with a bunch
> of customizations, you're likely better off just writing your own
> interface for these tasks. My general rule of thumb is if the end user
> isn't "techie" or they will be using the interface many times per day
> I don't use the admin.
>
> Don't get me wrong, the admin is great, but it isn't ideal for many
> repetitive tasks.
>
> --
> Frank Wiles
> Revolution Systems | http://www.revsys.com/
> frank@revsys.com   | (800) 647-6298
>
> --
> 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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: admin usage

On Fri, Oct 29, 2010 at 3:13 AM, Alex Kreimer <alex.kreimer@gmail.com> wrote:
> Hi All,
>
> I'm building an app for small retail chain management.  It requires
> inventory/salespeople/wages etc. management.  There 2 kinds of users:
> updaters (non-tech managers that are responsible sales locations) and
> viewers (main office managers that control the organization).
>
> 1 Would django admin be suitable for all the update tasks (it looks
> like admin would be seriously tweaked for this) or should a separate
> interface be built?
>
> 2 Is there a ready piece of code that could be used as a stub for such
> a task?

While you could definitely shoe horn this into the admin with a bunch
of customizations, you're likely better off just writing your own
interface for these tasks. My general rule of thumb is if the end user
isn't "techie" or they will be using the interface many times per day
I don't use the admin.

Don't get me wrong, the admin is great, but it isn't ideal for many
repetitive tasks.

--
Frank Wiles
Revolution Systems | http://www.revsys.com/
frank@revsys.com   | (800) 647-6298

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

Django admin for call center support?

I'm responsible for writing a customer service application for a
django project, and it needs to be done by Monday (it's friday now).
I'm currently getting it built with the Django Admin, but the bosses
think the interface is too complex for the "knuckle-draggers" that
commonly answer phones. I'm wondering is anyone out there has ever
used the Django Admin for such purposes? Did you have to modify the
interface in any way? Did your customer service agents have trouble
navigating between the pages? Actually, has anyone out there ever had
to deploy a Django Admin instance to a group of computer illiterate
people? Were they able to cope?

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

Re: Subclassing AdminSite

Just solve my problem.

This was hinted in the doc but wasn't really clear anyways.

The registration has to be made in the same file instantiating your
admin subclass.
I'll submit a doc revision for that.

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

Re: how to develop cms on django

> i dont have time i need to start development within a month..
>
> plz tell me all those crucial topics that i should learn

From the little information I have about your situation I'd say your
better of using a readymade CMS like Wordpress. As much as I love
Django, I do think that you'll be settings yourself up for a world of
pain if you need to have a site up withing a month and have no
previous experience with python.

oivvio


--
http://pipedreams.polite.se/about/


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

Using new classbased generic views in contrib.databrowse

Hi,

Do you think it is relevant to rewrite databrowse to use the new class-
based generic views ?
I'm motivate to work around this and submit a patch, but want first to
discuss about what to do..
IMHO, contrib.databrowse (using class-based views) can provide a
reusable/extendable "base" for rapid development.

Do you use databrowse ? and how (extending the classes ? , or just by
providing your own the template ?)
a JSON/CSV/XLS output could be useful too in databrowse (theses two
last formats could also become core.serializers btw.)

Michael

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

Re: How do I filter/exclude custom queryset fields created by .extra()?

Hi,

Try always not to think SQL and not to use extra. Most of the times there is an alternative without extra. Extra is advanced.

class Node(Model):
       widgets = ForeignKey(Widget)

This query will give you all the different nodes that have the foreign key widgets set to something different than null:

Node.objects.filter(widgets__isnull = False).distinct()

As your ForeignKey widgets can not be null, all nodes in the table will point to at least one widget. So it's the same as if you do:

Node.objects.all().distinct()

Maybe you want to do this:

class Node(Model):
       widgets = ForeignKey(Widget, null=True)

Regards,
Miguel Araujo


2010/10/29 Jumpfroggy <rocketmonkeys@gmail.com>
From a raw SQL standpoint, I've figured out that these constraints
need to be in the HAVING clause, not the WHERE clause.  But it looks
like HAVING is not exposed through the .extra() function, which would
seems logical.  It appears you can create extra fields, but due to
this lack you can't filter on them.  Is there another way to customize
the HAVING field?

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

Re: How do I filter/exclude custom queryset fields created by .extra()?

From a raw SQL standpoint, I've figured out that these constraints
need to be in the HAVING clause, not the WHERE clause. But it looks
like HAVING is not exposed through the .extra() function, which would
seems logical. It appears you can create extra fields, but due to
this lack you can't filter on them. Is there another way to customize
the HAVING field?

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

Aggregates are giving the wrong numbers for .annotate()? What am I doing wrong?

Hi all,

I've been working in django for a while now, but am still wrapping my
head around the more complex queryset features.

I have something like this:

class Foo:
name = CharField()
bars = ForeignKey(Bar)
widgets = ForeignKey(Widget)

I can do this:

Foo.objects.extra(select={
'num_bars': 'SELECT COUNT(*) FROM app_bar WHERE app_bar.foo_id =
app_foo.id',
'num_widgets': 'SELECT COUNT(*) FROM app_widget WHERE
app_widget.foo_id = app_foo.id',
})

That gives me what I want... a list of all foo's with counts of how
many bars & widgets it's linked to.

Name Num Bars Num Widgets
First 1 4
Second 2 3

However, I wanted to use annotations. So I do this:

Foo.objects.annotate(num_bars=Count(bar), num_widgets=Count(widget))

But I get increased counts:

Name Num Bars Num Widgets
First 19 19
Second 5 5

When I spit out the str(queryset.query) var, I get SQL like this:

SELECT
app_foo.name,
COUNT(app_bar.id) AS num_bars,
COUNT(app_widget.id) AS num_widgets
FROM app_foo
LEFT OUTER JOIN app_bar ON ...
LEFT OUTER JOIN app_widget ON ...
WHERE ...
GROUP BY app_food.id

This seems to fail because each LEFT OUTER JOIN gives multiple rows
for each match in the resulting table. Then when COUNT() goes to
work, it will count each of the duplicate rows as another entry. Then
all the COUNT() vars end up being a) larger, and b) the same as each
other, since they're all counting the end-result rows.

I've tried .distinct(), but it does not fix the problem. Am I
misunderstaning .annotate()? Is this a bug? Thanks!

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

Today I released my first Django-app

Hi everyone!

I hope this message is not seen as spam. Today I released my first Django-app as Open Source on Github. It's called django-rules. It's an authorization backend that you can use to flexibly manage per object permissions in your Django projects. I find it very useful and I'm sending this notice here, so you get to know about it. Project's website is: 

Best regards,
Miguel Araujo

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

Re: Forms in a Workflow for Related Models

Hi,

You will need to go step by step. First you ask the user for the reviewer with a form. Then the user has to submit the form. You manage your input form and see if the data for that reviewer already exists, if it does, then you load initial data in the second form. Now you redirect the user to the second form, empty or loaded. This is the usual HTML web application flow, not related to Django.

If you want things to happen dynamically, you will have to use AJAX, you can use any JS library you like. 

Best regards,
Miguel 



2010/10/29 ghachey <ghachey@gmail.com>
Hi,

I think I have a particular case.  I could not find an easy way to do
this going carefully through all the documentation.  I also couldn't
find anything close enough in these archives to help me out with my
limited experience so I am resorting to asking you.

I have a Paper model which records research paper information
(references for a given paper).  And, I have a Questionnaire model
which records a questionnaire instance for a given paper instance.
They look like this,

class Paper(models.Model):
 author = models.CharField(max_length=256)
 title = models.CharField(max_length=256)
 .
 .

class Questionnaire(models.Model):
 paper = models.ForeignKey(Paper,
db_column='paper_fk',blank=True,null=True)
 reviewer = models.CharField(
       verbose_name="Who is the reviewer?",
       max_length=5,choices=REVIEWERS,unique=True)
 question1 = models.CharField(max_length=256)
 .
 .

I have a view that pulls all paper instances (for a particular
research) showing the title and the abstract only on a page.  I would
like to be able to click on the title of any one of the papers opening
a new browser window in which I could complete a questionnaire for
that particular paper.

Ideally, it would ask first which *reviewer* would like to submit (or
update) a questionnaire for that paper (see the Questionnaire model).
Subsequently, it would show an empty Questionnaire form (if reviewer
has not submitted a questionnaire for that paper yet) or the
previously submitted instance of that questionnaire for that paper by
that reviewer.

I simply cannot find an easy way of achieving this.  I have looked at
inline formset (with online one inline), a combination of forms, etc.
but none of those seem to do what I want easily.

Any ideas would be greatly appreciated, even telling me to do this in
a completely different way.

Thank you,

--
GH

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

Re: Multiple Django/Python developer Positions- Atlanta, GA

On Fri, Oct 29, 2010 at 10:27 PM, Kenneth Gonsalves <lawgon@au-kbc.org> wrote:
On Fri, 2010-10-29 at 07:18 -0700, Jack wrote:
> only US Citizens or Greencard holders need apply

please do not put things like this on an international list

I hear that there are many many unclaimed H1B slots :)
But OTOH, i dont think its much of a problem when the recruiter clearly mentions the criteria; you dont want to get loads of applicants which do not satisfy the basic criteria.

-V-

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

Using formsets with multiple models

Hi,

I'm creating an online questionnaire for my local community college,
and hitting a brick wall dealing with formsets. Please can someone
point me in the right direction?

On a questionnaire, you have one or more questions which will require
either an essay answer or multiple choice answers. When creating a new
questionnaire, I would like to show a textarea for the Question.text
common to both types, a radio select for the Question.question_type,
and then present either the EssayQuestion.initial_answer textarea or
the inputs for adding multiple choice options. The user can click "add
question" to append another form beneath to enter a new question. It's
only on the final "save questionnaire" that I handle the POST and
save.

I have spent a few days now trying different permutations of
formsets, modelformsets and inline_formsets but to no avail. The
closest I've got is to create a QuestionFormset, EssayQuestionFormset
and a MultipleChoiceQuestionFormset, then keep track of which form
belongs to which question when saving. I'm not sure how to reconstruct
the forms should it raise validation errors though.

Another option is to create a QuestionForm containing fields for 0..N
possible fields, i.e. multiplechoice_choice_0,
multiplechoice_correct_0, multiplechoice_choice_1,... But this feels
wrong to me.

It seems overly complicated which makes me think I'm going about it
the wrong way. Any help would be much appreciated please!

Thanks,

Bill

Here's my models.py, let me know what else may help.

models.py
========
class Questionnaire(models.Model):
name = models.CharField()

class Question(models.Model):
questionnaire = models.ForeignKey(Questionnaire)
question_type = models.CharField(choices=QUESTION_TYPES)
text = models.TextField()

class EssayQuestion(models.Model):
question = models.OneToOneField(Question)
initial_answer = models.TextField()

class MultipleChoiceQuestion(models.Model):
question = models.ForeignKey(Question)
choice = models.CharField()
correct = models.BooleanField()

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

Re: Multiple Django/Python developer Positions- Atlanta, GA

On Fri, 2010-10-29 at 07:18 -0700, Jack wrote:
> only US Citizens or Greencard holders need apply

please do not put things like this on an international list
--
regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

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

Re: Model Inheritance.

Hi Tom,

You might want to have a look at inheritanceCastModel from django-model-utils by Carl Meyer 
Best regards,
Miguel Araujo

2010/10/29 David De La Harpe Golden <david.delaharpe.golden@ichec.ie>
On 29/10/10 00:04, Tom Eastman wrote:

That's correct, but I want to take a 'Place' object, that doesn't have a
'restaurant', and turn it *in to* a 'Restaurant' by adding the
corresponding row to the Restaurant table.


So you have a place.

p = Place(name="3rd Circle of Hell")
p.save()

This should work:

r = Restaurant(serves_hot_dogs=True)
r.place_ptr = p
r.save()

If you then want an r that has picked up the now-should-be-inherited place attrs, you'll have to do something like:

r = Restaurant.objects.get(pk=r.pk)

print r.name
3rd Circle of Hell



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

Multiple Django/Python developer Positions- Atlanta, GA

Good Morning!

I am looking for Django/Python developers to join the team of one our
clients in Atlanta, GA working on one of the largest Django apps EVER
in - scaled to serve web,mobile, and more for 100+ prominent
newspaper, TV, and radio sites! There are 3-5 job openings and they
are looking for someone who can hit the ground running! Please send me
an e-mail at jmabbett@apexsystemsinc.com or call at (770) 481-0044 and
I would love to tell you more details!

Company: Leading communications, media and automotive services
company.
Role: Application Developer
Length: 6 Month to Hire
Location: Atlanta, GA
Interview Process: Phone and Face to Face
Compensation: 60k to 100k

Please reply if you or someone you know if looking for a job as a
expert Python or Django Developer.

only US Citizens or Greencard holders need apply

Thanks!

Jack

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