Integrating NoSQL-persisted custom Models

2013-05-23 Thread Kurtis
A project I am working on uses a hybrid SQL/NoSQL data backend.

I'd like to build custom Models which "behave" exactly like the traditional 
Django Models but are tied into my MongoDB backend.

Where should I start to make sure I cover all bases? Implementing  my own 
instance Model? I imagine I'll also need custom Model Managers as well.

I'm guessing there are some problems with this approach since they forked 
Django for a full non-relational release several versions ago. I imagine 
3rd party components may also throw their own set of problems at me as well.

If anyone has given this a shot before, can you share some tips or pitfalls 
you ran into during the process? 

Thanks!
- Kurtis

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




Problem with ~ in url prefix

2013-05-23 Thread Hordur Heidarsson
Hello,

I'm trying to deploy django in my public_html directory which is served via 
http://servername/~username/ by mod_wsgi in apache.
However, I'm running into some errors in the admin interface:


Environment:

Request Method: GET
Request URL: https://192.168.0.2/~hordur/django/admin/sites/site/

Django Version: 1.5.1
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.admindocs',
 'django.contrib.flatpages',
 'south',
 'django_extensions',
 'debug_toolbar',
 'micawber.contrib.mcdjango',
 'hordur')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
 'debug_toolbar.middleware.DebugToolbarMiddleware')


Template error:
In template 
/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/contrib/admin/templates/admin/change_list.html,
 
error at line 91
   a float is required
   81 : {% endif %}


   82 :   {% endblock %}


   83 : 


   84 :   {% 
csrf_token %}


   85 :   {% if cl.formset %}


   86 : {{ cl.formset.management_form }}


   87 :   {% endif %}


   88 : 


   89 :   {% block result_list %}


   90 :   {% if action_form and actions_on_top and 
cl.full_result_count %}{% admin_actions %}{% endif %}


   91 :{% result_list cl %} 


   92 :   {% if action_form and actions_on_bottom and 
cl.full_result_count %}{% admin_actions %}{% endif %}


   93 :   {% endblock %}


   94 :   {% block pagination %}{% pagination cl %}{% endblock %}


   95 :   


   96 : 


   97 :   


   98 : {% endblock %}


   99 : 

Traceback:
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/core/handlers/base.py"
 
in get_response
  140. response = response.render()
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/template/response.py"
 
in render
  105. self.content = self.rendered_content
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/template/response.py"
 
in rendered_content
  82. content = template.render(context)
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/template/base.py"
 
in render
  140. return self._render(context)
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/test/utils.py"
 
in instrumented_test_render
  65. return self.nodelist.render(context)
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/template/base.py"
 
in render
  830. bit = self.render_node(node, context)
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/template/debug.py"
 
in render_node
  74. return node.render(context)
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/template/loader_tags.py"
 
in render
  124. return compiled_parent._render(context)
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/test/utils.py"
 
in instrumented_test_render
  65. return self.nodelist.render(context)
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/template/base.py"
 
in render
  830. bit = self.render_node(node, context)
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/template/debug.py"
 
in render_node
  74. return node.render(context)
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/template/loader_tags.py"
 
in render
  124. return compiled_parent._render(context)
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/test/utils.py"
 
in instrumented_test_render
  65. return self.nodelist.render(context)
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/template/base.py"
 
in render
  830. bit = self.render_node(node, context)
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/template/debug.py"
 
in render_node
  74. return node.render(context)
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/template/loader_tags.py"
 
in render
  63. result = block.nodelist.render(context)
File 
"/home/hordur/.virtualenvs/hordur_website/lib/python2.7/site-packages/django/template/base.py"
 
in 

Re: ImportError at/ No module name

2013-05-23 Thread Rainman Tai
Hi donarb,
Thx a lot. I got the same problem and it's fixed now.


On Tuesday, December 25, 2012 10:16:23 AM UTC-8, donarb wrote:
>
> On Tuesday, December 25, 2012 4:29:22 AM UTC-8, djangobie wrote:
>>
>> I appreciate your response.
>> The __init__.py is there in the app folder (yes, I created the app via 
>> manage.py).
>> It ran perfectly on initial attempts, but with new code added, I got 
>> stuck. My so far conclusion (though, not helping at all) is may be I have 
>> set some kind 'circular loop' here, while loading (importing) modules, 
>> that's why I have pasted all the code from almost all the files.
>>
>> In your urls.py, remove the 'djangopractice' from the view paths. Most 
> likely, the tutorial was written using 1.3. so for the first path, it 
> should be:
>
> url(r'^$', 'blog.views.index'),
>
>
>

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




Inlines problem under admin: on production server I'm unable to add more lines in the inline section

2013-05-23 Thread Victor
In admin.py I have
...
class MovimentomagInline(admin.TabularInline):
model=Movimentomag
extra=3
save_on_top=True

class MovimentoOperazioneOption(admin.ModelAdmin):
list_display = ('segno', 'data_movimento', 'paziente','operatore')
fields=(('segno','data_movimento'),('paziente','operatore'))
inlines=[MovimentomagInline,]
save_on_top=True
order_by=['-data_movimento',]

admin.site.register(MovimentoOperazione,MovimentoOperazioneOption)


Now it happens that - under admin -  when I use "python manage.py runserver" in 
the developping context I can see in the inline section the "Add another ..." 
with the plus sign and I can add more lines in the inline section itself.
Submitting the same django procedure by means of Apache 2 I see the lines 
specified in the extra option but there's no longer the   "Add another ..." 
with the plus sign, therefore I cannot add more lines in the inline section.

How can I fix that?

Thanks
Vittorio



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




Display each language in its own language.

2013-05-23 Thread Cody Scott
 

I would like the language selector to display each language in its own 
language. So for example English will always be displayed as 'English'. 
Even if the current language is French it will still be 'English' and not 
Anglais.


  {% csrf_token %}  {% for 
lang in LANGUAGES %}  {{ lang.1 }}  {% endfor %}
  


I think all language selector forms should be like this.

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




Re: Multi Client Django System

2013-05-23 Thread Frank Bieniek

Hi Richard,

How do you ( a ) get the system to call your "by user" query?
*a)* in your views you query manually - see below - organization_list

And ( b ) how do you get the system to send in the current "user"?
the magic is in the permalink *get_slugged_organization_documents_url*

in the delegation view you do some redirect, every organization has its 
own slug (model of organization):



def *organization_list*(request):
"""
Function checks implicitly if this user has more than one
organization. If not forward to the organization absolute url
if it is a partner admin go to the list page
"""
*qs = Organization.objects.by_user(request.user)*
if qs.count() == 1:
# a normal partner-admin / user won't see a list of organizations
slug=qs[0].slug
return 
HttpResponseRedirect(*get_slugged_organization_documents_url*(slug))

else:
return organization_list_partner_admin(request)

def get_slugged_organization_documents_url(slug):
return ('organization_documents', (), {'organization_slug': slug})
*get_slugged_organization_documents_url = 
permalink(get_slugged_organization_documents_url)*


urls.py:
urlpatterns = patterns('',
#no organization selected, redirects to user organization
url(r'^$', organization_list, name='organization_list'),
# this one is the default url without any command, but users 
organization

*url(r'^(?P[-\w]+)/', *include(patterns('',
*url(r'^$', organization_documents, name='organization_default'),*
.
... and in the organizations_documents you check that the request.user 
is member of the slugged organization...


def *organization_documents*(request, organization_slug):
qs = Organization.objects.by_user(request.user)
try:
organization = qs.get(slug=organization_slug)
except ObjectDoesNotExist:
return HttpResponseForbidden('You are not allowed to')
   . normal code here
.

hope this helps.
basically you have a slugged organization, and a delegation view - the 
delegation view does the magic.



here is another solution to your problem - classed based view mixins for 
multi account setups:

http://django-organizations.readthedocs.org

Welcome
Frank


Am 23.05.2013 03:46, schrieb Richard E. Cooke:

Frank!

You appear to have figured out what I spent most of today trying to 
figure out:  How to get access to the current logged in user from 
INSIDE a custom data manager!


Can you clarify something in your code?

In your custom manager you define "by_user", which takes "user" as an 
input.  But in your class you just name your custom data manager in 
place of the default "object" manager.


How do you ( a ) get the system to call your "by user" query?  And ( b 
) how do you get the system to send in the current "user"?


I was thinking there might be a link through the site.model reference 
Managers get.  Or maybe a way to pull it from session, but I keep get 
stuck on the fact this isn't a view, so it has no obvious access to a 
"request" object


Thanks in advance!



On Monday, February 25, 2013 4:18:50 AM UTC-5, Frank Bieniek wrote:

We achived the second level auth, by tying an extended group to a
company,
all company members are part of this group, so we can leverage the
normal auth mechanismen.

Hope this gives you an idea.

Thanks
Frank

class CompanyManager(models.Manager):
 filter_by_user_limit_field = None

 def by_user(self, user):
 """
 Extension for filtering organization objects (also related
objects) by
 the groups of a user.
 Avoiding that a user can touch other organization objects.
Superusers and
 Partner Administrators are able to see all organizations.
 """
 # if the user is not logged in - no data
 if not user.is_authenticated():
 return self.none()
 # TODO: optimization: would be nice to find a way to make
by_user chainable like .filter(), ...
 return self.limit_queryset_by_user(
 self.get_query_set(),
 user,
 self.model.filter_by_user_limit_field
 )

 @staticmethod
 def limit_queryset_by_user(qs, user, field_key):
 if user.is_superuser.count()>0:
 return qs
 kwargs = {}
 if field_key and user.groups.count() > 0:
 kwargs[field_key] = [u['id'] for u in
user.groups.values('id')]
 return qs.filter(**kwargs)

And in the model

class Company(ExtendedModel):
 name = models.CharField(max_length=64, unique=True)
 slug = models.SlugField(unique=True)
 is_active = models.BooleanField(null=False, blank=False,
default=True)

 filter_by_user_limit_field = "organizationgroup__in"
 objects = CompanyManager()

class CompanyGroup(Group):
 """

Re: IdeaScale-alike DJango applications

2013-05-23 Thread Daniele Procida
On Thu, May 23, 2013, Russell Keith-Magee  wrote:

>On Wed, May 22, 2013 at 6:53 PM, Daniele Procida  wrote:
>
>> Are there any Django applications that do the same thing as <
>> http://ideascale.com>?
>>
>> IdeaScale basically seems to be a way for users to submit proposals, and
>> have them voted up and down by other users; like polls, but in a web
>> 2.1beta kind of way.


>Are you looking for an app that implements ideascale-like ideas for your
>own purposes, or are you suggesting an ideascale-like framework to drive
>Django development?
>
>If it's the former, then you're really just looking at tying something
>contrib.comments (or equivalent) and django-voting to a model that
>represents an "idea".

Yes... but I'm wondering whether someone has done all the hard work, tying all 
the bits together, making it look pretty, all the extra stuff (ponies, moon on 
a stick, etc).

I have found , that looks worth investigating.

>If you're talking about the latter, then it's possible to use CC counts or
>comment counts as an approximation of interest in a topic; but it might be
>interesting to see a literal "I want this" vote count associated with
>tickets.

Vote early and vote often!

Regards,

Daniele

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




Re: No module named wsgi

2013-05-23 Thread Sandeep kaur
On Thu, May 23, 2013 at 8:29 PM, Luggaz  wrote:
> I don't know what I dd but it seems to work now!
>
mod wsgi installation could have also solved he purpose, using this command :

$sudo apt-get install apache2 libapache2-mod-wsgi

-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.com

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




DeserializationError while loading a datamigration for auth data

2013-05-23 Thread Alexandre Provencio
Hello guys, I'd like to auto populate my app recently converted to
south, with permission group and user data. However, after generating
a fixture and calling it from the datamigration I'm getting this
error. I've put the steps I'm taking detailed here
http://stackoverflow.com/questions/16470492/deserializationerror-while-loading-a-datamigration-for-auth-data

Any help is welcome.

-Alexandre

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




Re: Multiprocess and Global State

2013-05-23 Thread Roberto De Ioris

> I all,
>
> Environment:
> - Django 1.5.1
> - mongoengine 0.8.1
>
> I use mongoengine to store and manage user accounts authentication.
>
> it work fine with the development server and uwsgi : only if I use a
> single
> process or thread mode.
>
> If i use more than 1 process, sometime ( when i refresh my application ),
> i
> am redirected on my login form.
>
> All my request must be authentified, i use a middleware to do this :
>
> from django.http import HttpResponse,HttpResponseRedirect
>> class AuthenticationMiddleware(object):
>>
>> _LOGIN_PATH = "/accounts/login_view/"
>>
>> def process_request(self, request):
>> if (request.path != self._LOGIN_PATH) and not request.is_ajax():
>> if not request.user.is_authenticated():
>> return HttpResponseRedirect( self._LOGIN_PATH+'?next=%s'
>> %
>> request.path)
>> return None
>
>
> I think , there are unshared data between the processes who causes this
> problem.
>
> What do you think?
>
>
> Note : it works well with gunicorn
>
> Ch.
>


If it works well with gunicorn it could be a problem with how (or better
'when') you open the connection to mongodb.

Add --lazy-apps to uWSGI options to load the application after fork()
(like gunicorn)


-- 
Roberto De Ioris
http://unbit.it

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




Re: No module named wsgi

2013-05-23 Thread Luggaz
I don't know what I dd but it seems to work now!

On Thursday, May 23, 2013 11:41:04 AM UTC+2, Luggaz wrote:
>
> Good day,
>
> I am having a problem making my website live.
> It works fine on the development server and I do get(http:127.0.0.1:8000) 
> running but when I make it live I get an error saying there's no module 
> named wsgi.
>
>
> I am using a virtualenv and when I activate virtualenv(locally) and import 
> django.core.wsgi it does import
>
> I viewed this error on file: /var/log/apache2/error.log
>
> I also have: /etc/apache2/sites-available/www.bushbucksfc.co.za
> which looks like this:
> 
>   ServerName www.bushbucksfc.co.za
>   ServerAlias bushbucksfc.co.za
>   DocumenRoot /home/websites/busbucksfc
>   WSGIDaemonProcess bushbucksfc 
> python-path=/home/websites/bushbucksfc:/home/websites/.bushenv/lib/python2.7/site-packages
>  WSGIProcessGroup bushbucksfc
>  WSGIScriptAlias / /home/websites/bushbucksfc/bushucksfc/wsgi.py
> ...
> ...
> 
>
> Regards,
> Luggaz
>

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




Re: Django tutorial - change history 24h time format?

2013-05-23 Thread Rafael E. Ferrero
https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-USE_L10N



2013/5/23 Pepsodent Cola 

> Hi,
>
> I'm reading Part 2 and this chapter *"Explore the free admin
> functionality"* of the Django tutorial.
>
> https://docs.djangoproject.com/en/1.5/intro/tutorial02/#explore-the-free-admin-functionality
>
> I have a question regarding the *"Change history"* part where you can see
> a screenshot at the end of that chapter.
>
> The time format used in the "Change history" administration pages uses *AM/PM
> time format*.  How can I make it display *24h time format* instead?
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Rafael E. Ferrero
Claro: (03562) 15514856

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




Django tutorial - change history 24h time format?

2013-05-23 Thread Pepsodent Cola
Hi,

I'm reading Part 2 and this chapter *"Explore the free admin functionality"*of 
the Django tutorial.
https://docs.djangoproject.com/en/1.5/intro/tutorial02/#explore-the-free-admin-functionality

I have a question regarding the *"Change history"* part where you can see a 
screenshot at the end of that chapter.

The time format used in the "Change history" administration pages uses *AM/PM 
time format*.  How can I make it display *24h time format* instead?

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




Re: Testing with complex database setups

2013-05-23 Thread Drew Ferguson
Hi

If I understand you correctly, you want to be able to initialise your
database to a known state;

https://docs.djangoproject.com/en/1.5/howto/initial-data/

is what you want I think - it also contains a link to this

https://docs.djangoproject.com/en/1.5/topics/testing/overview/#topics-testing-fixtures

On Thu, 23 May 2013 15:09:08 +0300
Jani Tiainen  wrote:

> Hi,
> 
> I've product that uses complex setup scripts - tens of SQL scripts that
> creates tables, views, complex triggers, grants permissions and such and
> finally populates database with some pre-data.
> 
> So how I should proceed with unit testing with database like that, since
> some operations rely heavily that there really exists all that
> trigger-function mess in the database? So that I don't need everytime to
> start from the scratch but from some known state of the db?
> 



-- 
Drew Ferguson
AFC Commercial
http://www.afccommercial.co.uk

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




Multiprocess and Global State

2013-05-23 Thread christophe de saint leger
I all, 

Environment:
- Django 1.5.1 
- mongoengine 0.8.1  

I use mongoengine to store and manage user accounts authentication.

it work fine with the development server and uwsgi : only if I use a single 
process or thread mode.

If i use more than 1 process, sometime ( when i refresh my application ), i 
am redirected on my login form.

All my request must be authentified, i use a middleware to do this : 

from django.http import HttpResponse,HttpResponseRedirect
> class AuthenticationMiddleware(object):
> 
> _LOGIN_PATH = "/accounts/login_view/"
> 
> def process_request(self, request):
> if (request.path != self._LOGIN_PATH) and not request.is_ajax():
> if not request.user.is_authenticated():
> return HttpResponseRedirect( self._LOGIN_PATH+'?next=%s' % 
> request.path)
> return None


I think , there are unshared data between the processes who causes this 
problem.

What do you think?


Note : it works well with gunicorn

Ch. 

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




Testing with complex database setups

2013-05-23 Thread Jani Tiainen
Hi,

I've product that uses complex setup scripts - tens of SQL scripts that creates 
tables, views, complex triggers, grants permissions and such and finally 
populates database with some pre-data.

So how I should proceed with unit testing with database like that, since some 
operations rely heavily that there really exists all that trigger-function mess 
in the database? So that I don't need everytime to start from the scratch but 
from some known state of the db?

-- 

Jani Tiainen

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




Filter

2013-05-23 Thread Hélio Miranda
Hi
I have the following code, in which the player have a reference to the club:
*class Club(mongoengine.Document):*
*ClubName = StringField()*
*
*
*class Player(mongoengine.Document):*
*PlayerName = StringField()*
*PlayerAge = IntField()*
*PlayerClub = fields.ListField(fields.ReferenceField(Club,*
*reverse_delete_rule=CASCADE, dbref=False))*
*
*
*--*
*
class PlayerResource(resources.MongoEngineResource):

PlayerClub = fields.ReferencedListField(of='Rela.Resource.ClubResource',
 attribute='PlayerClub', full=True, null=True)

class Meta:
queryset = Player.objects.all()
allowed_methods = ('get', 'post', 'put', 'delete')
list_allowed_methods = ['get', 'post','put', 'delete']
authorization = Authorization()
resource_name = 'Player'
filtering = {
'PlayerClub': ALL_WITH_RELATIONS,
}
 
def determine_format(self, request): 
return "application/json"
*


But after the club to see which players have, I wanted to make a filter to 
the players at the club that selected id, I returned only players that 
club. But as I am doing, I do not return anything.

For in my json is as follows:

[{"PlayerAge": 23, "PlayerClub": [{"ClubName": "Benfica", "

id": "519dd7b28774a704d4a97748", "resource_uri": "/Rela/api/v1/Club/519dd7b28774

a704d4a97748"}], "PlayerName": "Luis", "id": "519dd7b98774a704d4a97749"}]


someone can help me how can I make the filter?

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




Re: environment variables in virtualenv's postactivate using mod_wsgi

2013-05-23 Thread Steffen Zieger
On 22.05.13 18:41, Charles Mulder wrote:
> Hi,
Hi!

> Am I doing something wrong? Any suggestions or recommendations are welcome. 
This might help you:

http://drumcoder.co.uk/blog/2010/nov/12/apache-environment-variables-and-mod_wsgi/

> Kind regards,
> C

Kind regards

Steffen

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




Re: problem with ImageField does not show me the picture on a template

2013-05-23 Thread Ronny Villarroel Mendoza
Thanks a lot.

I do the following steps:
aggregate an alias to the virtual host of my site:
Alias /media /var/www/fourweb/media/

and modified:

settings.MEDIA_ROOT = '/var/www/fourweb/media/'
settings.MEDIA_URL = 'http://fourweb.com/media/'

it works!.

Cheers
Ronny

El martes, 21 de mayo de 2013 21:10:24 UTC-4, Ronny Villarroel Mendoza 
escribió:
>
> Hi all,
>
> I cant show the picture that I upload from the admin site.
>
>
> settings.py:
>
> MEDIA_ROOT = '/var/www/fourweb/'
>
>
>
> models.py:
>
> class picture(models.Model):
> producto_id = models.ForeignKey(producto)
> description = models.CharField(max_length= 250)
> imagen = models.ImageField(upload_to='photos/%Y/%m/%d', help_text = 
> '100px,150px')
> def __unicode__(self):
> return self.description
>
>
>
> view.py:
>
> def detail(request, item_id):
> p = get_object_or_404(producto, pk=item_id)
> pictures = picture.objects.filter(producto_id = item_id)
> return render_to_response('detail.html', {'item': p, 'photos': 
> pictures })
>
> and in the tamplate(details.html):
>
>
>{% if photos %}
> {% for photo in photos %}
>  width="200" >
> {% endfor %}
>{% else %}
> No hay imagen para el articulo
>{% endif %}
>
> the last html output code is:
>
>  src="photos/2013/05/14/picture_67090.jpg"
>  
> height="200" width="200" >
>
> the problem is that the picture doen't show, the path is broken. What I 
> doing wrong ???.
>
> please your help.
>
> Regards,
> Ronny 
>

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




Re: theme generator

2013-05-23 Thread Derek
Not sure it is being maintained, but may be a good starting point:

http://www.djangoslingshot.com/

Also available is:

https://github.com/ilblackdragon/django-themes


On Tuesday, 21 May 2013 23:19:30 UTC+2, Kakar wrote:
>
> Hi!
> Is there any kind of theme generator or css generator for django?
>

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




Looking for beta testers for new Django hosting

2013-05-23 Thread Michael Anckaert
Hello everyone

We are developing a new Python/wsgi hosting solution and are looking for
beta testers.
The solution we are developing will focus on ease of deployment (git
integration, management of application versions, ...)

Beta testers will receive a free instance on our platform. Don't expect a
stable or production ready environment. Your (testing) projects will live a
bleeding edge fast changing environment!

We would very much appreciate you help in developing this new product. You
can expect to work closely with our developers and your input will be used
in further defining our roadmap.
If you would like to help us out, please send an email to
platform@sinax.bewith some info about you. Ideas about what a good
hosting solution should
have are also very much appreciated.

*Kind regards*

Michael Anckaert
michael.ancka...@sinax.be
http://www.sinax.be

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




No module named wsgi

2013-05-23 Thread Luggaz
Good day,

I am having a problem making my website live.
It works fine on the development server and I do get(http:127.0.0.1:8000 ) 
running but when I make it live I get an error saying there's no module 
named wsgi.


I am using a virtualenv and when I activate virtualenv(locally) and import 
django.core.wsgi it does import

I viewed this error on file: /var/log/apache2/error.log

I also have: /etc/apache2/sites-available/www.bushbucksfc.co.za
which looks like this:

  ServerName www.bushbucksfc.co.za
  ServerAlias bushbucksfc.co.za
  DocumenRoot /home/websites/busbucksfc
  WSGIDaemonProcess bushbucksfc 
python-path=/home/websites/bushbucksfc:/home/websites/.bushenv/lib/python2.7/site-packages
 WSGIProcessGroup bushbucksfc
 WSGIScriptAlias / /home/websites/bushbucksfc/bushucksfc/wsgi.py
...
...


Regards,
Luggaz

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




View pictures from the template via models.FilePathField

2013-05-23 Thread Federico Erbea
I'm not sure this is the correct method to use, so I'm open to suggestions.
Practically I want to display the image retrieving the path where they are 
saved from the database.

In a class in models.py I have inserted:

locandina = models.FilePathField( path = "C:/Users/Federico.Erbea/Google 
Drive/Umore/apps/Database/static/Film/Locandina/", recursive=True)

In the Admin the pull-down menu perfectly recovers the files I'm interested 
in, allowing me to select the appropriate one
I didn't understand very well how works FilePathField, so I don't know how 
to pass the information to the template ... I need help, thanks

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