Re: New to Django

2016-02-29 Thread Gary Dhillon
Thanks, really appreciate it! On Monday, 29 February 2016 19:19:21 UTC-7, Lachlan Musicman wrote: > > You will find there are two different pips on your computer - the default > is obv 2.7. the most likely command you will need is pip3 (on ubuntu), but > your best bet is to: > > - set up a virt

Re: more than one field for aggregates? (ArrayAgg, StringAgg)

2016-02-29 Thread Simon Charette
Hi Tomasz, I suppose you could implement `ROW` as a custom expression[1] and use it in your `ArrayAgg` aggregate as follow: from django.contrib.postgres.aggregates import ArrayAgg from django.db.models import Expression class Row(Expression): template = 'ROW(%(expressions)s)' # ... MyM

Re: New to Django

2016-02-29 Thread Lachlan Musicman
You will find there are two different pips on your computer - the default is obv 2.7. the most likely command you will need is pip3 (on ubuntu), but your best bet is to: - set up a virtualenv - set up your path to default to python 3.5.1 I would use the virtualenv solution personally. There is

New to Django

2016-02-29 Thread Gary Dhillon
I've installed Django and I keep getting no module named django when importing. I have python 3.5.1 and used pip to install django 1.9.2. Its showing up on my python 2.7 though. Any help would be appreciated. -- You received this message because you are subscribed to the Google Groups "Django

Re: bootstrap django crispy forms

2016-02-29 Thread James Schneider
On Fri, Feb 26, 2016 at 7:39 AM, wrote: > A simple upload button is proving difficult to implement bootstrap and css > on My attempt is as follows: > > class DocumentForm(forms.Form): >docfile = forms.FileField(label='Choose') >def __init__(self, *args, **kwargs): # don't

more than one field for aggregates? (ArrayAgg, StringAgg)

2016-02-29 Thread Tomasz Nowak
Hi! Module django.contrib.postgres.aggregates provides classes for ARRAY_AGG and STRING_AGG PostgreSQL aggregates. Is it possible to provide more than one field to these aggregates? Like in SQL, where you can provide more fields ("row" is optional): ARRAY_AGG(row(table.field1, table.field2))

Re: Absolute beginner question -- recipes

2016-02-29 Thread James Schneider
On Mon, Feb 29, 2016 at 5:57 AM, Simon Gunacker wrote: > Thank you Florian. After James pointed out that I can access my steps (and > the ingredients in some way) by just passing the recipe object to the > templates context, I thought of reducing the view to a DetailView again. > But I have to so

Re: mathematical function and django connect

2016-02-29 Thread James Schneider
On Sun, Feb 28, 2016 at 2:06 PM, Xristos Xristoou wrote: > update my project now > > my view.py code > > def calc(request): > a = [] > NList = [] > y=0 > member=0 > member = request.POST.get ('member', False) > for i in range(int(member)): >

Re:

2016-02-29 Thread Simon Charette
Hi Aaron, I think this could be related to the version of your PostgreSQL server. Django 1.9 dropped support for PostgreSQL 9.0[1] which doesn't support GROUP BY selected primary keys[2]. Cheers, Simon [1] https://docs.djangoproject.com/en/1.9/releases/1.9/#dropped-support-for-postgresql-9-0 [

How force DJANGo choice MEDIA_URL or STATIC_URL in template?

2016-02-29 Thread setivolkylany
I need choice base url MEDIA_URL (/media/) - for uploaded user picture, or STATIC_URL (/static/) - picture by default I am try next: p> , but result is MEDIA_URL(STATIC_URL) and path to file. I am next try: {% templatetag openvariable %} url 'entry_list' {% templatetag closevariable %} but

Re: Error running Django tutorial

2016-02-29 Thread Mike Kipling
I found the problem. When the mysite\urls.py file is created, it has this line already in it. from django.conf.urls import url The tutorial asks you to add the following lines to the file. from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ url(r'^pol

[no subject]

2016-02-29 Thread Aaron C. de Bruyn
A simple annotation broke when I migrated by app from Django 1.8.x to 1.9.2, and I can't figure out why for the life of me. Calling Company.objects.all().annotate(ticketcount=Count('srservice')) throws an error "ProgrammingError: column "company.owner_id" must appear in the GROUP BY clause or be

Re: Error running Django tutorial

2016-02-29 Thread jorrit787
Can you attach your entire project's code in a ZIP file? I'm curious to test this myself... On Monday, February 29, 2016 at 9:23:20 PM UTC+1, Mike Kipling wrote: > > I added polls to settings.py : > INSTALLED_APPS = [ > 'django.contrib.admin', > 'django.contrib.auth', > 'django.contr

Re: empty request object

2016-02-29 Thread Larry Martell
Yes, I'm an idiot. I had commented out the middleware when debugging and forgot to put them back. On Mon, Feb 29, 2016 at 10:09 AM, knbk wrote: > That would happen if the AuthenticationMiddleware hasn't run. In what > context is request.user missing? > > On Monday, February 29, 2016 at 3:54:24 PM

Re: parallel test running throwing pickleError

2016-02-29 Thread girish ramnani
Sorry i forgot to mention that, i have installed the tblib. this is my pip list output Django (1.10.dev20160216200705, /home/girish/Documents/Github/django) fancycompleter (0.4) ordereddict (1.1) pdbpp (0.8.3) pip (8.0.3) py (1.4.31) Pygments (2.1.2) pytest (2.8.7) setuptools (18.2) tblib (1.2.0)

Re: Error running Django tutorial

2016-02-29 Thread Mike Kipling
I added polls to settings.py : INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'polls.apps.PollsConfig', ] Then I tried the migration: C:

Re: Error running Django tutorial

2016-02-29 Thread jorrit787
Well that's strange... The problem appears to be that your polls.urls file is not getting included in your project's URLConf (since the error message in your first post says that the only URL tried was *admin/* ). I'm not sure if adding the app to INSTALLED_APPS is necessary for an app's URLConf

Re: Why not working ?

2016-02-29 Thread Nikolas Stevenson-Molnar
Please be more specific. What isn't working? What is the desired vs actual result? On Monday, February 29, 2016 at 8:39:54 AM UTC-8, setivo...@gmail.com wrote: > > > my model > . > > class Translator(models.Model): > """ > Model for dictionaries tranlations > "

Re: Ajax + Django + jQuery + HTML5

2016-02-29 Thread 'Tom Evans' via Django users
On Sun, Feb 28, 2016 at 9:46 PM, wrote: > > I need get path to local file in for ImageField. > Next, transfer path to my view thought Ajax request, update in database and > almost all. > > I need will make it manually, for my goals. > > May be, anyone known how it make? > > I am tried already d

Re: parallel test running throwing pickleError

2016-02-29 Thread Simon Charette
Hi Girish, I think you didn't to install the `tblib` package[1]. Cheers, Simon [1] https://docs.djangoproject.com/en/1.9/ref/django-admin/#cmdoption-test--parallel Le lundi 29 février 2016 12:13:08 UTC-5, girish ramnani a écrit : > > when running the django test in parallel using the runner.py

parallel test running throwing pickleError

2016-02-29 Thread girish ramnani
when running the django test in parallel using the runner.py . _pickle.PicklingError: Can't pickle : attribute lookup ModuleImportFailure on unittest.loader failed error is thrown, and when the runner is run using a single process. the test suite executes. I am using a new virtualenv with djan

Why not working ?

2016-02-29 Thread setivolkylany
my model . class Translator(models.Model): """ Model for dictionaries tranlations """ def dispatch_dictionary_media_files(instance, filename): return 'app_dictionaries/{0}/{1}'.format(instance.name.__str__(), filename) author = models.Foreign

Re: empty request object

2016-02-29 Thread knbk
That would happen if the AuthenticationMiddleware hasn't run. In what context is request.user missing? On Monday, February 29, 2016 at 3:54:24 PM UTC+1, larry@gmail.com wrote: > > So does anyone know why there would be a no user attr? I would expect > this: > > (Pdb) request.user > > > B

Re: Translate permissions Django

2016-02-29 Thread Marcos Serrano
El lunes, 29 de febrero de 2016, 14:14:42 (UTC+1), Marcos Serrano escribió: > > Hello, > > How yo translate the default permissions django.

Re: Error running Django tutorial

2016-02-29 Thread Mike Kipling
Jorr, No, I did not modify the settings.py file, because the tutorial specifically states: Note Ignore the warning about unapplied database migrations for now; we’ll deal with the database shortly. Here is a link to the tutorial: https://docs.djangoproject.com/en/1.9/intro/tutorial01/

Re: empty request object

2016-02-29 Thread Larry Martell
So does anyone know why there would be a no user attr? I would expect this: (Pdb) request.user But I get this: (Pdb) request.user *** AttributeError: 'WSGIRequest' object has no attribute 'user' On Sat, Feb 27, 2016 at 6:31 PM, Larry Martell wrote: > Yes, you are absolutely correct. Thanks fo

Re: Absolute beginner question -- recipes

2016-02-29 Thread Simon Gunacker
Thank you Florian. After James pointed out that I can access my steps (and the ingredients in some way) by just passing the recipe object to the templates context, I thought of reducing the view to a DetailView again. But I have to somehow access the ingredients from my template for now ... --

Re: Error running Django tutorial

2016-02-29 Thread jorrit787
Did you add 'polls' to your list of INSTALLED_APPS in your settings.py? After that you should run > python manage.py migrate like the terminal is suggesting to you. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group

Translate permissions Django

2016-02-29 Thread Marcos Serrano
Hello, How yo translate the default permissions django. Keywords (Add, Delete ... ) http://stackoverflow.com/questions/29398900/django-permissions-and-contenttypes-translations I tried to do something like this but it has not worked for me. Thx. -- You received this message because you are

Re: Absolute beginner question -- recipes

2016-02-29 Thread Florian Schweikert
On 28/02/16 20:14, Simon Gunacker wrote: > | > def detail(request, pk): > recipe = Recipe.objects.get(id=pk) > recipe['steps'] = Steps.objects.filter(recipe_id=pk) > template = loader.get_template('recipe/recipe_detail.html') > context = { > 'recipe': recipe, > } > r

Re: Absolute beginner question -- recipes

2016-02-29 Thread Simon Gunacker
@Mike: the attempts (at least the ones I have seen) to store hierarchical data in relations [1] don't seem very intuitive to me. At least when it comes to query the data. Anyway: I would appreciate to be convinced by something else. However, I am afraid to kick off a completely different (yet i

Re: Absolute beginner question -- recipes

2016-02-29 Thread Mike Dewhirst
On 29/02/2016 8:54 PM, Simon Gunacker wrote: Well, as far as I know hierarchical relationships are hard to model in relational databases; Definitely incorrect. Hierarchical is merely a subset of relational. Relational can handle hierarchical 1:n:m very easily plus n:1, n:m as well. Relationa

Re: Absolute beginner question -- recipes

2016-02-29 Thread Simon Gunacker
Ok ... but how can I access the additional information stored in StepIngredient then? And - to ask more general - is there a way to find all the "nested objects" attached to my current objects? Something to enter in the shell to see __all__ attributes; not just _meta.fields? -- You received t

Re: Absolute beginner question -- recipes

2016-02-29 Thread James Schneider
> Thank you James for pointing me at how to do my queries with django; I can finally list my steps using: > > {% for step in recipe.steps.all %} > > within my template. However, given the model above I am still not sure how to access a single steps ingredients ... any ideas or suggestions on my cur

Re: Debugging DJango app on production for High CPU Usage

2016-02-29 Thread Gabriel - Iulian Dumbrava
Hi! I have seen such a behavior on a couple of sites running an older version of Zinnia. It simply hit the 100% CPU usage on some queries. I would also suggest integrating New Relic. It gives you a pretty detailed information on where the CPU is spending most of the time. miercuri, 24 februarie

Re: Absolute beginner question -- recipes

2016-02-29 Thread Simon Gunacker
Hey everybody, thank you very much for your answers. I think I have already learned a lot from you! Well - there is quite a difference between stepping through a tutorial and trying to do something on my own. Regarding Mikes question whether a step of a recipe should be a sub-recipe. Well, as f

Re: Debugging DJango app on production for High CPU Usage

2016-02-29 Thread Sithembewena Lloyd Dube
New Relic. On Wed, Feb 24, 2016 at 6:59 AM, Web Architect wrote: > Hi, > > We have an ecommerce platform based on Django. We are using uwsgi to run > the app. The issue the CPU usage is hitting the roof (sometimes going > beyond 100%) for some scenarios. I would like to debug the platform on > P

Re: Debugging DJango app on production for High CPU Usage

2016-02-29 Thread James Schneider
On Tue, Feb 23, 2016 at 8:59 PM, Web Architect wrote: > Hi, > > We have an ecommerce platform based on Django. We are using uwsgi to run > the app. The issue the CPU usage is hitting the roof (sometimes going > beyond 100%) for some scenarios. I would like to debug the platform on > Production to

Re: Absolute beginner question -- recipes

2016-02-29 Thread James Schneider
On Sun, Feb 28, 2016 at 11:45 PM, Rahul Gandhi wrote: > I might be wrong here, but this is what I understand: > > Let's say you have something like this: > > > class Recipe(models.Model): > name = models.CharField(max_length=255) > description = models.TextField() > > > class Step(models.

Re: Debugging DJango app on production for High CPU Usage

2016-02-29 Thread Web Architect
The load is low - around 4-5 rps. I don't think that should effect the CPU usage so much. On Friday, February 26, 2016 at 9:57:42 PM UTC+5:30, Nikolas Stevenson-Molnar wrote: > > What sort of load are you experiencing in production? Is it possible that > you're simply running into a hardware