Re: count

2016-01-27 Thread aspellip
Which version of Django do you using?

вторник, 26 января 2016 г., 23:14:03 UTC+2 пользователь suabiut написал:
>
> When i did that i got the error:
>
> 'dict' object has no attribute 'render_context'
>
>
>
> On Tue, Jan 26, 2016 at 7:25 PM, > wrote:
>
>> Try this
>> def foreginexchange_view(request):
>> t = loader.get_template("template.html")
>> test=ball.objects.filter(request="checked").count()
>> return HttpResponse(t.render({'test': test}))
>>
>> On Tuesday, January 26, 2016 at 4:45:52 AM UTC+2, suabiut wrote:
>>>
>>> Thanks James,
>>> here is my view.py
>>>
>>> def foreginexchange_view(request):
>>> test=ball.objects.filter(request="checked").count()
>>> return render(request,'template.html',locals())
>>>
>>>
>>>
>>> Cheers
>>>
>>>
>>>
>>>
>>> On Tue, Jan 26, 2016 at 1:30 PM, James Schneider  
>>> wrote:
>>>

 On Jan 25, 2016 6:07 PM, "sum abiut"  wrote:
 >
 > Hi,
 > i am trying to count the number of fields that has request field 
 begin checked and then display the value of count in a template.html but i 
 am not sure how to go about doing that.
 >
 > For example i want to do something like
 >
 > test=ball.object.filter(request="checked").count()
 >
 > then on a template.html i want to out put the value of test
 >
 > {{test}}
 >
 > i have try that but i am not getting any value from the output.
 >

 Can you post your view? You would run that query in your view and then 
 pass it to your template through the context.

 -James

 -- 
 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...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUgThuMtZvUj3QHxLKFHiRu67oTZuvfoLT3K9EpNt08Dg%40mail.gmail.com
  
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>>
>>>
>>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/24038981-7076-4287-9a8d-31e3d83ab7d0%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a95743cd-8d68-4f92-91c9-c49ca7dfc329%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Questions about session

2016-01-27 Thread Krishnakant


If you wish to keep some data always visible specially i the base 
template, then why not make the base template a single page app and then 
through ajax lode other pages?

You can also use angular.js for such work.
happy hacking.
Krishnakant.

On Wednesday 27 January 2016 03:36 AM, Lorenzo Bernardi wrote:

Hello,

  I'm writing an app which needs authentication and I was wondering if 
the information about the user should be put in request.session. My 
app deals with the access to certain equipments and every user has a 
different set of equipment it can sees. Should I put the list of 
equipment in the session or should I compute each time I access a view 
or a form in creating a method in the my_app_user class which compute 
the rights by quering the database. Session might not be the best 
option because it keeps data so that a user can still have access even 
if it has been deleted.


My problem is in fact with the templates because once a user is logged 
the interface should show the equipment the user can access as a menu 
and so I should have the information available in the template 
(typically the base template). In that case the request.session can be 
a good option since I can check if the user has the right to access 
the equipment or not.  If I'm not using request.session it looks like 
I have to send the data for each views. Or is ther any other options?


Sorry if the questions is too silly but I haven't found any 
information for that kind of problems which looks rather common and so 
if you can send me any pointer I'm really interested. It might be more 
general than django perhaps. I mean session are used everywhere.


Sincerely

L.



--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/56A85CBD.2020107%40openmailbox.org.
For more options, visit https://groups.google.com/d/optout.


Re: Questions about session

2016-01-27 Thread Lorenzo Bernardi

Hello,



I answered a very similar question to this a few days ago: 
https://groups.google.com/forum/#!msg/django-users/L3pUwDYs6jw/bSYVs81tEwAJ 



thanks for the link. I agree with you for the fact that updating session 
might be a problem because it should be done for each views explicitely. 
It seems that in fact django does it by itself on each request (and I 
didn't know that). My problem is that I have to use a custom user models 
because of extra information and permissions. You seem to imply that in 
the case of a custom auth backend I might have to use the 
request.session variable. I do a custom authentication because the way 
the password is computed in the external application I'm taking the info 
is not the same as django'one but it looks like the way to go is to 
extend the login() function of django.contrib.auth to add the 
information I need in the template.


TL;DR; You can keep everything in the session if you want, but its a 
ton more work and probably error prone. Django's approach is a fresh 
batch of data calls every time.
Better stick to this philosophy then and understand how to add 
information to request.user.


thanks,

L.

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/56A8B032.2080405%40lpn.cnrs.fr.
For more options, visit https://groups.google.com/d/optout.


Re: Questions about session

2016-01-27 Thread Lorenzo Bernardi

Hello,


If you wish to keep some data always visible specially i the base 
template, then why not make the base template a single page app and 
then through ajax lode other pages?


I thought of using ajax but I'm not very familiar with it. But I didn't 
think of making the base page a single app. I'll look for that.



You can also use angular.js for such work.


Here again I'll have a look at it.


happy hacking.


thanks,

L.

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/56A8B0DA.60808%40lpn.cnrs.fr.
For more options, visit https://groups.google.com/d/optout.


Reverse Foriegnkey filtering

2016-01-27 Thread Jonty Needham
I've found a need to do this and I'm struggling. Some info seems to
indicate that django doesn't support this. How is it meant to be done?

Basically to be clear, I need to filter one queryset on a reverse
foriegnkey relation to another set of objects defined by a particualr
filter.

model1(Models.model):
stuff = charfield

model2(Models.model):
cow = Foreignkey(model1)
country = charfield


Problem: filter set of model1's by a particular country that's related to
model1 through model2

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANOQRbw40C9NTiwLc_c3cT9BWLj_nDKnk76KSb1U57w0VXq_ag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reverse Foriegnkey filtering

2016-01-27 Thread Rafael E. Ferrero
why not filter model2 with select_related ?? (you already try to put a
related_name in the foreignkey of model2?)

cheers!

Rafael E. Ferrero

2016-01-27 8:58 GMT-03:00 Jonty Needham :

> I've found a need to do this and I'm struggling. Some info seems to
> indicate that django doesn't support this. How is it meant to be done?
>
> Basically to be clear, I need to filter one queryset on a reverse
> foriegnkey relation to another set of objects defined by a particualr
> filter.
>
> model1(Models.model):
> stuff = charfield
>
> model2(Models.model):
> cow = Foreignkey(model1)
> country = charfield
>
>
> Problem: filter set of model1's by a particular country that's related to
> model1 through model2
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANOQRbw40C9NTiwLc_c3cT9BWLj_nDKnk76KSb1U57w0VXq_ag%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJJc_8UETZdT5tmdKzrJ%3DCWXnZH7jfss9tVsPkGriLjTXXKkgg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reverse Foriegnkey filtering

2016-01-27 Thread Michal Petrucha
On Wed, Jan 27, 2016 at 11:58:23AM +, Jonty Needham wrote:
> I've found a need to do this and I'm struggling. Some info seems to
> indicate that django doesn't support this. How is it meant to be done?
> 
> Basically to be clear, I need to filter one queryset on a reverse
> foriegnkey relation to another set of objects defined by a particualr
> filter.
> 
> model1(Models.model):
> stuff = charfield
> 
> model2(Models.model):
> cow = Foreignkey(model1)
> country = charfield
> 
> 
> Problem: filter set of model1's by a particular country that's related to
> model1 through model2

If I read the problem correctly, the following should solve it::

model1.objects.filter(model2__country=my_country)

Cheers,

Michal

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20160127121545.GB19381%40konk.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Digital signature


Re: search page

2016-01-27 Thread Ilias Dimos
The easiest way i have used is this

http://toastdriven.com/blog/2008/nov/09/quick-dirty-search-django/



On Tuesday, January 26, 2016 at 11:46:21 PM UTC+2, Xristos Xristoou wrote:
>
> hello,
>
>
> i want to an easy way to create search page on my site to searching only 
> the titles.
> who is the better and easy way for to doa that ?
> mayde some tools to install ?
> any idea ?
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fdb63976-b1e1-4a36-9eea-4f27078dafda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


help with ManyToMany

2016-01-27 Thread dave.l
Hi,

I have recently returned to a Django project after a few years and I'm a 
little rusty on ManyToMany fields.

Here's my very simple models:


class Studio(models.Model):
name = models.CharField(max_length=255, unique=True)

class StudioGroup(models.Model):
description = models.CharField(max_length=255, unique=True)
studio = models.ManyToManyField(Studio)


So a bunch of Studio(), which can be in multiple StudioGroups()

Given a single instance of a Studio(), I would like a single list of all 
other studios in all other groups.

so if Group1 is A,B,C and Group2 is A,D,E

I would like to return B,C,D,E for A.

My current solution is entirely in Python (which works), but I'd like a 
more Django-esque solultion of possible!

Thank you,

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b7dff539-92ed-465c-a612-c8464724ccab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django linking static content to dynamic content

2016-01-27 Thread Shekar Tippur
Hello,

I have implemented authentication via django allauth. I am trying to link 
UI which is loosely coupled with django.
I am able to get to the index page by all other static content throes a 404 
error. Appreciate any help on this.
I have gone thro https://docs.djangoproject.com/en/1.8/howto/static-files/ 
but I guess I am missing something.

Here is what I have tried:

1. I have copied all my html code to templates folder

2. Created symbolic links to the location of my static files under BASE_DIR

3. Here is my settings.py


TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "templates/static"),
os.path.join(BASE_DIR, "css"),
os.path.join(BASE_DIR, "img"),
os.path.join(BASE_DIR, "js"),
)


- S


-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6e4cd43e-4ce2-41c9-9788-f78fd5e77e5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Adding a field to a model after initial migration

2016-01-27 Thread ofeyofey
Hi,
I forgot to add a field to a model and wish to add it now.
I added the line to models.py but makemigrations and migrate aren't working 
now.
Is this possible in Django or do i need to go directly tp the sqlite DB and 
do it using SQL?
Thanks
Currently following this tutorial 
https://www.youtube.com/watch?v=g0tvJsUAx7g

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fd23ad1b-19e9-404f-96da-df02262ab8f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding a field to a model after initial migration

2016-01-27 Thread sum abiut
What error did your get? what command did you use?

try
python manage.py makemigrations
python manage.py migrate

On Wed, Jan 27, 2016 at 11:21 AM, ofeyofey  wrote:

> Hi,
> I forgot to add a field to a model and wish to add it now.
> I added the line to models.py but makemigrations and migrate aren't
> working now.
> Is this possible in Django or do i need to go directly tp the sqlite DB
> and do it using SQL?
> Thanks
> Currently following this tutorial
> https://www.youtube.com/watch?v=g0tvJsUAx7g
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/fd23ad1b-19e9-404f-96da-df02262ab8f7%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPCf-y6kTf5aFL4xjWHCaY-K-%2BRAkjYvYXRNH0Zkp_Y8Y8EJrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django linking static content to dynamic content

2016-01-27 Thread James Schneider
On Wed, Jan 27, 2016 at 8:30 AM, Shekar Tippur  wrote:

> Hello,
>
> I have implemented authentication via django allauth. I am trying to link
> UI which is loosely coupled with django.
> I am able to get to the index page by all other static content throes a
> 404 error. Appreciate any help on this.
> I have gone thro https://docs.djangoproject.com/en/1.8/howto/static-files/
> but I guess I am missing something.
>
> Here is what I have tried:
>
> 1. I have copied all my html code to templates folder
>
> 2. Created symbolic links to the location of my static files under BASE_DIR
>
> 3. Here is my settings.py
>
>
> TEMPLATES = [
> {
> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
> 'DIRS': [os.path.join(BASE_DIR, 'templates')],
> 'APP_DIRS': True,
> 'OPTIONS': {
> 'context_processors': [
> 'django.template.context_processors.debug',
> 'django.template.context_processors.request',
> 'django.contrib.auth.context_processors.auth',
> 'django.contrib.messages.context_processors.messages',
> ],
> },
> },
> ]
>
> STATIC_URL = '/static/'
> STATIC_ROOT = os.path.join(BASE_DIR, "static")
> STATICFILES_DIRS = (
> os.path.join(BASE_DIR, "templates/static"),
> os.path.join(BASE_DIR, "css"),
> os.path.join(BASE_DIR, "img"),
> os.path.join(BASE_DIR, "js"),
> )
>
>
> - S
>
>
Kind of an odd layout that you have specified. A tree listing of this
structure with just the directories would be helpful.

Is this an issue with the built-in dev server, or are you trying to put
this into production?

Can you add a print(STATICFILES_DIRS) at the end of your settings.py file
and see what the dev server prints out? Those paths should line up with
where your static files are.

I'm also not sure if the static files helpers included in Django will
follow symlinks. Make sure that the user where the server process is being
run (be it the dev server or a production server) has proper read access to
those files and directories.

Are you running python manage.py collectstatic? You probably won't need to
for the development server, but will for a production server.

-James

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWc0buq7va3cGhc1xWnLK%3Dgrvh%3Dt_Jctfpo1DUx_ZPwnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: help with ManyToMany

2016-01-27 Thread Xristos Xristoou
your code is correct,where are the problem ?in the admin first add Studio 
and sfter this select on the field studio from class studiogroup one or 
more entries from the class studio so simple,

christos

Τη Τετάρτη, 27 Ιανουαρίου 2016 - 5:50:21 μ.μ. UTC+2, ο χρήστης dave.l 
έγραψε:
>
> Hi,
>
> I have recently returned to a Django project after a few years and I'm a 
> little rusty on ManyToMany fields.
>
> Here's my very simple models:
>
>
> class Studio(models.Model):
> name = models.CharField(max_length=255, unique=True)
>
> class StudioGroup(models.Model):
> description = models.CharField(max_length=255, unique=True)
> studio = models.ManyToManyField(Studio)
>
>
> So a bunch of Studio(), which can be in multiple StudioGroups()
>
> Given a single instance of a Studio(), I would like a single list of all 
> other studios in all other groups.
>
> so if Group1 is A,B,C and Group2 is A,D,E
>
> I would like to return B,C,D,E for A.
>
> My current solution is entirely in Python (which works), but I'd like a 
> more Django-esque solultion of possible!
>
> Thank you,
>
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8b2e5699-8365-4827-8803-59160e746b18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django linking static content to dynamic content

2016-01-27 Thread Shekar Tippur
James,

Thanks for responding. This is just my development env. I have tried 
running collectstatic as well. I have included static file helpers.

STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
]


print(STATICFILE_DIRS):
('/Users/ctippur/PycharmProjects/trainer/templates/static', 
'/Users/ctippur/PycharmProjects/trainer/templates/css', 
'/Users/ctippur/PycharmProjects/trainer/templates/img', 
'/Users/ctippur/PycharmProjects/trainer/templates/js')
This is being run on local laptop. I have permissions to run this.

Here my tree listing.

├── *__pycache__*

│   └── manage.cpython-34.pyc

├── create_static

├── db.sqlite3

├── *manage.py*

├── *static*

│   ├── *tools*

├── *templates*

│   ├── *applayout.html*

* ||*── *fonts* -> static/tools/DEVELOPER/HTML_version/fonts

* ||*── *img* -> static/tools/DEVELOPER/HTML_version/img

* ||*── *css* -> static/tools/DEVELOPER/HTML_version/css

* ||*── *js* -> static/tools/DEVELOPER/HTML_version/fonts

* ||*── *xml* -> static/tools/DEVELOPER/HTML_version/fonts

│   ├── base.html

│   ├── *blank_.html*

│   ├── *blog.html*

│   ├── *bootstrap-forms.html*

│   ├── *bootstrap-validator.html*

│   ├── *buttons.html*

│   ├── *calendar.html*

│   ├── *chartjs.html*

│   ├── *chat.html*

│   ├── *ckeditor.html*

│   ├── *datatables.html*

│   ├── *difver.html*

│   ├── *dropzone.html*

│   ├── *dygraphs.html*

│   ├── *email-template.html*

│   ├── *error404.html*

│   ├── *error500.html*

│   ├── *fa.html*

│   ├── *flags.html*

│   ├── *flot.html*

│   ├── *forgotpassword.html*

│   ├── *form-elements.html*

│   ├── *form-templates.html*

│   ├── *forum-post.html*

│   ├── *forum-topic.html*

│   ├── *forum.html*

│   ├── *gallery.html*

│   ├── *general-elements.html*

│   ├── *glyph.html*

│   ├── *gmap-xml.html*

│   ├── *grid.html*

│   ├── *image-editor.html*

│   ├── *inbox.html*

│   ├── *index.html*

│   ├── *index_ie8_prototype.html*

│   ├── *inline-charts.html*

│   ├── *invoice.html*

│   ├── *jqgrid.html*

│   ├── *jqui.html*

│   ├── *lock.html*

│   ├── *login.html*

│   ├── *morris.html*

│   ├── *nestable-list.html*

│   ├── *other-editors.html*

│   ├── *plugins.html*

│   ├── *pricing-table.html*

│   ├── *profile.html*

│   ├── *projects.html*

│   ├── *register.html*

│   ├── *registration*

│   ├── *search.html*

│   ├── *static*

│   ├── *table.html*

│   ├── *timeline.html*

│   ├── *treeview.html*

│   ├── *typography.html*

│   ├── *validation.html*

│   ├── *widgets.html*

│   └── *wizard.html*

├── *trainer*

│   ├── __init__.py

│   ├── *__pycache__*

│   ├── models.py

│   ├── serializers.py

│   ├── settings.py

│   ├── urls.py

│   ├── *views*

│   ├── views.py

│   └── wsgi.py

└── urls.py

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/48433c8d-f131-4487-be6d-3b7f58f64f02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding a field to a model after initial migration

2016-01-27 Thread Xristos Xristoou
no the problem is your new field affect models rules...try the new field to 
have null=True or default=somathing and then run on mynage.py makemigration 
yourapp and after migrate yourapp

christos

Τη Τετάρτη, 27 Ιανουαρίου 2016 - 9:21:16 μ.μ. UTC+2, ο χρήστης ofeyofey 
έγραψε:
>
> Hi,
> I forgot to add a field to a model and wish to add it now.
> I added the line to models.py but makemigrations and migrate aren't 
> working now.
> Is this possible in Django or do i need to go directly tp the sqlite DB 
> and do it using SQL?
> Thanks
> Currently following this tutorial 
> https://www.youtube.com/watch?v=g0tvJsUAx7g
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/89327473-cf28-4aed-bee6-56f534136463%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding a field to a model after initial migration

2016-01-27 Thread ofeyofey
Thanks for your reply.

The model.py contains,

class SignUp(models.Model):
email = models.EmailField()
full_name =  models.CharField(max_length = 120, blank = True, null = 
True)
timestamp = models.DateTimeField(auto_now_add = True, auto_now = False)
updated = models.DateTimeField(auto_now_add = False, auto_now = True)

def __unicode__(self): #__str__ for python3

  return self.email

I had to add the updated field,

updated = models.DateTimeField(auto_now_add = False, auto_now = True)

Running make migrations,

[pi@Huawei-HG658c-instalacion src]$ python manage.py makemigrations
/home/pi/src/djangoTest/urls.py:20: RemovedInDjango110Warning: Support for 
string view arguments to url() is deprecated and will be removed in Django 
1.10 (got news.views.home). Pass the callable instead.
  url(r'^$', 'news.views.home', name='home'),

No changes detected

Then running migrations

[pi@Huawei-HG658c-instalacion src]$ python manage.py migrate
/home/pi/src/djangoTest/urls.py:20: RemovedInDjango110Warning: Support for 
string view arguments to url() is deprecated and will be removed in Django 
1.10 (got news.views.home). Pass the callable instead.
  url(r'^$', 'news.views.home', name='home'),

Operations to perform:
  Apply all migrations: admin, news, contenttypes, auth, sessions
Running migrations:
  Rendering model states... DONE
  Applying news.0002_signup_updated...Traceback (most recent call last):
  File "manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py"
, line 353, in execute_from_command_line
utility.execute()
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py"
, line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", 
line 348, in run_from_argv
self.execute(*args, **cmd_options)
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", 
line 399, in execute
output = self.handle(*args, **options)
  File 
"/usr/lib/python2.7/site-packages/django/core/management/commands/migrate.py"
, line 200, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File "/usr/lib/python2.7/site-packages/django/db/migrations/executor.py", 
line 92, in migrate
self._migrate_all_forwards(plan, full_plan, fake=fake, fake_initial=
fake_initial)
  File "/usr/lib/python2.7/site-packages/django/db/migrations/executor.py", 
line 121, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=
fake_initial)
  File "/usr/lib/python2.7/site-packages/django/db/migrations/executor.py", 
line 198, in apply_migration
state = migration.apply(state, schema_editor)
  File "/usr/lib/python2.7/site-packages/django/db/migrations/migration.py", 
line 123, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, 
project_state)
  File 
"/usr/lib/python2.7/site-packages/django/db/migrations/operations/fields.py"
, line 62, in database_forwards
field,
  File 
"/usr/lib/python2.7/site-packages/django/db/backends/sqlite3/schema.py", 
line 221, in add_field
self._remake_table(model, create_fields=[field])
  File 
"/usr/lib/python2.7/site-packages/django/db/backends/sqlite3/schema.py", 
line 103, in _remake_table
self.effective_default(field)
  File "/usr/lib/python2.7/site-packages/django/db/backends/base/schema.py", 
line 210, in effective_default
default = field.get_db_prep_save(default, self.connection)
  File 
"/usr/lib/python2.7/site-packages/django/db/models/fields/__init__.py", 
line 728, in get_db_prep_save
prepared=False)
  File 
"/usr/lib/python2.7/site-packages/django/db/models/fields/__init__.py", 
line 1461, in get_db_prep_value
value = self.get_prep_value(value)
  File 
"/usr/lib/python2.7/site-packages/django/db/models/fields/__init__.py", 
line 1440, in get_prep_value
value = super(DateTimeField, self).get_prep_value(value)
  File 
"/usr/lib/python2.7/site-packages/django/db/models/fields/__init__.py", 
line 1296, in get_prep_value
return self.to_python(value)
  File 
"/usr/lib/python2.7/site-packages/django/db/models/fields/__init__.py", 
line 1399, in to_python
parsed = parse_datetime(value)
  File "/usr/lib/python2.7/site-packages/django/utils/dateparse.py", line 93
, in parse_datetime
match = datetime_re.match(value)
TypeError: expected string or buffer

Thanks,




On Wednesday, 27 January 2016 19:21:16 UTC, ofeyofey wrote:
>
> Hi,
> I forgot to add a field to a model and wish to add it now.
> I added the line to models.py but makemigrations and migrate aren't 
> working now.
> Is this possible in Django or do i need to go directly tp the sqlite DB 
> and do it using SQL?
> Thanks
> Currently following this tutorial 
> https://www.youtube.com/watch?v=g0tvJsUAx7g
>

-- 
You received this message because you are subscribed to 

Re: Adding a field to a model after initial migration

2016-01-27 Thread Xristos Xristoou
work now ?

Τη Τετάρτη, 27 Ιανουαρίου 2016 - 9:21:16 μ.μ. UTC+2, ο χρήστης ofeyofey 
έγραψε:
>
> Hi,
> I forgot to add a field to a model and wish to add it now.
> I added the line to models.py but makemigrations and migrate aren't 
> working now.
> Is this possible in Django or do i need to go directly tp the sqlite DB 
> and do it using SQL?
> Thanks
> Currently following this tutorial 
> https://www.youtube.com/watch?v=g0tvJsUAx7g
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c9935dfd-ebdb-4f8a-849e-4e81027468c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: count

2016-01-27 Thread sum abiut
Version 1.7

On Wed, Jan 27, 2016 at 10:42 PM,  wrote:

> Which version of Django do you using?
>
> вторник, 26 января 2016 г., 23:14:03 UTC+2 пользователь suabiut написал:
>>
>> When i did that i got the error:
>>
>> 'dict' object has no attribute 'render_context'
>>
>>
>>
>> On Tue, Jan 26, 2016 at 7:25 PM,  wrote:
>>
>>> Try this
>>> def foreginexchange_view(request):
>>> t = loader.get_template("template.html")
>>> test=ball.objects.filter(request="checked").count()
>>> return HttpResponse(t.render({'test': test}))
>>>
>>> On Tuesday, January 26, 2016 at 4:45:52 AM UTC+2, suabiut wrote:

 Thanks James,
 here is my view.py

 def foreginexchange_view(request):
 test=ball.objects.filter(request="checked").count()
 return render(request,'template.html',locals())



 Cheers




 On Tue, Jan 26, 2016 at 1:30 PM, James Schneider 
 wrote:

>
> On Jan 25, 2016 6:07 PM, "sum abiut"  wrote:
> >
> > Hi,
> > i am trying to count the number of fields that has request field
> begin checked and then display the value of count in a template.html but i
> am not sure how to go about doing that.
> >
> > For example i want to do something like
> >
> > test=ball.object.filter(request="checked").count()
> >
> > then on a template.html i want to out put the value of test
> >
> > {{test}}
> >
> > i have try that but i am not getting any value from the output.
> >
>
> Can you post your view? You would run that query in your view and then
> pass it to your template through the context.
>
> -James
>
> --
> 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...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUgThuMtZvUj3QHxLKFHiRu67oTZuvfoLT3K9EpNt08Dg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>




 --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/24038981-7076-4287-9a8d-31e3d83ab7d0%40googlegroups.com
>>> 
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -
>>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a95743cd-8d68-4f92-91c9-c49ca7dfc329%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPCf-y43L46HLD21DnhKqxE5U4OPq9RVTGekrifzHWjNriSkYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding a field to a model after initial migration

2016-01-27 Thread ofeyofey
Hi,

I changed the line to

updated = models.DateTimeField(auto_now_add = False, auto_now = True, null=
True)



But the same results,

[pi@Huawei-HG658c-instalacion src]$ python manage.py makemigrations
/home/pi/src/djangoTest/urls.py:20: RemovedInDjango110Warning: Support for 
string view arguments to url() is deprecated and will be removed in Django 
1.10 (got news.views.home). Pass the callable instead.
  url(r'^$', 'news.views.home', name='home'),

Migrations for 'news':
  0003_auto_20160127_2109.py:
- Alter field updated on signup
[pi@Huawei-HG658c-instalacion src]$ python manage.py migrate
/home/pi/src/djangoTest/urls.py:20: RemovedInDjango110Warning: Support for 
string view arguments to url() is deprecated and will be removed in Django 
1.10 (got news.views.home). Pass the callable instead.
  url(r'^$', 'news.views.home', name='home'),

Operations to perform:
  Apply all migrations: admin, news, contenttypes, auth, sessions
Running migrations:
  Rendering model states... DONE
  Applying news.0002_signup_updated...Traceback (most recent call last):
  File "manage.py", line 10, in 
...
  File 
"/usr/lib/python2.7/site-packages/django/db/models/fields/__init__.py", 
line 1399, in to_python
parsed = parse_datetime(value)
  File "/usr/lib/python2.7/site-packages/django/utils/dateparse.py", line 93
, in parse_datetime
match = datetime_re.match(value)
TypeError: expected string or buffer




Thanks

On Wednesday, 27 January 2016 19:21:16 UTC, ofeyofey wrote:
>
> Hi,
> I forgot to add a field to a model and wish to add it now.
> I added the line to models.py but makemigrations and migrate aren't 
> working now.
> Is this possible in Django or do i need to go directly tp the sqlite DB 
> and do it using SQL?
> Thanks
> Currently following this tutorial 
> https://www.youtube.com/watch?v=g0tvJsUAx7g
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/79a24585-2e34-460c-8b94-5764eac4bad9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding a field to a model after initial migration

2016-01-27 Thread Xristos Xristoou
you add your app name after the run makemigration and migrate ?if your app 
name is a blog then you run* makemigration blog *and *migrate blog*

Τη Τετάρτη, 27 Ιανουαρίου 2016 - 9:21:16 μ.μ. UTC+2, ο χρήστης ofeyofey 
έγραψε:
>
> Hi,
> I forgot to add a field to a model and wish to add it now.
> I added the line to models.py but makemigrations and migrate aren't 
> working now.
> Is this possible in Django or do i need to go directly tp the sqlite DB 
> and do it using SQL?
> Thanks
> Currently following this tutorial 
> https://www.youtube.com/watch?v=g0tvJsUAx7g
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/287b857b-3097-49eb-a54a-d71bd04058c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding a field to a model after initial migration

2016-01-27 Thread ofeyofey
Ok I put the app name which is 'news' after the commands for makemigrations 
and for migrate.
But I am still getting the same results.

On Wednesday, 27 January 2016 19:21:16 UTC, ofeyofey wrote:
>
> Hi,
> I forgot to add a field to a model and wish to add it now.
> I added the line to models.py but makemigrations and migrate aren't 
> working now.
> Is this possible in Django or do i need to go directly tp the sqlite DB 
> and do it using SQL?
> Thanks
> Currently following this tutorial 
> https://www.youtube.com/watch?v=g0tvJsUAx7g
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d2cdcf2c-bbca-46ce-971d-a2b9d8e0ce45%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding a field to a model after initial migration

2016-01-27 Thread Xristos Xristoou
i dont know why sorry..try default value

Τη Τετάρτη, 27 Ιανουαρίου 2016 - 9:21:16 μ.μ. UTC+2, ο χρήστης ofeyofey 
έγραψε:
>
> Hi,
> I forgot to add a field to a model and wish to add it now.
> I added the line to models.py but makemigrations and migrate aren't 
> working now.
> Is this possible in Django or do i need to go directly tp the sqlite DB 
> and do it using SQL?
> Thanks
> Currently following this tutorial 
> https://www.youtube.com/watch?v=g0tvJsUAx7g
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b12e839f-908e-4235-894f-0d75e3b03124%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding a field to a model after initial migration

2016-01-27 Thread ofeyofey
No problem. Thanks for your help.
Maybe fields can't be added to a model with django.
I will try dropping the table in the DB and see what happens.
Thanks again,

On Wednesday, 27 January 2016 19:21:16 UTC, ofeyofey wrote:
>
> Hi,
> I forgot to add a field to a model and wish to add it now.
> I added the line to models.py but makemigrations and migrate aren't 
> working now.
> Is this possible in Django or do i need to go directly tp the sqlite DB 
> and do it using SQL?
> Thanks
> Currently following this tutorial 
> https://www.youtube.com/watch?v=g0tvJsUAx7g
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3441fafe-fa06-47e8-b280-31e46d90251a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding a field to a model after initial migration

2016-01-27 Thread sum abiut
You should try running it as root.

On Thu, Jan 28, 2016 at 8:29 AM, ofeyofey  wrote:

> No problem. Thanks for your help.
> Maybe fields can't be added to a model with django.
> I will try dropping the table in the DB and see what happens.
> Thanks again,
>
> On Wednesday, 27 January 2016 19:21:16 UTC, ofeyofey wrote:
>>
>> Hi,
>> I forgot to add a field to a model and wish to add it now.
>> I added the line to models.py but makemigrations and migrate aren't
>> working now.
>> Is this possible in Django or do i need to go directly tp the sqlite DB
>> and do it using SQL?
>> Thanks
>> Currently following this tutorial
>> https://www.youtube.com/watch?v=g0tvJsUAx7g
>>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3441fafe-fa06-47e8-b280-31e46d90251a%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPCf-y5PERyLN-kzc%3Da0oV%3DO3a5iOHAnXReC4fCUvT2Vr9Od-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding a field to a model after initial migration

2016-01-27 Thread ofeyofey
Alas too late... I have dropped the table.
But this link http://www.djangobook.com/en/2.0/chapter10.html
to a Django Book for version 1.0 may hold some ideas under the section 
about adding fields.
Thanks

On Wednesday, 27 January 2016 19:21:16 UTC, ofeyofey wrote:
>
> Hi,
> I forgot to add a field to a model and wish to add it now.
> I added the line to models.py but makemigrations and migrate aren't 
> working now.
> Is this possible in Django or do i need to go directly tp the sqlite DB 
> and do it using SQL?
> Thanks
> Currently following this tutorial 
> https://www.youtube.com/watch?v=g0tvJsUAx7g
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1d85f45e-0987-4a05-acfa-1fad9d1e3087%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: apps.populate deadlock

2016-01-27 Thread John Bazik
Following up, the discussion continued on other lists:

https://groups.google.com/forum/#!topic/django-cms-developers/CNWHNviqS6Q
https://groups.google.com/forum/#!topic/django-developers/YvEzdQU4qUU

Problem ultimately resolved by a pending PR:

https://github.com/django/django/pull/6044

John

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ed7d7fed-6039-4d9c-8b24-db620051e721%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.