'FormSet' object has no attribute 'save'

2012-10-16 Thread Satinderpal Singh
I used formsets for different forms in my project, it displays the
forms to user but on submitting the form it gives the following error:
 'chem_analysisFormFormSet' object has no attribute 'save'. I don't
know how to save the formset in the views. Here is the code of my
views file of my project:

def chemical_analysis(request):
ChemicalFormSet = formset_factory(chem_analysisForm)
if request.method=='POST':
formset = ChemicalFormSet(request.POST, request.FILES)
if formset.is_valid():
cd = formset.cleaned_data
formset.save()
return 
HttpResponseRedirect(reverse('Automation.report.views.result_chem'))
#return 
render_to_response('report/chemical_analysis.html',
{'chem': chem,},context_instance=RequestContext(request))
else:
return HttpResponse("There was an error with 
your
submission. Please try again.")

else:
formset = ChemicalFormSet()
return render_to_response('report/report_add_row.html', 
{'formset':
formset}, context_instance=RequestContext(request))

-- 
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

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



Trying to send key value pair to perl script using subprocess

2012-10-16 Thread Pervez Mulla
Hi,

I am trying to send key:value pair to perl script via sub-process module . 
I just tried with simple example it works fine. How can I pass key:value 
pair to perl script .?

Ans also how can send multiple input fields value to perls script> Below is 
my code

view.py
-
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from subprocess import Popen, PIPE, sys
import subprocess 

def ex(request):
myName = 'Pervez'
if 'firstname' in request.POST:
myName = (request.POST['firstname'])
p = 
Popen(['/home/pervez/Desktop/simplepage/simplepage/templates/ex.pl', 
myName],stdin=PIPE, stdout=PIPE)
p.stdin.close()
result = p.stdout.read()
return render_to_response('ex.html', {'name': 
result},context_instance=RequestContext(request))

ex.pl


#!/usr/bin/perl

$|=1;# Flush immediately.

 print "Content-Type: text/plain\n\n";
 read(STDIN,$form, $ENV{'CONTENT_LENGTH'}); 
 foreach $pair (split('&', $form)) {
 if ($pair =~ /(.*)=(.*)/) {  # found key=value;
 ($key,$value) = ($1,$2); # get key, value.
 $value =~ s/\+/ /g;  # substitute spaces for + signs.
 $value =~ s/%(..)/pack('c',hex($1))/eg;
 $inputs{$key} = $value;   # Create Associative Array.
 }
 }
 
 foreach $item (keys(%inputs)) {
 print "$item - $inputs{$item}\n"; 
 }


ex.html
---

{{ name }}

   {% csrf_token %}
   
   Signup Form
   
   First Name 
   Last Name
   User Name
   Password
   Verify Password
   Your E-mail
    



   
   
   
 

Please Help me

Pervez

-- 
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/-/t5r_rscbvOEJ.
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: User can't edit anything

2012-10-16 Thread Nikolas Stevenson-Molnar
Out of curiosity (obviously it wouldn't be a good solution), if you give
the account which /doesn't/ work superuser status, is that account then
able to edit content?

_Nik

On 10/16/2012 2:08 PM, Shawn H wrote:
> I have, as far as I can tell.  I've created a group with add, edit,
> and delete permissions on the model, and made the user a member of
> that group.  The user can't edit anything.  I've deleted the group and
> just assigned add, edit, and delete privileges to the user, and the
> user still can't edit anything.  The super user can edit no problem,
> just not any other user.
>
> On Monday, October 15, 2012 11:23:07 AM UTC-5, Nikolas
> Stevenson-Molnar wrote:
>
> Being 'staff' only means that the user can access the admin area, not
> that they can do anything there. Double check that they have
> permissions
> (or are a member of a group which has permissions) to edit each
> content
> type you want them to be able to edit.
>
> _Nik
>
> On 10/12/2012 2:02 PM, Shawn H wrote:
> > I'm new to django, and using the admin site for user management.
>  I've
> > created a new user, issued app | model | permission of add, change,
> > and delete to this user for the app I've built, but when I logon as
> > that user, I get the "you don't have permission to edit anything".
> >  The user is active (obviously as I can logon as that user) and is
> > staff, but the permissions don't seem to be working.  What might
> I be
> > missing?  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/-/5zMO9ZPGel4J
> .
> > To post to this group, send email to django...@googlegroups.com
> .
> > To unsubscribe from this group, send email to
> > django-users...@googlegroups.com .
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en
> .
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/3f7cDH1EMcAJ.
> 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.



Better feedback for admin users

2012-10-16 Thread Daniele Procida
I am starting to customise the admin classes for my models so that I can 
provide extra feedback to the user. 

For example I want to report - in the admin page - useful information about how 
the system will interpret the current state of the object being edited. 

I'm doing this by using readonly_fields, that contain the output of method on 
the ModelAdmin class, a bit like this:

class PersonAdmin(ModelAdmin):
readonly_fields = ['check_address',]

def check_address(self, instance):
return instance.get_full_address or "Warning: 
I am unable to work out an address for this person."

(the actual examples are rather more complex, but this is the idea).

Does a more elegant way of doing this exist, either in Django's core already, 
or using some package that makes it easier?

Thanks,

Daniele

-- 
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: User can't edit anything

2012-10-16 Thread Shawn H
I have, as far as I can tell.  I've created a group with add, edit, and 
delete permissions on the model, and made the user a member of that group. 
 The user can't edit anything.  I've deleted the group and just assigned 
add, edit, and delete privileges to the user, and the user still can't edit 
anything.  The super user can edit no problem, just not any other user.

On Monday, October 15, 2012 11:23:07 AM UTC-5, Nikolas Stevenson-Molnar 
wrote:
>
> Being 'staff' only means that the user can access the admin area, not 
> that they can do anything there. Double check that they have permissions 
> (or are a member of a group which has permissions) to edit each content 
> type you want them to be able to edit. 
>
> _Nik 
>
> On 10/12/2012 2:02 PM, Shawn H wrote: 
> > I'm new to django, and using the admin site for user management.  I've 
> > created a new user, issued app | model | permission of add, change, 
> > and delete to this user for the app I've built, but when I logon as 
> > that user, I get the "you don't have permission to edit anything". 
> >  The user is active (obviously as I can logon as that user) and is 
> > staff, but the permissions don't seem to be working.  What might I be 
> > missing?  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/-/5zMO9ZPGel4J. 
> > To post to this group, send email to 
> > django...@googlegroups.com. 
>
> > To unsubscribe from this group, send email to 
> > django-users...@googlegroups.com . 
> > For more options, visit this group at 
> > http://groups.google.com/group/django-users?hl=en. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/3f7cDH1EMcAJ.
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: New tutorial added to Django by Example

2012-10-16 Thread Nikolas Stevenson-Molnar
Could you please provide further details about what didn't work or what
errors you encountered?

Thanks,
_Nik

On 10/16/2012 9:25 AM, go scholarship wrote:
> hi, im using django 1.4 and when i follow you tutorial
> http://lightbird.net/dbe/todo_list.html associating users with tasks
> did not work well
>
> user = models.ForeignKey(User, blank=True, null=True)
> for item in Item.objects.filter(created=obj):
> if not item.user:
> item.user = request.user
> item.save()
> return HttpResponseRedirect(reverse("admin:todo_item_changelist"))
>
> please help?
>
> -- 
> 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/-/Ncj8JtWrkpIJ.
> 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.



How to change the appearance of the Admin date widget in front end (previous question deleted)

2012-10-16 Thread Saadat


I integrated the Django Admin datewidget into my front end. I want to 
change the appearance and some text in the calendar that appears. So, I 
found out that somehow, the script that is being invoked is 
DateTimeShortcuts.js. I tried to change the code through su vi and saved 
the changes, but no change appears in the output. Can someone point out 
what I'm doing wrong. I pasted the link to the screenshot to make it easier 
for you to understand what I'm trying to do. Help will really be 
appreciated. Thanks a lot.

http://imageshack.us/a/img31/2977/screenshot20121016at709.png

Saadat

-- 
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/-/zfauDIyymD4J.
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: Cant Import mysite.urls

2012-10-16 Thread go scholarship
i'am using django 1.4, and i just want to get currently logged in user,and 
associating those users with tasks. 

this is my model.py:

class Reminder(models.Model):
domain_name = models.CharField(max_length=40)
server_package = models.ForeignKey(Paket)
server_location = models.ForeignKey(Lokasi)
case = models.IntegerField(choices=PILIHAN, default=1)
quota_upgrade = models.PositiveSmallIntegerField()
ordered_date = models.ForeignKey(Daftar)
expired_date = models.DateField(blank=True,null=True)
completed = models.BooleanField()
completed_date = models.DateField(blank=True, null=True)
ordered_by = models.ForeignKey(User, blank=True, null=True)
assigned_group = models.ForeignKey(StaffList)
# note = models.TextField(blank=True,null=True)
priority = models.PositiveSmallIntegerField()

def save(self):
# if items is being marked complete, set the completed_date
if self.completed :
self.completed_date = datetime.datetime.now()
if not self.id:
self.ordered_by = request.user
super(Reminder, self).save()

and this is my admin.py:

class ItemAdmin(admin.ModelAdmin):
list_display = ('domain_name', 'ordered_by', 'assigned_group', 
'expired_date', 'completed')
list_filter = ('assigned_group',)
ordering = ('expired_date',)
search_fields = ('domain_name',)
admin.site.register(Datacenter)
admin.site.register(Lokasi)
admin.site.register(Paket)
admin.site.register(StaffList)
admin.site.register(Reminder, ItemAdmin)

please help.

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



Edit the appearance of Django admin date widget in front end.

2012-10-16 Thread Saadat


I integrated the Django Admin datewidget into my front end. I want to 
change the appearance and some text in the calendar that appears. So, I 
found out that somehow, the script that is being invoked is 
DateTimeShortcuts.js. I tried to change the code through su vi and saved 
the changes, but no change appears in the output. Can someone point out 
what I'm doing wrong. I pasted the link to the screenshot to make it easier 
for you to understand what I'm trying to do. Help will really be 
appreciated. Thanks a lot.

http://imageshack.us/a/img31/2977/screenshot20121016at709.png

Saadat

-- 
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/-/MfSPLwIv4pYJ.
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: New tutorial added to Django by Example

2012-10-16 Thread go scholarship
hi, im using django 1.4 and when i follow you tutorial 
http://lightbird.net/dbe/todo_list.html associating users with tasks did 
not work well

user = models.ForeignKey(User, blank=True, null=True)
for item in Item.objects.filter(created=obj):
if not item.user:
item.user = request.user
item.save()
return HttpResponseRedirect(reverse("admin:todo_item_changelist"))

please help?

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



Re: How to sync data between two DBs

2012-10-16 Thread Nikolas Stevenson-Molnar
Do you already have data on the new database which you need to preserve?
If not, would a simple SQL dump work?

_Nik

On 10/16/2012 2:15 AM, Alexander Todorov wrote:
> Hello guys,
> I'm in the process of migrating from self managed MySQL DB to Xeround
> cloud database and would like to synchronize my objects. The sync is
> only in one direction: OLD DB -> NEW DB, then switch to the new DB
> entirely.
>
> South mentions data migrations which are in fact data transformations.
> Nothing like objects sync there. I'm also puzzled by the section
> "Converting other installations and servers" in their docs but I guess
> I will have to experiment. I have only one DB server but many workers
> with the same code accessing it.
>
> django-synchro looks promissing but depends on django-dbsettings which
> has some issues with cache backends (I have a custom cache backend and
> this smells like a trouble). It also has issues with objects.update()
> which I have used a lot in my code.
>
>
> This type of sync operation can also easily be used for local backup
> or some multiple DB servers setup where synchronization is done above
> the DB level.
>
>
> What are your recommendations? What have you tried yourself?
>
> Thanks,
> Alex
> -- 
> 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/-/II5MwjEWbo4J.
> 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 getting my GeoDjango setup.

2012-10-16 Thread smcoll
You can add GIS support to your existing project, but as you suspected, 
your current db will not be sufficient.  Unless someone knows how to 
convert an existing database, i believe you'll need to set up a new 
database from the postgis template, and move all your data to it.  That 
process might look something like this:

>From your current project, dump all your data to a json file:
$ python manage.py dumpdata --all --natural > all.json

The `natural` flag helps preserve some things like contenttypes and 
permissions.

Then switch to your new postgis template in your settings file (along with 
the other necessary items you already mentioned, like changing your backend 
to postgis).

Next:

$ python manage.py syncdb
$ python manage.py migrate # if using south
$ python manage.py loaddata all.json

You might run into an issue between syncdb and loaddata, because syncdb 
loads initial data into your tables for apps with a 
fixtures/initial_data.json file (auth, for example).  If you can use the 
dev (1.5) code, use the --no-initial-data flag.  Otherwise, you may need to 
run something like the following on your Postgres db before loaddata:

=# delete from auth_group_permissions; delete from auth_permission; delete 
from django_admin_log; delete from django_content_type;

Hope that helps.


On Monday, October 15, 2012 11:04:02 PM UTC-5, JJ Zolper wrote:
>
> Hello everyone,
>
> So I've installed GDAL, PostGIS, PROJ.4, and GEOS. I have Postgres set up 
> too.
>
> What I need help on is the logistics of getting the GeoDjango portion of 
> my website up and running. I already have my website code I'm just trying 
> to add in GeoDjango so I can handle geographic operations on the website.
>
> So I've been reading here:
>
>
> https://docs.djangoproject.com/en/1.4/ref/contrib/gis/tutorial/#introduction
>
> I see:
> Create GeoDjango 
> Project
>
> Use the django-admin.py script like normal to create a geodjango project:
>
> $ django-admin.py startproject geodjango
>
> With the project initialized, now create a world Django application 
> within the geodjango project:
>
> $ cd geodjango$ python manage.py startapp world
>
> Configure 
> settings.py
>
> The geodjango project settings are stored in the geodjango/settings.py file. 
> Edit the database connection settings appropriately:
>
> DATABASES = {
> 'default': {
>  'ENGINE': 'django.contrib.gis.db.backends.postgis',
>  'NAME': 'geodjango',
>  'USER': 'geo',
>  }}
>
> In addition, modify the 
> INSTALLED_APPS
>  setting 
> to include 
> django.contrib.admin
> , 
> django.contrib.gis,
>  
> and world (our newly created application):
>
> INSTALLED_APPS = (
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'django.contrib.admin',
> 'django.contrib.gis',
> 'world')
>
>
>
> My question is do I need to start a new project if I already have one 
> project already? I already have my project "madtrak" which is the project 
> that contains my entire website. Do I need a separate project just for 
> GeoDjango? I thought that the start project command was only done once and 
> for the website. Or do I need to run "django-admin.py startproject 
> geodjango" ?
>
> If I find that I don't need to start a new project that would help a lot 
> because then I would already have a settings.py file with my installed apps 
> and an app that will have a model that connects up to the Geodjango 
> database.
>
> One more thing on this topic I see:
>
>  'ENGINE': 'django.contrib.gis.db.backends.postgis',
>
>
> Even if I don't need an entire separate project do I need to add this 
> backend to my current django project? That way I can handle all the 
> Geodjango necessities? 
>
> Because currently I have:
>
> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
>
> and I would guess that is not sufficient. Any advice on handling my 
> current settings file and interfacing that with the GeoDjango database 
> would be great!
>
>
>
> Okay secondly I see this:
> Create a Spatial 
> Database
>
> Note
>
> MySQL and Oracle users can skip this section because spatial types are 
> already built into the database.
>
> First, a spatial database needs to be created for our project. If using 
> PostgreSQL and PostGIS, then the following commands will create the 
> database from a spatial database

Re: setting up openlayers proxy.cgi

2012-10-16 Thread Sibi Prabakaran
Would you tell the steps you followed to make that work?

Thanks in advance.

Regards,
Sibi

On Tuesday, November 15, 2011 12:14:53 PM UTC+5:30, Daryl wrote:
>
> Thanks for that Brett. 
> I ended up finding what I was after, django-httpproxy. 
> https://bitbucket.org/bkroeze/django-http-proxy 
> I can now make remote uri calls from javascripts on my Local Django. 
> Cheers. 
>
> On Nov 15, 4:22 am, Brett Epps  wrote: 
> > Django itself won't run a CGI script for you.  You'll need to run it 
> with 
> > another web server like Apache or nginx.  (Usually the default 
> > installation of Apache has a cgi-bin directory where you can place CGI 
> > scripts.)  You can run one of these servers at the same time as running 
> > manage.py run server, but you'll need to use different ports. 
> > 
> > Hope this helps, 
> > 
> > Brett 
> > 
> > On 11/13/11 2:21 PM, "Daryl"  wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > >I need to know how to setup a proxy.cgi script  on my Local Django 
> > >Development setup and can't seem to find the right information to do 
> > >it. 
> > >The closest i've gotten to running any cgi script is when it just 
> > >displays the source code on the webpage...which isn't exactly 
> > >'running' is it? 
> > >Is it ok to run a cgi server and the Django runserver at the same 
> > >time? Is that the problem? 
> > >I'd really appreciate any help with this as its taken up a lot of my 
> > >time and I need the proxy setup for an Openlayers project. Yes, I did 
> > >try and post this question on Geodjango Users, but didn't even get it 
> > >published... 
> > 
> > >-- 
> > >You received this message because you are subscribed to the Google 
> Groups 
> > >"Django users" group. 
> > >To post to this group, send email to 
> > >django...@googlegroups.com. 
>
> > >To unsubscribe from this group, send email to 
> > >django-users...@googlegroups.com . 
> > >For more options, visit this group at 
> > >http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/egvHDpc7aNMJ.
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: perfectionists... motto doesn't fit

2012-10-16 Thread Moonlight
Why not just professionally answer the question asked?

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



How to sync data between two DBs

2012-10-16 Thread Alexander Todorov
Hello guys,
I'm in the process of migrating from self managed MySQL DB to Xeround cloud 
database and would like to synchronize my objects. The sync is only in one 
direction: OLD DB -> NEW DB, then switch to the new DB entirely. 

South mentions data migrations which are in fact data transformations. 
Nothing like objects sync there. I'm also puzzled by the section 
"Converting other installations and servers" in their docs but I guess I 
will have to experiment. I have only one DB server but many workers with 
the same code accessing it. 

django-synchro looks promissing but depends on django-dbsettings which has 
some issues with cache backends (I have a custom cache backend and this 
smells like a trouble). It also has issues with objects.update() which I 
have used a lot in my code. 


This type of sync operation can also easily be used for local backup or 
some multiple DB servers setup where synchronization is done above the DB 
level. 


What are your recommendations? What have you tried yourself? 

Thanks,
Alex

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



inspectdb doesn't introspect foreign key constraints in SQLite?

2012-10-16 Thread Larry Knibb
I generated a models.py from an existing SQLite database using 
django-admin.py inspectdb but it is missing the foreign key definitions.

https://docs.djangoproject.com/en/dev/ref/django-admin/#inspectdb says it's 
not supported in SQLite (only PostgresSQL and some MySQL scenarios) but 
then I dug around a bit and found https://code.djangoproject.com/ticket/9779

So there was an implementation and tests for this functionality (4 years 
ago). Where has it gone?

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



error:ValueError: generator already executing

2012-10-16 Thread Shelley
Hello,everyone.
I met some problems,I really hope that anyone can help me.
*
*
I had writen some code in below:

*DICT_INDIUSERFORUN_LIST_BY_TYPE* = {}
def get_indiuserforum_list_by_type_form_cache(obj,obj_type,parentnode):
if parentnode == "-1":
key = "%s_%s_%s"%(obj.id,obj_type,"00")
else:
key = "%s_%s_%s"%(obj.id,obj_type,parentnode)
mydict = DICT_INDIUSERFORUN_LIST_BY_TYPE
update_time = mydict.get('update_time_%s'%key)
working_key = 'working_%s'%key
working = mydict.get(working_key)
refresh_flag = False
indiuserforum_list_by_type = []

if not update_time:
refresh_flag = True
else:
indiuserforum_list_by_type = 
mydict.get('indiuserforum_list_by_type_%s'%key,[])
if not indiuserforum_list_by_type:
refresh_flag = True
else:
now = datetime.datetime.now()
delta = now - update_time
if delta.seconds > SHORT_CACHE_TIMEOUT:
refresh_flag = True

if refresh_flag and not working:
mydict[working_key] = True

try:
  *  indiuserforum_list_by_type = x #function to set value*
finally:
mydict[working_key] = False
mydict['indiuserforum_list_by_type_%s'%key] = 
indiuserforum_list_by_type
mydict['update_time_%s'%key] = datetime.datetime.now()
return indiuserforum_list_by_type


but sometimes it occur the below error:
Traceback (most recent call last):
  File "d:\python24\lib\site-packages\django\core\handlers\base.py", line 
100, in get_response
response = callback(request, *callback_args, **callback_kwargs)
  File "D:\PROJECT\APP\VIEWS.py", line 675, in get_message_replay_list
for replyobj in replyobj_list:
  File "d:\python24\lib\site-packages\django\db\models\query.py", line 106, 
in _result_iter
self._fill_cache()
  File "d:\python24\lib\site-packages\django\db\models\query.py", line 760, 
in _fill_cache
self._result_cache.append(self._iter.next())
ValueError: generator already executing

Many thanks
Regards

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



request object in custom TEMPLATE_LOADER

2012-10-16 Thread mmuk2
Hi,

I'm sure this question has been asked before, but I thought I'd throw it 
out there as it's something I've come across in a project I'm working on at 
present.

What is the best way to include a request object in a custom 
template_loader?

The reason I need the request object available in my custom template loader 
is so that I can check the device that the request is coming on and load a 
different template for each device.

Any help would be greatly appreciated.

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