Re: Django, Eclipse, Autocomplete

2010-11-16 Thread Simone Dalla
2010/11/16 xpanta 

> Hi,
>
> I am using eclipse Galileo (Build id: 20100218-1602) and PyDev to
> build a Django project.
>
> Autocompletion works fine for python language but not for django. For
> example in models.py I cannot get the
> field = models.CharField(max_length=100) to be autocompleted.
>
> I have added path\to\python26\Lib\site-packages\django to my
> PYTHONPATH variables (system-wide and project-specific).
>
> what else should I do?
>
> (PS. I didn't create the django project through eclipse. I created
> using command line and then imported the project to eclipse later)
>
> Any help would be appreciated,
> Chris



Preferences --> PyDev --> Interpreter Python --> Auto Config

this reconfigure the PYTHONPATH for Eclipse. If you have Django installed
into your system, restart Eclipse and after autocompletion works fine.




-- 
Simo

- Registered Linux User #395060

- Software is like sex, it is better when it is free  --> Linus B. Torvalds

-- 
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.



-bash: django-admin.py: command not found

2010-11-16 Thread ErritG
Hello everybody,

Even though many posts on the internet address this issue I haven't
been able to tackle it using version Python 2.7. Any help is welcom
for this new comer!

Thanks in advance for kind coop.

Errit.

-- 
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: Django, Eclipse, Autocomplete

2010-11-16 Thread xpanta
Thanks a lot.

it seems to work, now :-)

I don't know why, but I also had to remove PYTHONPATH environment
variable (my computer -> properties -> etc...)  in order for auto-
config to configure python-django properly...

Thanks again for your time,
Chris


On Nov 16, 10:33 am, Simone Dalla  wrote:
> 2010/11/16 xpanta 
>
>
>
> > Hi,
>
> > I am using eclipse Galileo (Build id: 20100218-1602) and PyDev to
> > build a Django project.
>
> > Autocompletion works fine for python language but not for django. For
> > example in models.py I cannot get the
> > field = models.CharField(max_length=100) to be autocompleted.
>
> > I have added path\to\python26\Lib\site-packages\django to my
> > PYTHONPATH variables (system-wide and project-specific).
>
> > what else should I do?
>
> > (PS. I didn't create the django project through eclipse. I created
> > using command line and then imported the project to eclipse later)
>
> > Any help would be appreciated,
> > Chris
>
> Preferences --> PyDev --> Interpreter Python --> Auto Config
>
> this reconfigure the PYTHONPATH for Eclipse. If you have Django installed
> into your system, restart Eclipse and after autocompletion works fine.
>
> --
> Simo
>
> - Registered Linux User #395060
>
> - Software is like sex, it is better when it is free  --> Linus B. Torvalds

-- 
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: -bash: django-admin.py: command not found

2010-11-16 Thread Robbington


I dont think you are going to get a great deal of help if you just
repeat your posts, 
http://groups.google.com/group/django-users/browse_thread/thread/bab395cd78eca494?hl=en#
There was some sound advice from experienced users of Django and
Linux.

There are also already some great tutorials on installing Django,
django admin commands and this problem,

http://code.djangoproject.com/wiki/InstallationPitfalls
http://docs.djangoproject.com/en/dev/ref/django-admin/?from=olddocs
http://docs.djangoproject.com/en/dev/topics/install/?from=olddocs

If you are still having trouble after the solution being
comprehensivley explained go further by stating what you dont
understand, or where you are struggling.

As it was stated before, its not to do with your version of Python,
but your installation of Django. a copy of Django-admin.py needs to be
in the folder usr/bin for your linux system to know that it is a
system command.

-- 
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: Automatically assume "models." prefix in models.py

2010-11-16 Thread bruno desthuilliers
On Nov 15, 3:57 pm, James  wrote:
> On Mon, Nov 15, 2010 at 7:48 AM, bruno desthuilliers
>  wrote:

> > On a more general level, I very
> > strongly suggest you spend some time learning Python
>
>
> Good point. I've actually been working through Learn Python the Hard
> Way & How to Think Like A Computer Scientist.
>

I you have any previous experience with another imperative programming
language, do yourself a favor and start with the FineManual's
tutorial.

-- 
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: Set Language in the Admin

2010-11-16 Thread Federico Capoano
This will affect the frontend too?


On Nov 16, 4:57 am, someLiang  wrote:
> just make it seems like this:
>
> MIDDLEWARE_CLASSES = (
>     'django.middleware.common.CommonMiddleware',
>     'django.contrib.sessions.middleware.SessionMiddleware',
>     #'django.middleware.locale.LocaleMiddleware',
>     'django.middleware.csrf.CsrfViewMiddleware',
>     'django.contrib.auth.middleware.AuthenticationMiddleware',
>     'django.contrib.messages.middleware.MessageMiddleware',
> )
>
> 2010/11/16 someLiang 
>
>
>
>
>
>
>
>
>
> > perhaps you need to comment the statement in your setting.py
>
> > 'django.middleware.locale.LocaleMiddleware',
>
> > 2010/11/15 Federico Capoano 
>
> > Hi guys,
>
> >> i'm developing an app in 3 languages, en, es and it.
>
> >> My browser accepts all of them with priority to italian.
>
> >> Since I've done that the admin started to show up in italian. How can
> >> I force it back to english?
>
> >> In the setting I put
>
> >> LANGUAGE_CODE = 'en-gb'
>
> >> --
> >> 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 >>  groups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/django-users?hl=en.
>
> > --
> > Rita Liang
>
> --
> Rita Liang

-- 
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: Nested Categories in Admin

2010-11-16 Thread Federico Capoano
Any suggestion?


On Nov 14, 6:15 pm, Federico Capoano  wrote:
> Hi all,
>
> I would like to find a way to get categories and subcategories
> displayed in the admin, in the form of a multiple select.
>
> Like:
>
> parent
> child1
> child2
> parent2
> child3
>
> Do I have to make a custom field or is there already a solution
> around?
>
> 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-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: Set Language in the Admin

2010-11-16 Thread Tom Evans
On Tue, Nov 16, 2010 at 9:58 AM, Federico Capoano
 wrote:
> This will affect the frontend too?
>

Yes, I'd replace it with a customized version of the LocaleMiddleware,
something like this ought to do the trick:

from django.middleware.locale import LocaleMiddleware
from django.utils import translation

class LocaleButNotInAdminMiddleware(LocaleMiddleware):
  KWARG = 'DisableLocalisation'
  def process_view(self, request, view_func, view_args, view_kwargs):
disable_localisation = self.KWARG in view_kwargs and
view_kwargs.pop(self.KWARG)
if disable_localisation:
  translation.deactivate()
  if hasattr(request, 'LANGUAGE_CODE')
del request.LANGUAGE_CODE
  def process_response(self, request, response):
if hasattr(request, 'LANGUAGE_CODE'):
  super(LocaleButNotInAdminMiddleware,
self).process_response(request, response)
return response

and then change how you include the admin into your urlconf from
something like this:

  urlpatterns = patterns('',
(r'^admin/(.*)', include(admin.site.urls)),
  )

to something like this:

  urlpatterns = patterns('',
(r'^admin/(.*)', include(admin.site.urls), {'DisableLocalisation': True}),
  )

So that it disables the effects of the LocaleMiddleware when the view
to be served will be passed the appropriate kwarg, and the kwarg is
passed to the view by configuring it so in the urlconf. The kwarg
should never make it to the admin views.

Cheers

Tom

-- 
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: script adding FileField, no attribute chunks

2010-11-16 Thread Tom Evans
On Tue, Nov 16, 2010 at 12:24 AM, Mitch Anderson  wrote:
> I'm having a problem with a command script that I want to create a
> object that has a FileField as part of the model.
>
> My Model Looks like this:
>
> class Files(models.Model):
>    STATUS = (
>                ('unknown', 'Unknown'),
>                ('down', 'Downloading'),
>                ('done', 'Done'),
>                ('dup', 'Duplicate')
>        )
>    file = models.FileField(upload_to = "files/%Y-%m")
>    date_added = models.DateTimeField(auto_now_add=True)
>    date_started = models.DateTimeField(blank=True)
>    date_finished = models.DateTimeField(blank=True)
>    date_pub = models.DateTimeField(blank=True)
>    status = models.CharField(max_length=8, choices=STATUS)
>    download = models.BooleanField(blank=True)
>
>
> And then in my command script, it looks like this:
>
> class Command(BaseCommand):
>        help = 'Scan RSS Feed and Download Files.'
>
>        def getFiles(self):
>                for tors in self.fetch:
>                        newfile = Files()
>                        filename = files['link'].rsplit('/',1)[1]
>                        u = urllib2.urlopen(files['link'])
>                        localFile = open('/tmp/%s' % filename, 'w')
>                        localFile.write(u.read())
>                        localFile.close()
>                        #newfile.file.open('/tmp/%s' % filename, 'b')
>                        newfile.file.save(filename,open('/tmp/%s' % 
> filename).read())
>                        #newfile.file('/tmp/%s' % filename)
>                        newfile.date_pub(files['pubdate'])
>                        newfile.status('unknown')
>                        newfile.download('True')
>                        newfile.save()
>
>        def getLink(self,mfile):
>                m = re.compile(mfile.regex,re.I)
>                feed = self.feed
>
>                for e in feed.entries:
>                        if m.search(e.link):
>                                self.fetch.append({'name': mfile.name, 'link': 
> e.link, 'pubdate':
> e.updated_parsed })
>
>
>        def handle(self, *args, **options):
>                mf = MyFiles.objects.all()
>                # fetch and parse RSS Feed
>                self.feed = feedparser.parse(Feeds.objects.all()[0].rss)
>                self.fetch = []
>                # Set self.fetch list
>                for s in mf:
>                        self.getLink(s)
>
>                # download, record and save files
>                self.getFiles()
>
>
> But I get the following error when I run it:
>
>  File "/home/mitch/Projects/meta/Filez/management/commands/files_check.py",
> line 30, in getFiles
>    newfile.file.save(filename,open('/tmp/%s' % filename).read())
>  File "/usr/lib/pymodules/python2.6/django/db/models/fields/files.py",
> line 92, in save
>    self.name = self.storage.save(name, content)
>  File "/usr/lib/pymodules/python2.6/django/core/files/storage.py",
> line 48, in save
>    name = self._save(name, content)
>  File "/usr/lib/pymodules/python2.6/django/core/files/storage.py",
> line 168, in _save
>    for chunk in content.chunks():
> AttributeError: 'str' object has no attribute 'chunks'
>
> Which, from what I've seen... chunks is part of an HTTP POST file
> object?  So... its not supposed to work as command line script?  or
> what am I doing 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-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.
>
>

Django doesn't want a python file or text for a django file field, it
wants a django.core.files.File. I find the easiest one to use is the
InMemoryUploadedFile. Here is a snippet I use for fetching an image
from the web, and creating a django.core.files.File object that can be
assigned to a FileField or ImageField on a model:

  h = httplib2.Http()
  req, content = h.request(uri)
  if req['status'] != '200':
print u'Failed to fetch image from %s' % uri
return None

  import cStringIO
  from django.core.files.uploadedfile import InMemoryUploadedFile
  out = cStringIO.StringIO()
  out.write(content)
  return InMemoryUploadedFile(
  file=out,
  field_name=field,
  name=name,
  content_type=req['content-type'],
  size=out.tell(),
  charset=None)

field should be the name of the field on the model, name should be the
file name of the resource.

There may be neater ways of doing this, but this keeps it in memory
until django saves it to the upload_to location specified on the
model, and avoids writing it to disk only for django to write it to
disk again.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to 

Re: -bash: django-admin.py: command not found

2010-11-16 Thread ErritG
Let me start of with apologising for a double post and thanking you
for your reference.

I think my problem lays with finding the right directory. From the
offered solution (http://code.djangoproject.com/wiki/
InstallationPitfalls) I don't now how to determine the right 'Link
/bin/django-admin.py to whereever on your PATH'
So far I have found out that python seems to be 'hiding' in /Library/
Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
My question now is: how should I phrase the 'sudo ln -s' command?

Thanks again for your help!

Bgrds,

Errit.


On 16 nov, 10:47, Robbington  wrote:
> I dont think you are going to get a great deal of help if you just
> repeat your 
> posts,http://groups.google.com/group/django-users/browse_thread/thread/bab3...
> There was some sound advice from experienced users of Django and
> Linux.
>
> There are also already some great tutorials on installing Django,
> django admin commands and this problem,
>
> http://code.djangoproject.com/wiki/InstallationPitfallshttp://docs.djangoproject.com/en/dev/ref/django-admin/?from=olddocshttp://docs.djangoproject.com/en/dev/topics/install/?from=olddocs
>
> If you are still having trouble after the solution being
> comprehensivley explained go further by stating what you dont
> understand, or where you are struggling.
>
> As it was stated before, its not to do with your version of Python,
> but your installation of Django. a copy of Django-admin.py needs to be
> in the folder usr/bin for your linux system to know that it is a
> system command.

-- 
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: Django, Eclipse, Autocomplete

2010-11-16 Thread Simone Dalla
2010/11/16 xpanta 

> Thanks a lot.
>
> it seems to work, now :-)
>
> I don't know why, but I also had to remove PYTHONPATH environment
> variable (my computer -> properties -> etc...)  in order for auto-
> config to configure python-django properly...
>
> Thanks again for your time,
>

De nada ;-)


-- 
Simo

- Registered Linux User #395060

- Software is like sex, it is better when it is free  --> Linus B. Torvalds

-- 
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.



como instalar bibliotecas ReportLab dentro do projeto django?

2010-11-16 Thread Josueh Machado
ola a todos,
estou desenvolvendo um sistema web com django e estou com dificuldades
da geração de relatórios...
na hospedagem eles nao tem o ReportLab e Pisa instalados, entao, eu
queria instalar essas biblitecas dentro do proprio projeto, tem como?
obrigado

-- 
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: -bash: django-admin.py: command not found

2010-11-16 Thread Robbington
Thats ok, I can appriciate how frustrating it can be trying to learn
of your own back from the beginning as a lot of the advice can seem to
be in a foreign language. But if you dont understand you need to state
that, as often if you double post people will just ignore you, noone
gets paid to submit on these forums.


Anyways, to your problem.

Firstly, understand that python looks in the folder site-packages to
find any additional packages like django. I'm guessing that your
problem is that you have not installed Django properly, check to see
if you have a folder in site-packages named Django.

Secondly, Linux looks in the usr/bin folder for system commands. So
When you type django-admin.py into the command prompt, linux looks in
that folder and if it cant find djang-admin.py it returns that error
you are seeing.

At the command prompt: find / -name 'django' to make sure that there
is a folder inside site-packages called django.

How are you going about installing django? apt-get install,
easy_install, pip install?




As mentioned before creating a symbolic link isnt the best way to go
about it, installing django properly is your best bet. You will save
yourself a lot of trouble in the long run.

But just getting it working is often half the learning battle, so if
you feel you really need to, locate django-admin.py: find / -name
'django-admin.py'

and make a symbolic link to your usr/bin folder. It should be located
at /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
site-packages/django/bin/django-admin.py

So you would type: sudo ln -s /Library/Frameworks/Python.framework/
Versions/2.7/lib/python2.7/site-packages/django/bin/django-admin.py /
usr/bin.

I hope I havnt been to condesending, just trying to put it in easy
terms. I will however STRESS again, dont just create a symbolic link,
install Django properly.

Rob

-- 
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: Django, Eclipse, Autocomplete

2010-11-16 Thread Recep KIRMIZI
use vim and feel happy :D
here are the django template and model templates.
https://github.com/msanders/snipmate.vim


Pzt, 2010-11-15 tarihinde 23:44 -0800 saatinde, xpanta yazdı:
> Hi,
> 
> I am using eclipse Galileo (Build id: 20100218-1602) and PyDev to
> build a Django project.
> 
> Autocompletion works fine for python language but not for django. For
> example in models.py I cannot get the
> field = models.CharField(max_length=100) to be autocompleted.
> 
> I have added path\to\python26\Lib\site-packages\django to my
> PYTHONPATH variables (system-wide and project-specific).
> 
> what else should I do?
> 
> (PS. I didn't create the django project through eclipse. I created
> using command line and then imported the project to eclipse later)
> 
> Any help would be appreciated,
> Chris
> 


-- 
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: CI

2010-11-16 Thread Nick Lo
Hi Johannes,

You may be interested in this project:

https://github.com/kmmbvnr/django-hudson

Cheers,

Nick

On Nov 14, 5:36 am, Johannes Nel  wrote:
> answering my own questions here:
>
> By the looks of things I will stick with hudson for now, I found some
> information on coverage tools as well (all though there seems to be no
> sonar plugin, prob because nobody has been bothered to use maven for
> django yet)
> I also found a project called Fabric for deployment, which looks
> pretty powerfull, but more investigation is needed.
>
> If anyone has got some experience in fabric and hudson integration or
> a good resource on propagation strategies will be much appreciated.
>
>
>
>
>
>
>
>
>
> On Sat, Nov 13, 2010 at 4:56 PM, Johannes Nel  wrote:
> > Hi All
>
> > What do you guys use for CI servers? Also where can I get some
> > detailed info on application propagation strategies (from dev, to qa,
> > to uat to prod) for django
>
> > As a side note, I think the getting started documentation should be
> > updated to reflect the use of relative paths
> >http://rob.cogit8.org/blog/2008/Jun/20/django-and-relativity/
>
> > johan
>
> > --
> > j:pn
> > \\no comment
>
> --
> j:pn
> \\no comment

-- 
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.



Django NameError in first web app

2010-11-16 Thread frank
hi all,

i just doing Django..tried the first example in Django book...i
encountered problem at admin page. it says that admin is not defined.
i followed each step in tutorial and i am able to run django server
also. pls help me to solve it.
i am adding error output here.

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/admin/
Django Version: 1.2.3
Python Version: 2.7.0
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'mysite.polls',
'django.contrib.admin']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in
get_response
91. request.path_info)
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in
resolve
215. for pattern in self.url_patterns:
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in
_get_url_patterns
244. patterns = getattr(self.urlconf_module, "urlpatterns",
self.urlconf_module)
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in
_get_urlconf_module
239. self._urlconf_module = import_module(self.urlconf_name)
File "C:\Python27\lib\site-packages\django\utils\importlib.py" in
import_module
35. __import__(name)
File "C:\Users\Jeyashree\mysite\..\mysite\urls.py" in 
15. (r'^admin/', include(admin.site.urls)),

Exception Type: NameError at /admin/
Exception Value: name 'admin' is not defined

-- 
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: Django NameError in first web app

2010-11-16 Thread Recep KIRMIZI
You should uncomment admin from the top of the urls.py
it should be imported
from django.contrib import admin
and also
admin.autodiscover()


Sal, 2010-11-16 tarihinde 03:49 -0800 saatinde, frank yazdı:
> hi all,
> 
> i just doing Django..tried the first example in Django book...i
> encountered problem at admin page. it says that admin is not defined.
> i followed each step in tutorial and i am able to run django server
> also. pls help me to solve it.
> i am adding error output here.
> 
> Environment:
> 
> Request Method: GET
> Request URL: http://127.0.0.1:8000/admin/
> Django Version: 1.2.3
> Python Version: 2.7.0
> Installed Applications:
> ['django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.messages',
> 'mysite.polls',
> 'django.contrib.admin']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware')
> 
> 
> Traceback:
> File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in
> get_response
> 91. request.path_info)
> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in
> resolve
> 215. for pattern in self.url_patterns:
> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in
> _get_url_patterns
> 244. patterns = getattr(self.urlconf_module, "urlpatterns",
> self.urlconf_module)
> File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in
> _get_urlconf_module
> 239. self._urlconf_module = import_module(self.urlconf_name)
> File "C:\Python27\lib\site-packages\django\utils\importlib.py" in
> import_module
> 35. __import__(name)
> File "C:\Users\Jeyashree\mysite\..\mysite\urls.py" in 
> 15. (r'^admin/', include(admin.site.urls)),
> 
> Exception Type: NameError at /admin/
> Exception Value: name 'admin' is not defined
> 


-- 
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: -bash: django-admin.py: command not found

2010-11-16 Thread Matthias Runge
Make sure wether django is properly  installed on your system. I think your 
problem lies there. 
Matthias



"ErritG"  schrieb:

>Hello everybody,
>
>Even though many posts on the internet address this issue I haven't
>been able to tackle it using version Python 2.7. Any help is welcom
>for this new comer!
>
>Thanks in advance for kind coop.
>
>Errit.
>
>-- 
>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.

-- 
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: -bash: django-admin.py: command not found

2010-11-16 Thread Nuño Iglesias
El Tue, 16 Nov 2010 00:43:21 -0800 (PST)
ErritG  escribió:
> Hello everybody,
> 
> Even though many posts on the internet address this issue I haven't
> been able to tackle it using version Python 2.7. Any help is welcom
> for this new comer!
> 
> Thanks in advance for kind coop.
> 
> Errit.
> 

Try to add "python" 
  $python manage.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: Django Dropdown List

2010-11-16 Thread derek
" you'll have to have all the states/provinces as 'choices' in the
ChoiceField in the form, otherwise the form won't validate."

Yup, this is a "real" gotcha.  IMO, its not really true filtering if
you take this approach, as the initial form will still load the X
million items, even though the user will only be shown a fraction at a
time.

On Nov 15, 6:39 pm, Shawn Milochik  wrote:
> You'll need to use AJAX for this, or refresh the entire page.
>
> Be aware that you'll have to have all the states/provinces as
> 'choices' in the ChoiceField in the form, otherwise the form won't
> validate.
>
> As for examples, just do a quick Google search. The easiest way (in my
> opinion) is to use jQuery for the AJAX and have views in your Django
> project that receives the request from jQuery and returns JSON.
>
> Shawn

-- 
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.



Send emails form multiple accounts

2010-11-16 Thread diegue...@gmail.com
Hi Guys,

We have many projects with django and in one project we need send 3 kinds of
email:

 - newsletter
 - contact email
 - errors

now, my question is how i can use multiple accounts, multiple user/password
from gmail for send this mails, i mean, in the settings i have this:

EMAIL_SUBJECT_PREFIX = '[conosur]'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'prue...@monoku.com'
EMAIL_HOST_PASSWORD = '*'
EMAIL_USE_TLS = True

and all emails are send with the user prue...@monoku.com, a google apps
account, but how i can send mails from 3 accounts?

-- 
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-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.



ValueError: Empty module name

2010-11-16 Thread ErritG
Hi everybody,

While taking the tutorial 'Writing your first Django app, part 1' if
stumbled on the command 'python manage.py sql polls' Running this
command gave the following output (if only listed the last part)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
ValueError: Empty module name

If found several posts but none so far addressed this problem in
particular.

Thanks for kind coop in advance!

Errit.

-- 
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: Send emails form multiple accounts

2010-11-16 Thread Shawn Milochik
What version of Django are you using?

Also, you can create a customized Connection() for each piece of mail you send:
http://docs.djangoproject.com/en/dev/topics/email/

Shawn

-- 
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: Django mod_python under apache

2010-11-16 Thread Sells, Fred
I find that flushing stdout sometimes crashes the dev server -- weird.  Anyway, 
if you make a minor mod to any file and save changes it flushes stdout.

But the guys who suggested python logging are right on for doing it the "right 
way"

-Original Message-
From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com] On 
Behalf Of Graham Dumpleton
Sent: Saturday, November 13, 2010 1:28 AM
To: Django users
Subject: Re: Django mod_python under apache

For mod_python the result of using print will only show in Apache
error log when you do an explicit flush of stdout. If using mod_wsgi,
it autoflushes on newline so you don't have this problem.

Graham

On Nov 13, 7:29 am, vivek_12315  wrote:
> I have configured Django with mod_python under apache web server.
>
> I would like to know, where can i see the print statements output for
> debugging which i put in python files in django views.
>
> I dont think print statement appears in Apache logs ...

-- 
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.


-- 
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: Send emails form multiple accounts

2010-11-16 Thread diegue...@gmail.com
I'm using django 1.2 but i dont know how connections works exactly, i wish
use only one backend, SMTP, but how i tell the connection, the new user for
authentication for smtp?


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



On Tue, Nov 16, 2010 at 10:35, Shawn Milochik  wrote:

> What version of Django are you using?
>
> Also, you can create a customized Connection() for each piece of mail you
> send:
> http://docs.djangoproject.com/en/dev/topics/email/
>
> Shawn
>
> --
> 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.
>
>

-- 
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: Send emails form multiple accounts

2010-11-16 Thread Shawn Milochik
On Tue, Nov 16, 2010 at 10:39 AM, diegue...@gmail.com
 wrote:
> I'm using django 1.2 but i dont know how connections works exactly, i wish
> use only one backend, SMTP, but how i tell the connection, the new user for
> authentication for smtp?
>

Read the fine Django docs at the link I attached. Your answers are
there. I can't read them for you.

Shawn

-- 
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: Send emails form multiple accounts

2010-11-16 Thread diegue...@gmail.com
I already read that part of doc, but i dont find the answer, should i read
the code?

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



On Tue, Nov 16, 2010 at 10:44, Shawn Milochik  wrote:

> On Tue, Nov 16, 2010 at 10:39 AM, diegue...@gmail.com
>  wrote:
> > I'm using django 1.2 but i dont know how connections works exactly, i
> wish
> > use only one backend, SMTP, but how i tell the connection, the new user
> for
> > authentication for smtp?
> >
>
> Read the fine Django docs at the link I attached. Your answers are
> there. I can't read them for you.
>
> Shawn
>
> --
> 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.
>
>

-- 
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: django tagging app choices

2010-11-16 Thread Scot Hacker
On Nov 15, 8:55 pm, Thomas Schreiber  wrote:
> check the grids on django packages:http://djangopackages.com/grids/g/tagging/

django-taggit seems to be the new hotness. Unfortunately we've been
waiting for months for a conversion script to help us migrate from
django-tagging to django-taggit.

./s

-- 
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: OT: getting strange attempted gets

2010-11-16 Thread Scot Hacker
On Nov 15, 8:45 pm, Steve Holden  wrote:
>
> Perhaps he did, but that's no reason to believe him until we know that
> his assessment of the situation  is likely to be realistic. Don't forget
> that a lot of people who post here aren't particularly experienced and
> so may not appreciate exactly what's going on.

I dunno. When you sit there watching runserver registering hits on
bizarre URLs and you know you're not the one clicking through the test
site, it's pretty obvious that something else is going on.

./s

-- 
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: Send emails form multiple accounts

2010-11-16 Thread diegue...@gmail.com
I think my question wasn't explicit,

in the file django/core/mail/backends/smtp.py i found the
class EmailBackend, in the constructor i can send the host, user and
password for the smtp connection, but in what moment y can call this
constructor with the new user/password? should i make a diferent Backend for
each email? i thinks this is not muy django philosophy...



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



On Tue, Nov 16, 2010 at 10:47, diegue...@gmail.com wrote:

> I already read that part of doc, but i dont find the answer, should i read
> the code?
>
> --
>
> Diego Andrés Sanabria
> Ingeniería de Sistemas Universidad Distrital
> about:me http://www.google.com/profiles/diegueus9
> cel 3015290609
>
>
>
> On Tue, Nov 16, 2010 at 10:44, Shawn Milochik  wrote:
>
>> On Tue, Nov 16, 2010 at 10:39 AM, diegue...@gmail.com
>>  wrote:
>> > I'm using django 1.2 but i dont know how connections works exactly, i
>> wish
>> > use only one backend, SMTP, but how i tell the connection, the new user
>> for
>> > authentication for smtp?
>> >
>>
>> Read the fine Django docs at the link I attached. Your answers are
>> there. I can't read them for you.
>>
>> Shawn
>>
>> --
>> 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.
>>
>>
>

-- 
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: Send emails form multiple accounts

2010-11-16 Thread Tom Evans
On Tue, Nov 16, 2010 at 3:47 PM, diegue...@gmail.com
 wrote:
> I already read that part of doc, but i dont find the answer, should i read
> the code?

Yeah, don't bother, send them all from the same account, with
different from addresses in the message - no-one looks at the envelope
much..

Quick example

In two lines:

from django.core.mail import send_mail

send_mail('Subject here', 'Here is the message.', 'f...@example.com',
['t...@example.com'], fail_silently=False)

If you wish to change the 'f...@example.com', well, can you try
changing the 'f...@example.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-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: Send emails form multiple accounts

2010-11-16 Thread diegue...@gmail.com
My mistake, Shawn was right, almost in part, in this
http://docs.djangoproject.com/en/dev/topics/email/#send-mail

i can call de method send_mail with a auth_user and auth_password for
authentication with the smtp backend, but this doesn't have connection with
get_connection method.

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



On Tue, Nov 16, 2010 at 10:52, Tom Evans  wrote:

> On Tue, Nov 16, 2010 at 3:47 PM, diegue...@gmail.com
>  wrote:
> > I already read that part of doc, but i dont find the answer, should i
> read
> > the code?
>
> Yeah, don't bother, send them all from the same account, with
> different from addresses in the message - no-one looks at the envelope
> much..
>

google and ther politics of spam looks for that ;)


>
> Quick example
>
> In two lines:
>
> from django.core.mail import send_mail
>
> send_mail('Subject here', 'Here is the message.', 'f...@example.com',
>['t...@example.com'], fail_silently=False)
>
> If you wish to change the 'f...@example.com', well, can you try
> changing the 'f...@example.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-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.
>
>

-- 
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: Send emails form multiple accounts

2010-11-16 Thread Tom Evans
On Tue, Nov 16, 2010 at 4:07 PM, diegue...@gmail.com
 wrote:
> On Tue, Nov 16, 2010 at 10:52, Tom Evans  wrote:
>>
>> Yeah, don't bother, send them all from the same account, with
>> different from addresses in the message - no-one looks at the envelope
>> much..
>
> google and ther politics of spam looks for that ;)
>

Just to comment on this bit - they don't very much. The content of
your email contributes much more to your spam score than having a
different envelope-from and message From header, or having a
Return-Path header different from the From header in the message.

Cheers

Tom

-- 
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: Send emails form multiple accounts

2010-11-16 Thread diegue...@gmail.com
On Tue, Nov 16, 2010 at 11:20, Tom Evans  wrote:

> On Tue, Nov 16, 2010 at 4:07 PM, diegue...@gmail.com
>  wrote:
> > On Tue, Nov 16, 2010 at 10:52, Tom Evans 
> wrote:
> >>
> >> Yeah, don't bother, send them all from the same account, with
> >> different from addresses in the message - no-one looks at the envelope
> >> much..
> >
> > google and ther politics of spam looks for that ;)
> >
>
> Just to comment on this bit - they don't very much. The content of
> your email contributes much more to your spam score than having a
> different envelope-from and message From header, or having a
> Return-Path header different from the From header in the message.
>
>
my issue is more related with the bound of emails per day and etc... we have
a app for newsletter and nearby of 2000 users, so, is usefull have one
account for newsletter and another for errors and email of contact


> Cheers
>
> Tom
>
> --
> 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.
>
>

-- 
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: Send emails form multiple accounts

2010-11-16 Thread Tom Evans
On Tue, Nov 16, 2010 at 4:26 PM, diegue...@gmail.com
 wrote:
> my issue is more related with the bound of emails per day and etc... we have
> a app for newsletter and nearby of 2000 users, so, is usefull have one
> account for newsletter and another for errors and email of contact
>

Google will disable your account temporarily* if you send emails to
more than 500 users in a short period (24 hr, I believe), or receive
bounce backs (failed delivery attempts) from more than 25 users in a
short period. Furthermore, you can't address an email to more than 100
recipients using gmail via SMTP (you can address more recipients using
the web interface).


Cheers

Tom

* 'temporarily' is anything from 24 hrs to 3-4 days.

-- 
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.



Guidelines for changing the default encoding of a Django site

2010-11-16 Thread George Sakkis
Hi all,

sorry for reposting this from stackoverflow [1] but I'm hoping to hear
from more people who may have experience with this sort of thing.

Django comes with unicode support out of the box and it supports utf-8
by default. Say that you have developed, debugged and tested
successfully a site with a bunch of Django apps in utf-8. What steps
would you take for a mostly painless migration to a different
encoding, say latin-1 ? It would be great if all it needs is setting
DEFAULT_CHARSET = 'latin-1' and changing the encoding of the database
but I somehow doubt it is that simple.

For the sake of the discussion let's ignore the migration of any
already stored utf-8 data in the database; I'm mostly interested in
what should I be looking for in the Django codebase, as well the
database and web server configuration changes if necessary.

George

[1] 
http://stackoverflow.com/questions/4192728/guidelines-for-changing-the-default-encoding-of-a-django-site

-- 
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.



Vobject

2010-11-16 Thread MikeKJ

Anyone got any experience of the vObject associated to vcard entry,
specifically to enter a work telephone number AND a fax number as well as a
web page address, I've read through the vobject stuff and vcard stuff and I
am none the wiser, what I have at the moment can write the tel and can write
the fax but not both together and the url doesnt write it to where I
expected it!


import vobject


def _vcard_string(person):
"""
Helper function for vcard views. Accepts a 'person' object
with certain attributes (firstname, lastname, email, phone, id)
and returns a string containing serialized vCard data.
"""
# vobject API is a bit verbose...
v = vobject.vCard()
v.add('n')
v.n.value =\
vobject.vcard.Name(family=person.lastname, given=person.firstname)
v.add('fn')
v.fn.value = "%s %s" % (person.firstname, person.lastname)
v.add('email')
v.email.value = person.email
v.add('tel')
v.tel.value = person.phone
v.tel.type_param = 'WORK'
v.add('tel')
v.tel.value = person.fax
v.tel.type_param = 'FAX'
v.add('url')
v.url.value =\
"http://www.asite/%s"; % person.public_cv_slug()
output = v.serialize()
return output


def vcard(request, person_id):
"""
View function for returning single vcard
"""
person = User.objects.get(pk=person_id)
output = _vcard_string(person)
filename = "%s%s.vcf" % (person.firstname, person.lastname)
response = HttpResponse(output, mimetype="text/x-vCard")
response['Content-Disposition'] = 'attachment; filename=%s' % filename
return response


-- 
View this message in context: 
http://old.nabble.com/Vobject-tp30231001p30231001.html
Sent from the django-users mailing list archive at Nabble.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-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: Django Dropdown List

2010-11-16 Thread Simone Dalla
2010/11/16 Derek 

> Sean
>
> I hear what you say - but is this approach also readily available inside
> the Admin framework?


Absolutely yes.

-- 
Simo

- Registered Linux User #395060

- Software is like sex, it is better when it is free  --> Linus B. Torvalds

-- 
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.



appling fix from fixed ticket's backport

2010-11-16 Thread Cek
Hello all!

I'm quite new to Django, and this is my first post to this group, so
pls excuse and correct me if it's the wrong place or something like
that.

I am trying to use eav-django (http://pypi.python.org/pypi/eav-
django), but it won't work because of Ticket #14471 (http://
code.djangoproject.com/ticket/14471). Now, since the ticket in
question is "closed: fixed", I was wondering is there a way to apply
the fix now, and skip the wait for 1.3 release?

I have applied changes that are marked in the backport (http://
code.djangoproject.com/changeset/14390), but nothing has changed. Both
eav-django and test.py attached to the ticket throw the same error.

However, I only applied changes to django/db/models/fields/related.py,
because I couldn't find the other two files. Are they relevant at all?
What else can I try to make it work?

-- 
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.



HttpResponse generator and HTML5 EventSource

2010-11-16 Thread msimr
I'm trying to build a simple view that send and
HttpResponse(my_generator()) back to the new HTML5 EventSource object
on the client.

Only the first iteration of my infinite generator is passed.
Afterwards, all I get is a broken pipe error.

Seems like the HttpResponse connection is dropped after the first
flush.

Anyone as experience working with Django and a JS EventSource?

-- 
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: OT: getting strange attempted gets

2010-11-16 Thread Steve Holden
On 11/16/2010 10:52 AM, Scot Hacker wrote:
> On Nov 15, 8:45 pm, Steve Holden  wrote:
>>
>> Perhaps he did, but that's no reason to believe him until we know that
>> his assessment of the situation  is likely to be realistic. Don't forget
>> that a lot of people who post here aren't particularly experienced and
>> so may not appreciate exactly what's going on.
> 
> I dunno. When you sit there watching runserver registering hits on
> bizarre URLs and you know you're not the one clicking through the test
> site, it's pretty obvious that something else is going on.
> 
But until we've seen the URLs we have no idea whether they really are
unrelated, do we?

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
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: representing a possible future object in a form?

2010-11-16 Thread Toby Champion
Preston,

I had a similar problem to solve when working on a research project
that collected a lot of data from companies, much of which was
missing. As I understand it, your data set is effectively a sparse,
two-dimensional matrix [1], and you want to be able to edit this in
the browser. I'd suggest you make the idea of the matrix more
concrete, and perhaps have a separate model/class that provides array-
like access to this, perhaps even caching all the data. Then you've
two separate problems to solve:

a) Be able to convert between the array-like representation and the
database representation.
b) Be able to edit the array-like representation in the browser, and
get bit back.

I'm a newbie at Django but as I understand it, for a), since you'll be
working with more than just one record, you'd want a "manager" to be
involved somewhere here. And for b) you'd have a model that's not
stored in the database, and a custom form that works with your matrix
class.

[1] http://en.wikipedia.org/wiki/Sparse_matrix

I'm a little rusty on this but a relevant design pattern is
http://en.wikipedia.org/wiki/Builder_pattern.

I need a similar control for an upcoming project, so I'm interested to
know what you and others come up with.

Toby (Seattle, WA)

On Nov 16, 6:12 am, derek  wrote:
> Preston
>
> Having not done this before (but maybe needing to soon...) the grid
> approach seems the best solution.
>
> Actually this is not really a Django issue per se; more a "mismatch"
> between the "excel-type" view and the underlying database reality.
> Django is just the middle-man, translating "filled-in holes" to clean
> database records.
>
> I would think there must be a neat JQuery interface one could
> construct for the view?
>
> Derek
>
> On Nov 16, 1:01 am, Preston Holmes  wrote:
>
> > This is a cart/horse pattern I run now and then, and while I can think
> > of several sort of ugly ways to do it, I'm wondering if someone has a
> > clean solution in Django.
>
> > I'm going to use a gradebook as an example.  The goal is to present a
> > user with a grid of lets say students and assignments to enter
> > grades.  The models would be
>
> > - Students
>
> > - Assignments
>
> > - Grades (a M2M between students and assignments)
>
> > Now on the grade entry form, with multiple students and assignments,
> > the grades don't yet exist for all students, and may not all be
> > entered.  How does one generate the form for the possibilities,
> > without pre-creating all the empty grades.
>
> > It would be nice to use modelform here, but it seems that that the
> > only way to do it is just with a form and then create objects for
> > grades that get filled out in the view.  How do others solve this
> > problem of representing a "possible future" object in a form that is
> > then only optionally created if filled out.
>
> > -Preston

-- 
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: script adding FileField, no attribute chunks

2010-11-16 Thread Mitch Anderson
On Tue, Nov 16, 2010 at 3:28 AM, Tom Evans  wrote:

> Django doesn't want a python file or text for a django file field, it
> wants a django.core.files.File. I find the easiest one to use is the
> InMemoryUploadedFile. Here is a snippet I use for fetching an image
> from the web, and creating a django.core.files.File object that can be
> assigned to a FileField or ImageField on a model:
>
>  h = httplib2.Http()
>  req, content = h.request(uri)
>  if req['status'] != '200':
>print u'Failed to fetch image from %s' % uri
>return None
>
>  import cStringIO
>  from django.core.files.uploadedfile import InMemoryUploadedFile
>  out = cStringIO.StringIO()
>  out.write(content)
>  return InMemoryUploadedFile(
>  file=out,
>  field_name=field,
>  name=name,
>  content_type=req['content-type'],
>  size=out.tell(),
>  charset=None)
>
> field should be the name of the field on the model, name should be the
> file name of the resource.
>
> There may be neater ways of doing this, but this keeps it in memory
> until django saves it to the upload_to location specified on the
> model, and avoids writing it to disk only for django to write it to
> disk again.
>
> Cheers
>
> Tom
>

Awesome that worked perfectly!  Thanks Tom!

-- 
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: appling fix from fixed ticket's backport

2010-11-16 Thread Russell Keith-Magee
On Wed, Nov 17, 2010 at 2:59 AM, Cek  wrote:
> Hello all!
>
> I'm quite new to Django, and this is my first post to this group, so
> pls excuse and correct me if it's the wrong place or something like
> that.

You've got the right place. Welcome!

> I am trying to use eav-django (http://pypi.python.org/pypi/eav-
> django), but it won't work because of Ticket #14471 (http://
> code.djangoproject.com/ticket/14471). Now, since the ticket in
> question is "closed: fixed", I was wondering is there a way to apply
> the fix now, and skip the wait for 1.3 release?
>
> I have applied changes that are marked in the backport (http://
> code.djangoproject.com/changeset/14390), but nothing has changed. Both
> eav-django and test.py attached to the ticket throw the same error.
>
> However, I only applied changes to django/db/models/fields/related.py,
> because I couldn't find the other two files. Are they relevant at all?
> What else can I try to make it work?

The other two files aren't essential for the code to work -- they are
just test code that validates that the changes in the first file do
what they say they should. If you've only got the main Django source
directory deployed (e.g., if you've done a setup.py install, or
installed via pip/easy_install/rpm/apt) then you probably don't have
the multiple_database/models.py or multiple_database/test.py files.

So - if you've correctly applied the changes to
django/db/models/fields/related.py, that should be all you need to do
in order to fix the problem described by #14471. If you're still
seeing a problem, then either:
 1) you haven't applied the patch correctly
 2) you haven't applied the patch to the Django version that is actually in use
 3) you have found an edge case of #14471 that r14390 didn't address.

To test 1 and 2, try putting a print statement in your patched code
somewhere near an edited line; when you run your project code, you
should see that print statement whenever you call create or
get_or_create on a m2m object.

If the problem is 3, you'll need to do some more debugging to work out
exactly what is going on.

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-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.



loggin limits

2010-11-16 Thread Alex s
Hi,

I am planning to limit the number of users logged online in my application.

How can I do it?

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-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: loggin limits

2010-11-16 Thread RadicalEd
You can use a table with the quantity of users logged, so if the quantity is
X then you don't let nobody else get loggin

On Tue, Nov 16, 2010 at 7:40 PM, Alex s  wrote:

> Hi,
>
> I am planning to limit the number of users logged online in my application.
>
> How can I do it?
>
> 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-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.
>



-- 
The past are just memories, the future are just dreams!!!
http://foros.solocodigo.com
http://radicalpython.blogspot.com
http://revistacodigolatino.blogspot.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-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: loggin limits

2010-11-16 Thread Shawn Milochik
On Tue, Nov 16, 2010 at 7:40 PM, Alex s  wrote:
> Hi,
>
> I am planning to limit the number of users logged online in my application.
>
> How can I do it?
>
> Thanks
> Alex

There is no "logged in" state for a user. You will have to store user
IDs and the last time a request came in for that user, then judge how
long they must be inactive before they're considered "logged out," and
then you'll have to revoke their session so they can't continue to
user their non-expired session if the number of users is at its limit.

Shawn

-- 
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: loggin limits

2010-11-16 Thread Michael Sprayberry
While the state is stateless you can create a user list and then control the 
number of user allowed to be logged on a given time. Read through this.
 
http://www.djangobook.com/en/beta/chapter12/
 
Your best bet is to create a count that keeps track of total active session and 
only allows another once one ends.
 
Sincerely,
Michael

--- On Tue, 11/16/10, Alex s  wrote:


From: Alex s 
Subject: loggin limits
To: django-users@googlegroups.com
Date: Tuesday, November 16, 2010, 7:40 PM


Hi,

I am planning to limit the number of users logged online in my application.

How can I do it?

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-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.



  

-- 
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: Django Dropdown List

2010-11-16 Thread Derek
Any examples showing this approach readily available?

On 16 November 2010 20:16, Simone Dalla  wrote:

>
>
> 2010/11/16 Derek 
>
> Sean
>>
>> I hear what you say - but is this approach also readily available inside
>> the Admin framework?
>
>
> Absolutely yes.
>
> --
> Simo
>
> - Registered Linux User #395060
>
> - Software is like sex, it is better when it is free  --> Linus B. Torvalds
>
> --
> 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.
>

-- 
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: CI

2010-11-16 Thread Johannes Nel
Nice.

Kudos to the people who did virtualenv, neat tool.


On Tue, Nov 16, 2010 at 9:07 AM, Nick Lo  wrote:
> Hi Johannes,
>
> You may be interested in this project:
>
> https://github.com/kmmbvnr/django-hudson
>
> Cheers,
>
> Nick
>
> On Nov 14, 5:36 am, Johannes Nel  wrote:
>> answering my own questions here:
>>
>> By the looks of things I will stick with hudson for now, I found some
>> information on coverage tools as well (all though there seems to be no
>> sonar plugin, prob because nobody has been bothered to use maven for
>> django yet)
>> I also found a project called Fabric for deployment, which looks
>> pretty powerfull, but more investigation is needed.
>>
>> If anyone has got some experience in fabric and hudson integration or
>> a good resource on propagation strategies will be much appreciated.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Sat, Nov 13, 2010 at 4:56 PM, Johannes Nel  wrote:
>> > Hi All
>>
>> > What do you guys use for CI servers? Also where can I get some
>> > detailed info on application propagation strategies (from dev, to qa,
>> > to uat to prod) for django
>>
>> > As a side note, I think the getting started documentation should be
>> > updated to reflect the use of relative paths
>> >http://rob.cogit8.org/blog/2008/Jun/20/django-and-relativity/
>>
>> > johan
>>
>> > --
>> > j:pn
>> > \\no comment
>>
>> --
>> j:pn
>> \\no comment
>
> --
> 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.
>
>



-- 
j:pn
\\no comment

-- 
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.