Re: Preventing JOIN while checking if a self referencing FK is null

2012-03-22 Thread diafygi
Is there a reason why editor_id is meant to raise a field error?

-Daniel

On Mar 21, 12:05 pm, diafygi  wrote:
> >>> Blog.objects.filter(editor_id=None)
>
> FieldError: Cannot resolve keyword 'editor_id' into field.
>
> This was actually an offered answer in the previous thread, but the id
> version of the field still raises a field error.
>
> Daniel
>
> On Mar 21, 9:47 am, Javier Guerra Giraldez  wrote:
>
>
>
>
>
>
>
> > try:
>
> > > Blog.objects.filter(editor_id=None)
>
> > --
> > 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



implement form for listfield

2012-03-22 Thread rohit jangid
hi,
I'm using mongodb as my database and djangomongodb engine for the orm layer.

I have a basic model let say 'A' which I can use in admin module and
objects in db
than
I have another model which has a field like this

class B
fieldname ListField(EmbeddedModelField('A'))

the problem is that when I try to add objects for model B , it says I
have not implemented forms for diplaying listfield which is a normal
error .

I am new to django and mongodb so I wanted to discuss how to approach
these kind of problems or are there any solutions already available
for this .. since I feel I will be encountering this kind of problems
in future as well

thanks

-- 
Rohit Jangid
Under Graduate Student,
Deptt. of Computer Engineering
NSIT, Delhi University, India

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



ModelForms

2012-03-22 Thread hack
I think I shot myself in the foot using ModelForms to generate all of my 
html forms.  Is there any way to use a stylesheet when your forms are 
generated from ModelForms?

I've tried everything and cannot get it to work.  I've tried directly 
importing the css files, I've tried loading them from STATIC, and I've 
tried setting css in Meta, but nothing seems to work.  All I have to do is 
add some color to my tables and align the text to the left of the cells. 
 Thanks.

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



Re: Using _set.all in template when ForiegnKey is linked to Self

2012-03-22 Thread Daniel Roseman
On Thursday, 22 March 2012 01:12:21 UTC-7, Jam wrote:
>
> Hi All,
>
> I have a model where it can link to itself using ForeignKey('self'). This 
> is so I can have parent and child objects.
>
> I have called the parent and in the template I want to be able to access 
> all the child objects.
>
> I have been using the _set.all template command on the field but it 
> returns no results.
>
> Any ideas why this would happen? This is the first time I have used 
> ForeignKey('self') so I am a bit clueless.
>
> Thank you all
> Jamie
>

You'll need to be a bit more specific. Please show your model, and the 
exact template code you are using. 
--
DR.

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



Django-1.4c2 logging issue on Snow Leopard

2012-03-22 Thread Jeff Heard
Hi all.  I just created a new Django-1.4 project and got this error:

Traceback (most recent call last):
  File "manage.py", line 14, in 
execute_manager(settings)
  File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/core/management/__init__.py",
line 438, in execute_manager
utility.execute()
  File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/core/management/__init__.py",
line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/core/management/__init__.py",
line 252, in fetch_command
app_name = get_commands()[subcommand]
  File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/core/management/__init__.py",
line 101, in get_commands
apps = settings.INSTALLED_APPS
  File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/utils/functional.py",
line 276, in __getattr__
self._setup()
  File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/conf/__init__.py",
line 42, in _setup
self._wrapped = Settings(settings_module)
  File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/conf/__init__.py",
line 139, in __init__
logging_config_func(self.LOGGING)
  File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py",
line 776, in dictConfig
dictConfigClass(config).configure()
  File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py",
line 562, in configure
'filter %r: %s' % (name, e))
ValueError: Unable to configure filter 'require_debug_false': Cannot
resolve 'django.utils.log.RequireDebugFalse': No module named
RequireDebugFalse

I'm using virtualenv and the system python.

Regards,

-- Jeff

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



Re: Autofill dropdown with django

2012-03-22 Thread Sandro Dutra
I think it's more Javascript/AJAX than Django, obviously you'll need to do
a function that uses HttpRequest.is_ajax(), but in the end, the core of
this code is more Javascript/AJAX than Django.

2012/3/22 Karthik Abinav 

> hey,
>
>  I needed a autocomplete utility in one of my applications and I was
> wondering if django provides any such option for that. Basically my need is
> a box where user starts typing some name and as he types I need a list of
> suggested autocompletion, to be provided. Something like how when a user
> tries to tag a friend in facebook and it provides options. Help would be
> appreciated.
>
> Thanks,
> Karthik Abinav
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Autofill dropdown with django

2012-03-22 Thread Nikhil Verma
Hi Abhinav

If i understand you correctly take a look at django-ajax-select.
Home-page: http://code.google.com/p/django-ajax-selects/

This is an autocomplete box which works in the following way :-

Hope it helps you !!!

Let say we have a username textbox(which is ajax-selct field) so i type Ab
... It will give you the list of username that starts with ab.
It has some settings though.

On Thu, Mar 22, 2012 at 11:33 PM, Karthik Abinav
wrote:

> hey,
>
>  I needed a autocomplete utility in one of my applications and I was
> wondering if django provides any such option for that. Basically my need is
> a box where user starts typing some name and as he types I need a list of
> suggested autocompletion, to be provided. Something like how when a user
> tries to tag a friend in facebook and it provides options. Help would be
> appreciated.
>
> Thanks,
> Karthik Abinav
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

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



Autofill dropdown with django

2012-03-22 Thread Karthik Abinav
hey,

 I needed a autocomplete utility in one of my applications and I was
wondering if django provides any such option for that. Basically my need is
a box where user starts typing some name and as he types I need a list of
suggested autocompletion, to be provided. Something like how when a user
tries to tag a friend in facebook and it provides options. Help would be
appreciated.

Thanks,
Karthik Abinav

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



Re: [1.4c2] The storage backend of the staticfiles finder doesn't have a valid location.

2012-03-22 Thread Micky Hulse
Hi Bill, thanks so much for you pro help and quick reply, I really
appreciate it! :)

On Thu, Mar 22, 2012 at 4:32 AM, Bill Freeman  wrote:
> Just a shot in the dark, but you probably want to leave DefaultStorageFinder
> commented out ...

That did the trick! Thank you so much, I owe you one. :)

Have an awesome day!

Cheers,
M

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



Weird stacktrace coming from manage.py test

2012-03-22 Thread Jeff Heard
Has anyone seen this before?  Am I missing something?  This hasn't even
gotten to my code yet.  I'm using this in my settings.py:

TEST_RUNNER = 'django.contrib.gis.tests.GeoDjangoTestSuiteRunner'

I have a template PostGIS database setup properly.  And I'm running the
stable release of Django 1.3.

---

Traceback (most recent call last):
 File "manage.py", line 14, in 
   execute_manager(settings)
 File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/core/management/__init__.py",
line 438, in execute_manager
   utility.execute()
 File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/core/management/__init__.py",
line 379, in execute
   self.fetch_command(subcommand).run_from_argv(self.argv)
 File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/core/management/base.py",
line 191, in run_from_argv
   self.execute(*args, **options.__dict__)
 File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/core/management/base.py",
line 220, in execute
   output = self.handle(*args, **options)
 File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/core/management/commands/test.py",
line 37, in handle
   failures = test_runner.run_tests(test_labels)
 File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/test/simple.py",
line 359, in run_tests
   old_config = self.setup_databases()
 File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/test/simple.py",
line 296, in setup_databases
   test_db_name = connection.creation.create_test_db(self.verbosity,
autoclobber=not self.interactive)
 File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/db/backends/creation.py",
line 351, in create_test_db
   self._create_test_db(verbosity, autoclobber)
 File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/db/backends/creation.py",
line 425, in _create_test_db
   self.set_autocommit()
 File
"/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/db/backends/creation.py",
line 481, in set_autocommit
   self.connection.connection.autocommit = True
psycopg2.ProgrammingError: autocommit cannot be used inside a transaction

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



Re: Is there a place for new Django specialized hosting?

2012-03-22 Thread shacker
Agreed - hosting of any kind is a tough business these days - it's become 
so commoditized that prices are rock bottom and customer expectations 
extremely high. And there are tons of Django-optimized hosts out there 
already - search for "django hosting" for listings and comparative sites 
before even thinking of taking on a niche like this.

./s

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



Re: Using “Schemas” with MySQL

2012-03-22 Thread Tom Evans
On Thu, Mar 22, 2012 at 1:29 PM, Peter of the Norse
 wrote:
> In our legacy system at work, we're using different different databases on
> the same sever at the same time. It looks like ”Select * From client_a.user
> Inner Join common.table On…”. I know that ticket 6148 is still a long way
> from being included, but I was wondering if there is a workaround. I’ve seen
> that in PostgreSQL you can use db_table = 'schema\".\"tablename'
> Does something similar work in MySQL? Has anyone tried it?
>
> Peter of the Norse
> rahmc...@radio1190.org

Yes, I've seen a similar sort of construct in use with mysql. This is
what we use with mysql:

"`%s`.`%s`" % (schema, table_name)

Works fine as far as I know (I don't actually work on the project
using it, just aware of the hack!)

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



Multi form or big form..

2012-03-22 Thread Xavier Pegenaute

Hi,

I need to show a view with a list of users, every user can be joined to 
an event or not. This is modelled with User (about 2k instances) and a 
JointToEvent class. This last class has a relation to User and a status 
field. This field can be: "Joined" or "Waiting to be paid" (CHOICE field).


the view I want to show is like this:

_User___ Status _
User1 Waiting to be paid
User2 Waiting to be paid
User3 Waiting to be paid
User4 Joined

Since django renders the CHOICE field as a   I want to submit 
(A) the form to update the data every time the client change the status 
from Waiting to Joined. Also when the user submits the data I don't want 
to modify the screen position of the table (B). And I want it to be safe 
(C).



A) put a javascript "onChange" in the widget submitting the data...:
- from a single form with all the data (all instances). ?
- from an individual form related to the modified instance. ?, is 
created a different  csrf token for every form?

B)
  - I though that may be it is possible without returning a response to 
the user after the submiting. Is it valid?
  - Or may be use some tricky html tag (I don't know if it's possible) 
which allows to reload the page and show the page in the same position

C) I think the better way to do it is by POST (safety)


Thanks a lot!,
Xavi

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



Re: twitter timeline

2012-03-22 Thread Anoop Thomas Mathew
Hi,

https://twitter.com/status/user_timeline/.json

This would get you latest public tweets as json. This was good enough for
my application. See if that helps.
If you need twitter authentication and more features, you can use tweepy.

Thanks,
Anoop Thomas Mathew

atm
___
Life is short, Live it hard.




On 22 March 2012 19:43, Amit  wrote:

> Hi Randa,
>
> I have used tweepy. Its easy to use.
> doc link: http://packages.python.org/tweepy/html/
>
> On Mar 21, 7:00 pm, Randa Hisham  wrote:
> > hey
> > iam going to make an app that read the timeline of a user from twitter
> what
> > django package do you recommend?
> >
> > --
> > Randa Hesham
> > Software Developer
> >
> > Twitter:@ro0oraa 
> > FaceBook:Randa Hisham 
> >
> > ٍ
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: twitter timeline

2012-03-22 Thread Amit
Hi Randa,

I have used tweepy. Its easy to use.
doc link: http://packages.python.org/tweepy/html/

On Mar 21, 7:00 pm, Randa Hisham  wrote:
> hey
> iam going to make an app that read the timeline of a user from twitter what
> django package do you recommend?
>
> --
> Randa Hesham
> Software Developer
>
> Twitter:@ro0oraa 
> FaceBook:Randa Hisham 
>
> ٍ

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



Using “Schemas” with MySQL

2012-03-22 Thread Peter of the Norse
In our legacy system at work, we're using different different databases on the 
same sever at the same time. It looks like ”Select * From client_a.user Inner 
Join common.table On…”. I know that ticket 6148 is still a long way from being 
included, but I was wondering if there is a workaround. I’ve seen that in 
PostgreSQL you can use db_table = 'schema\".\"tablename'
Does something similar work in MySQL? Has anyone tried it?

Peter of the Norse
rahmc...@radio1190.org



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



Templated rich-text egg for Django?

2012-03-22 Thread Alec Taylor
Good morning,

We've all seen document templates in a variety of systems, such as
PowerPoint, MailChimp and Google Docs.

I would like to utilise the same sorts of capabilities on my website.

The following features I require:
• Create a library of document templates
• Allow others to pick a document template to create there document from
• Allow others to swap the template their document has without losing data
• Document authoring in rich-text (e.g. using CKEditor)

(I will probably end up using a full CMS such as Mezzanine around the
whole system.)

Please suggest modules allowing me to do the aforementioned.

Thanks for all recommendations,

Alec Taylor

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



Re: Is there a place for new Django specialized hosting?

2012-03-22 Thread Andre Terra
Forgive me if I sound pessimistic, I'm just a hobbyist developer offering
my most sincere 2 cents.

There are many services that offer similar features and sometimes even
more. From a business perspective, the only way to thrive in this market is
by having technology that provides competitive advantage and through
marketing aimed at receiving endorsement from trendsetters in the web
development field.

Google ep.io, gondor, apphosted, djangozoom, heroku,
cloudfoundry.com(built by a former Google/Microsoft engineer) and
others.

Considering these have already launched or at least reached beta stage,
you're off to a tough start if you do go through with the plan.

Cheers,
AT



On Mar 21, 2012 10:24 PM, "Martin Tiršel"  wrote:

> Hello,
>
> I am playing with an idea to create a hosting service specialized for
> Django. I would be glad if you can provide some feedback if you would use
> such service (or why not) and what monthly fee would you pay for this.
>
> This would be based on virtual servers without root access (only
> unprivileged shell access) with web based administration:
>
> * create so many webs you want (or resources allows)
> * separated webserver for media files/static content
> * virtualenv support, multiple python versions
> * SVN/Git
> * testing/production environment (clone production data to testing
> environment [app, media, database] -> export project from svn/git -> apply
> migrations -> test -> apply to production)
> * one click trac installation
> * integrated web based editor for some quick changes/fixes (
> http://ace.ajax.org/)
> * backup/restore
> * some tools that makes life easier like one click project initialization
> inside svn/git and prepared settings (so you don't need to create project,
> add it to repository and rewrite common settings), ...
> * basic support for Django
> * easy SSL certificate installation
> * and many others :)
>
> There could be two programs, for example 1GB RAM, 2 vCPU's, 30 GB HDD or
> 2GB RAM, 3 vCPU's, 50GB HDD
>
> My goal is to provide an environment for developers with multiple projects
> that wants virtual server but don't want/know to install/configure such
> virtual server. Or is there already a service like this?
>
> 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
> .
>
>

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



Re: sql for Many To Many Field in existing django model

2012-03-22 Thread Joel Goldstick
On Thu, Mar 22, 2012 at 6:55 AM, Nikhil Verma  wrote:
> Hi All
>
> I want to add a ManyToManyField  to an existing django model.
>
> I can use sql app_name and see the statement.
>
> My models
>
> Class Visit(modes.Model):
>   x = something
>   . ..
>   .. and so on
>  # finally Here i want to add that field research protol
>  research_protocol  =
> models.ManyToManyField(ResearchProtocol,blank=True)
>
>
>
> class ResearchProtocol(models.Model):
>     title = models.CharField(max_length=30)
>     description = models.TextField()
>     start_date = models.DateField(_("Date Started"))
>     end_date = models.DateField(_("Date Completed"))
>
>     def __unicode__(self):
>     return '%s' % self.title
>
>
>
> So i made an sql statement like this:-
>
> CREATE TABLE "visit_visit_research_protocols"
> (
>     "id" integer NOT NULL PRIMARY KEY,
>
>     "visit_id" integer NOT NULL REFERENCES "visit_visit" ("id") DEFERRABLE
> INITIALLY DEFERRED,
>     "research_protocols_id" varchar(80) NOT NULL REFERENCES
> "www_researchprotocol" ("title") DEFERRABLE INITIALLY DEFERRED,
>     UNIQUE ("visit_id","research_protocols_id")
> );
>
> The dbshell says:-
> psql:db/2012-03-22_research_id.sql:8: NOTICE:  CREATE TABLE / PRIMARY KEY
> will create implicit index "visit_visit_research_protocols_pkey" for table
> "visit_visit_research_protocols"
> psql:db/2012-03-22_research_id.sql:8: NOTICE:  CREATE TABLE / UNIQUE will
> create implicit index
> "visit_visit_research_protocol_visit_id_research_protocols_i_key" for table
> "visit_visit_research_protocols"
> psql:db/2012-03-22_research_id.sql:8: ERROR:  there is no unique constraint
> matching given keys for referenced table "www_researchprotocol"
>
>
>
> What mistake i am doing  ?
>
> Thanks in advance.
>
>
> --
> Regards
> Nikhil Verma
> +91-958-273-3156
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

You can't add the many to many relationship after you already have the
model with django.  See this:
http://stackoverflow.com/questions/830130/adding-a-field-to-an-existing-django-model
That answer points to South, which I have played with but am not
proficient yet.  Another thought is to create a new model, identical
to your present one, but include the many2many and dbsync that.  If it
works, copy your data from your old model into your new model.


-- 
Joel Goldstick

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



Re: Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread kenneth gonsalves
On Thu, 2012-03-22 at 05:25 -0700, Stodge wrote:
> No I need MEDIA_ROOT, I want to experiment with:
> 
> 
> 
> Thanks 

in the view:
from django.conf import settings

and send settings.MEDIA_ROOT to the template

or build a templatetag to do the same thing.
-- 
regards
Kenneth Gonsalves

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



Re: Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread Stodge
All good points thanks. I'm only experimenting and learning so this
won't hit production. Point taken though. :)

On Mar 22, 7:30 am, Tom Evans  wrote:
> On Thu, Mar 22, 2012 at 12:25 PM, Stodge  wrote:
> > No I need MEDIA_ROOT, I want to experiment with:
>
> > 
>
> > Thanks
>
> MEDIA_ROOT is a file-system location, not a URL-space location, and
> should not be exposed in templates. It is nonsense to use media root
> as a prefix to the URL-space location of your javascript files.
>
> 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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread Tom Evans
On Thu, Mar 22, 2012 at 12:25 PM, Stodge  wrote:
> No I need MEDIA_ROOT, I want to experiment with:
>
> 
>
> Thanks
>

MEDIA_ROOT is a file-system location, not a URL-space location, and
should not be exposed in templates. It is nonsense to use media root
as a prefix to the URL-space location of your javascript files.

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



Re: Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread Davinir F Campos Jr
Stoge, you DO need MEDIA_URL in turn to build the URL in which script src
is based on.

MEDIA_ROOT is the (complete) physical path to the file. Do you want to
expose your filesystem?

[ ]s
Davinir

2012/3/22 Stodge 

> No I need MEDIA_ROOT, I want to experiment with:
>
> 
>
> Thanks
>
> On Mar 22, 7:22 am, kenneth gonsalves  wrote:
> > On Thu, 2012-03-22 at 05:11 -0700, Stodge wrote:
> > > In my template:
> >
> > > MEDIA_ROOT: {{MEDIA_ROOT}}
> >
> > > But all I see is:
> >
> > > MEDIA_ROOT:
> >
> > > So MEDIA_ROOT is blank or doesn't exist. Did I miss something?
> >
> > https://docs.djangoproject.com/en/1.0/ref/templates/api/#django-core-...
> >
> > you need MEDIA_URL
> > --
> > regards
> > Kenneth Gonsalves
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread Stodge
No I need MEDIA_ROOT, I want to experiment with:



Thanks

On Mar 22, 7:22 am, kenneth gonsalves  wrote:
> On Thu, 2012-03-22 at 05:11 -0700, Stodge wrote:
> > In my template:
>
> > MEDIA_ROOT: {{MEDIA_ROOT}}
>
> > But all I see is:
>
> > MEDIA_ROOT:
>
> > So MEDIA_ROOT is blank or doesn't exist. Did I miss something?
>
> https://docs.djangoproject.com/en/1.0/ref/templates/api/#django-core-...
>
> you need MEDIA_URL
> --
> regards
> Kenneth Gonsalves

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



Re: Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread kenneth gonsalves
On Thu, 2012-03-22 at 05:11 -0700, Stodge wrote:
> In my template:
> 
> MEDIA_ROOT: {{MEDIA_ROOT}}
> 
> But all I see is:
> 
> MEDIA_ROOT:
> 
> So MEDIA_ROOT is blank or doesn't exist. Did I miss something? 

https://docs.djangoproject.com/en/1.0/ref/templates/api/#django-core-context-processors-media

you need MEDIA_URL 
-- 
regards
Kenneth Gonsalves

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



Re: Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread Stodge
Oh that's surprising; the media context processor only creates
MEDIA_URL.

On Mar 22, 7:11 am, Stodge  wrote:
> I'm trying to reference MEDIA_ROOT in my template but it's blank. I
> have MEDIA_ROOT defined in settings.py:
>
> MEDIA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)),
> 'static')
>
> I have the correct context processor:
>
> TEMPLATE_CONTEXT_PROCESSOR = (
>     'django.core.context_processors.i18n',
>     'django.core.context_processors.auth',
>     'django.core.context_processors.media',
> )
>
> In my template:
>
> MEDIA_ROOT: {{MEDIA_ROOT}}
>
> But all I see is:
>
> MEDIA_ROOT:
>
> So MEDIA_ROOT is blank or doesn't exist. Did I miss something? This is
> Django 1.2.3, thanks. Oh and I realise there is a newer version of
> Django out there but I can't upgrade my app... yet..
>
> Thanks again

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



Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread Stodge
I'm trying to reference MEDIA_ROOT in my template but it's blank. I
have MEDIA_ROOT defined in settings.py:

MEDIA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'static')

I have the correct context processor:

TEMPLATE_CONTEXT_PROCESSOR = (
'django.core.context_processors.i18n',
'django.core.context_processors.auth',
'django.core.context_processors.media',
)

In my template:

MEDIA_ROOT: {{MEDIA_ROOT}}

But all I see is:

MEDIA_ROOT:

So MEDIA_ROOT is blank or doesn't exist. Did I miss something? This is
Django 1.2.3, thanks. Oh and I realise there is a newer version of
Django out there but I can't upgrade my app... yet..

Thanks again

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



Re: [1.4c2] The storage backend of the staticfiles finder doesn't have a valid location.

2012-03-22 Thread Bill Freeman
On Thu, Mar 22, 2012 at 2:22 AM, Micky Hulse  wrote:
> I must be overlooking something obvious. My error:
>
> 
>
> The static files collect just fine (currently, I just have admin files
> to collect); the above error just shows up every time I run
> collectstatic.
>
> Settings:
>
> STATIC_ROOT = '/home/billy/webapps/xyz_static/'
> STATIC_URL = '/static/'
> STATICFILES_DIRS = ()
> STATICFILES_FINDERS = (
>    'django.contrib.staticfiles.finders.FileSystemFinder',
>    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
>    'django.contrib.staticfiles.finders.DefaultStorageFinder',

Just a shot in the dark, but you probably want to leave DefaultStorageFinder
commented out, or see:

  
https://docs.djangoproject.com/en/1.3/ref/contrib/staticfiles/#std:setting-STATICFILES_FINDERS

and the not there about DEFAULT_FILE_STORAGE:

  
https://docs.djangoproject.com/en/1.3/ref/settings/#std:setting-DEFAULT_FILE_STORAGE

> )
> INSTALLED_APPS = (
>    'django.contrib.staticfiles',
> )
>
> Sorry if this is an obvious one... I could not find anything useful
> via a Google search.
>
> Many thanks in advance!
>
> Cheers,
> M
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>

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



sql for Many To Many Field in existing django model

2012-03-22 Thread Nikhil Verma
Hi All

I want to add a ManyToManyField  to an existing django model.

I can use sql app_name and see the statement.

My models

Class Visit(modes.Model):
  x = something
  . ..
  .. and so on
 # finally Here i want to add that field research protol
 research_protocol  =
models.ManyToManyField(ResearchProtocol,blank=True)



class ResearchProtocol(models.Model):
title = models.CharField(max_length=30)
description = models.TextField()
start_date = models.DateField(_("Date Started"))
end_date = models.DateField(_("Date Completed"))

def __unicode__(self):
return '%s' % self.title



So i made an sql statement like this:-

CREATE TABLE "visit_visit_research_protocols"
(
"id" integer NOT NULL PRIMARY KEY,

"visit_id" integer NOT NULL REFERENCES "visit_visit" ("id") DEFERRABLE
INITIALLY DEFERRED,
"research_protocols_id" varchar(80) NOT NULL REFERENCES
"www_researchprotocol" ("title") DEFERRABLE INITIALLY DEFERRED,
UNIQUE ("visit_id","research_protocols_id")
);

The dbshell says:-
psql:db/2012-03-22_research_id.sql:8: NOTICE:  CREATE TABLE / PRIMARY KEY
will create implicit index "visit_visit_research_protocols_pkey" for table
"visit_visit_research_protocols"
psql:db/2012-03-22_research_id.sql:8: NOTICE:  CREATE TABLE / UNIQUE will
create implicit index
"visit_visit_research_protocol_visit_id_research_protocols_i_key" for table
"visit_visit_research_protocols"
psql:db/2012-03-22_research_id.sql:8: ERROR:  there is no unique constraint
matching given keys for referenced table "www_researchprotocol"



What mistake i am doing  ?

Thanks in advance.


-- 
Regards
Nikhil Verma
+91-958-273-3156

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



Re: Help with django-paypal anyone?

2012-03-22 Thread Stanwin Siow
ok thank you.

I'll take a look tonight.

Cheers


Best Regards,

Stanwin Siow



On Mar 22, 2012, at 6:30 PM, Daniel Hilton wrote:

> On 22 March 2012 10:20, Stanwin Siow  wrote:
>> hey daniel,
>> 
>> I used the johnbox version.
>> 
> 
> I found this version has more uptodate bug fixes and features:
> https://github.com/dcramer/django-paypal
> 
> HTH
> Dan
> 
> 
> 
>> Should be ok right?
>> 
>> Best Regards,
>> 
>> Stanwin Siow
>> 
>> 
>> 
>> On Mar 22, 2012, at 6:01 PM, Daniel Hilton wrote:
>> 
>> On 22 March 2012 05:47, Jonathan Baker  wrote:
>> 
>> You'll need to enable the CSRF middleware, adjust your view and make use of
>> 
>> the {% csrf_token %} template tag in your template. Details can be found
>> 
>> here: https://docs.djangoproject.com/en/dev/ref/contrib/csrf/
>> 
>> 
>> 
>> On Wed, Mar 21, 2012 at 11:35 PM, Stanwin Siow 
>> 
>> wrote:
>> 
>> 
>> Hello,
>> 
>> 
>> I was following this tutorial on django-paypal from this link:
>> 
>>  http://od-eon.com/blogs/nai/django-paypal-step-step-integration/?c=619
>> 
>> 
>> i managed to get the paypal button working but when i click return to home
>> 
>> page i get a CSRF token not found.
>> 
>> 
>> Please advise on how i should continue?
>> 
>> 
>> I would appreciate any help rendered.
>> 
>> 
>> Thank you.
>> 
>> 
>> Best Regards,
>> 
>> 
>> Stanwin Siow
>> 
>> 
>> Hey!
>> 
>> Which fork are you using? dcramer's on github was the best when I was
>> working with this last year.
>> 
>> HTH
>> Dan
>> 
>> 
>> 
>> 
>> 
>> 
>> --
>> 
>> You received this message because you are subscribed to the Google Groups
>> 
>> "Django users" group.
>> 
>> To post to this group, send email to django-users@googlegroups.com.
>> 
>> To unsubscribe from this group, send email to
>> 
>> django-users+unsubscr...@googlegroups.com.
>> 
>> For more options, visit this group at
>> 
>> http://groups.google.com/group/django-users?hl=en.
>> 
>> 
>> 
>> 
>> 
>> --
>> 
>> Jonathan D. Baker
>> 
>> Web Developer
>> 
>> http://jonathandbaker.com
>> 
>> 303.257.4144
>> 
>> 
>> --
>> 
>> You received this message because you are subscribed to the Google Groups
>> 
>> "Django users" group.
>> 
>> To post to this group, send email to django-users@googlegroups.com.
>> 
>> To unsubscribe from this group, send email to
>> 
>> django-users+unsubscr...@googlegroups.com.
>> 
>> For more options, visit this group at
>> 
>> http://groups.google.com/group/django-users?hl=en.
>> 
>> 
>> 
>> 
>> --
>> Dan Hilton
>> 
>> www.twitter.com/danhilton
>> www.DanHilton.co.uk
>> 
>> 
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>> 
>> 
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 
> -- 
> Dan Hilton
> 
> www.twitter.com/danhilton
> www.DanHilton.co.uk
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



Re: Help with django-paypal anyone?

2012-03-22 Thread Daniel Hilton
On 22 March 2012 10:20, Stanwin Siow  wrote:
> hey daniel,
>
> I used the johnbox version.
>

I found this version has more uptodate bug fixes and features:
https://github.com/dcramer/django-paypal

HTH
Dan



> Should be ok right?
>
> Best Regards,
>
> Stanwin Siow
>
>
>
> On Mar 22, 2012, at 6:01 PM, Daniel Hilton wrote:
>
> On 22 March 2012 05:47, Jonathan Baker  wrote:
>
> You'll need to enable the CSRF middleware, adjust your view and make use of
>
> the {% csrf_token %} template tag in your template. Details can be found
>
> here: https://docs.djangoproject.com/en/dev/ref/contrib/csrf/
>
>
>
> On Wed, Mar 21, 2012 at 11:35 PM, Stanwin Siow 
>
> wrote:
>
>
> Hello,
>
>
> I was following this tutorial on django-paypal from this link:
>
>  http://od-eon.com/blogs/nai/django-paypal-step-step-integration/?c=619
>
>
> i managed to get the paypal button working but when i click return to home
>
> page i get a CSRF token not found.
>
>
> Please advise on how i should continue?
>
>
> I would appreciate any help rendered.
>
>
> Thank you.
>
>
> Best Regards,
>
>
> Stanwin Siow
>
>
> Hey!
>
> Which fork are you using? dcramer's on github was the best when I was
> working with this last year.
>
> HTH
> Dan
>
>
>
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups
>
> "Django users" group.
>
> To post to this group, send email to django-users@googlegroups.com.
>
> To unsubscribe from this group, send email to
>
> django-users+unsubscr...@googlegroups.com.
>
> For more options, visit this group at
>
> http://groups.google.com/group/django-users?hl=en.
>
>
>
>
>
> --
>
> Jonathan D. Baker
>
> Web Developer
>
> http://jonathandbaker.com
>
> 303.257.4144
>
>
> --
>
> You received this message because you are subscribed to the Google Groups
>
> "Django users" group.
>
> To post to this group, send email to django-users@googlegroups.com.
>
> To unsubscribe from this group, send email to
>
> django-users+unsubscr...@googlegroups.com.
>
> For more options, visit this group at
>
> http://groups.google.com/group/django-users?hl=en.
>
>
>
>
> --
> Dan Hilton
> 
> www.twitter.com/danhilton
> www.DanHilton.co.uk
> 
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.



-- 
Dan Hilton

www.twitter.com/danhilton
www.DanHilton.co.uk


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



Re: Help with django-paypal anyone?

2012-03-22 Thread Stanwin Siow
hey daniel,

I used the johnbox version.

Should be ok right?

Best Regards,

Stanwin Siow



On Mar 22, 2012, at 6:01 PM, Daniel Hilton wrote:

> On 22 March 2012 05:47, Jonathan Baker  wrote:
>> You'll need to enable the CSRF middleware, adjust your view and make use of
>> the {% csrf_token %} template tag in your template. Details can be found
>> here: https://docs.djangoproject.com/en/dev/ref/contrib/csrf/
>> 
>> 
>> On Wed, Mar 21, 2012 at 11:35 PM, Stanwin Siow 
>> wrote:
>>> 
>>> Hello,
>>> 
>>> I was following this tutorial on django-paypal from this link:
>>>  http://od-eon.com/blogs/nai/django-paypal-step-step-integration/?c=619
>>> 
>>> i managed to get the paypal button working but when i click return to home
>>> page i get a CSRF token not found.
>>> 
>>> Please advise on how i should continue?
>>> 
>>> I would appreciate any help rendered.
>>> 
>>> Thank you.
>>> 
>>> Best Regards,
>>> 
>>> Stanwin Siow
> 
> Hey!
> 
> Which fork are you using? dcramer's on github was the best when I was
> working with this last year.
> 
> HTH
> Dan
> 
> 
> 
>>> 
>>> 
>>> 
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>> 
>> 
>> 
>> 
>> --
>> Jonathan D. Baker
>> Web Developer
>> http://jonathandbaker.com
>> 303.257.4144
>> 
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 
> -- 
> Dan Hilton
> 
> www.twitter.com/danhilton
> www.DanHilton.co.uk
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



Re: Admin - how to get all registeres models in templatetag?

2012-03-22 Thread rohit jangid
I'm using the default admin for my purpose there was a time when I was
thinking the same but I didn't wanted to reinvent the wheel so
what different features are u planning for it which are not available
in default admin?


On Thu, Mar 22, 2012 at 3:33 PM, galgal  wrote:
> I'm writing a custom admin stuff and need to get all registered models in
> Admin. Is this possible?
> I need it to make some custom views on admin index page.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/ZGg0w69RYhMJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.



-- 
Rohit Jangid
Under Graduate Student,
Deptt. of Computer Engineering
NSIT, Delhi University, India

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



Admin - how to get all registeres models in templatetag?

2012-03-22 Thread galgal
I'm writing a custom admin stuff and need to get all registered models in 
Admin. Is this possible?
I need it to make some custom views on admin index page.

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



Re: Help with django-paypal anyone?

2012-03-22 Thread Daniel Hilton
On 22 March 2012 05:47, Jonathan Baker  wrote:
> You'll need to enable the CSRF middleware, adjust your view and make use of
> the {% csrf_token %} template tag in your template. Details can be found
> here: https://docs.djangoproject.com/en/dev/ref/contrib/csrf/
>
>
> On Wed, Mar 21, 2012 at 11:35 PM, Stanwin Siow 
> wrote:
>>
>> Hello,
>>
>> I was following this tutorial on django-paypal from this link:
>>  http://od-eon.com/blogs/nai/django-paypal-step-step-integration/?c=619
>>
>> i managed to get the paypal button working but when i click return to home
>> page i get a CSRF token not found.
>>
>> Please advise on how i should continue?
>>
>> I would appreciate any help rendered.
>>
>> Thank you.
>>
>> Best Regards,
>>
>> Stanwin Siow

Hey!

Which fork are you using? dcramer's on github was the best when I was
working with this last year.

HTH
Dan



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



-- 
Dan Hilton

www.twitter.com/danhilton
www.DanHilton.co.uk


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



Using _set.all in template when ForiegnKey is linked to Self

2012-03-22 Thread Jam
Hi All,

I have a model where it can link to itself using ForeignKey('self'). This 
is so I can have parent and child objects.

I have called the parent and in the template I want to be able to access 
all the child objects.

I have been using the _set.all template command on the field but it returns 
no results.

Any ideas why this would happen? This is the first time I have used 
ForeignKey('self') so I am a bit clueless.

Thank you all
Jamie

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



Re: Migrating wrapped function-based generic view to class-based generic view

2012-03-22 Thread saxon75
So, what I've come up with is subclassing ListView and then decorating
the dispatch method like so:

def checkNodeExists():
  def decorator(func):
def inner(request,*args,**kwargs):
  try:
object = Node.objects.filter(section__keyword=kwargs['sect'],
published=True)[0]
  except:
return render_to_response('doesntexist.html', {'identifier':
'node'}, context_instance=RequestContext(request))
  if object == None:
return render_to_response('doesntexist.html', {'identifier':
'node'}, context_instance=RequestContext(request))
  return func(request, *args, **kwargs)
return inner
  return decorator

class NodeSectionAllView(ListView):
  template_name = 'node/section_list.html'
  paginate_by = 10

  def get_queryset(self):
if Section.objects.get(keyword=self.kwargs['sect']).sort_reverse:
  sort_order = 'created'
else:
  sort_order = '-created'
return
Node.objects.select_related().filter(section__keyword=self.kwargs['sect'],
published=True).order_by(sort_order).annotate(comment_count=Count('comment'))

  @method_decorator(checkNodeExists())
  def dispatch(self,*args,**kwargs):
return super(NodeSectionAllView,self).dispatch(*args,**kwargs)


Now, this works, but it seems needlessly complicated, and I have some
other, more involved wrapped views that I can't figure out how to
manage with this structure.

Is this really the thing I ought to be doing here?  It really seems
like having to do this reduces the utility of the generic view to the
point where I'd be better off just breaking DRY and rewriting all
custom views.



On Mar 20, 11:15 pm, saxon75  wrote:
> Hi all,
>
> I have a site built on Django 1.2 that makes use of wrapped generic
> views, and I'm wondering what the right way to migrate them to the new
> class-based views in 1.3 is.  Here's an example:
>
> urlpatterns = patterns('',
>      (r'^(?P\S+)/$', views.node_section_all),
> )
>
> def node_section_all(request, sect):
>   try:
>     object = Node.objects.filter(section__keyword=sect, published=True)
> [0]
>   except:
>     return render_to_response('doesntexist.html', {'identifier':
> 'node'}, context_instance=RequestContext(request))
>   if object == None:
>     return render_to_response('doesntexist.html', {'identifier':
> 'node'}, context_instance=RequestContext(request))
>   if Section.objects.get(keyword=sect).sort_reverse:
>     sort_order = 'created'
>   else:
>     sort_order = '-created'
>   return list_detail.object_list(
>       request,
>       queryset = Node.objects.filter(section__keyword=sect,
> published=True).order_by(sort_order),
>       template_name = 'node/section_list.html',
>       allow_empty = True,
>       paginate_by = 10,
>   )
>
> This is a fairly straightforward wrapper.  Check to see if the Section
> contains any Nodes, and if so, display a list of all of the Nodes in
> the Section.  If not, display an error page.
>
> I tried just changing the "return list_detail.object_list(" line to
> "return ListView.as_view(" and then removing the "request" and
> "allow_empty" arguments, but I end up with an AttributeError:
> 'function' object has no attribute 'status_code'
>
> So, what's the right way to migrate this sort of wrapper? Should I
> subclass ListView and try to put the wrapper functionality in there?
> How would that 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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Using ForeignKey.on_delete and models.SET

2012-03-22 Thread Mihail
Looking at 
documentationon
 using ForeignKey.on_delete with models.SET I can't find a way to pass an 
object being deleted to callable 

get_sentinel_user to correctly choose new value for foreign key field. Any 
advice on how can I work around this problem?

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



[1.4c2] The storage backend of the staticfiles finder doesn't have a valid location.

2012-03-22 Thread Micky Hulse
I must be overlooking something obvious. My error:



The static files collect just fine (currently, I just have admin files
to collect); the above error just shows up every time I run
collectstatic.

Settings:

STATIC_ROOT = '/home/billy/webapps/xyz_static/'
STATIC_URL = '/static/'
STATICFILES_DIRS = ()
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
INSTALLED_APPS = (
'django.contrib.staticfiles',
)

Sorry if this is an obvious one... I could not find anything useful
via a Google search.

Many thanks in advance!

Cheers,
M

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