Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-21 Thread Erik Cederstrand
Den 21/01/2014 kl. 08.58 skrev Johannes Schneider : > maybe I I formulated it not precise enough. > I need to check if some instance of a model comes from some database query > (e.g. via get(..)) or is instanciated 'by hand'. and not jet written to the > database. > In this case I don't need to

Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-21 Thread Avraham Serour
wouldn't checking for the presence of an id enough? as far as I know instantiated objects don't have id's On Tue, Jan 21, 2014 at 10:16 AM, Erik Cederstrand < erik+li...@cederstrand.dk> wrote: > Den 21/01/2014 kl. 08.58 skrev Johannes Schneider < > johannes.schnei...@galileo-press.de>: > > > may

Re: How to send a activation email when creating accounts in site?

2014-01-21 Thread Swastik Acharya
Its very difficult to read your project dude..either u wont had chinese languages in between comments and codes or you must have written everything in your language.. cheers, swastik On Saturday, 4 January 2014 14:17:20 UTC+5:30, 项楠 wrote: > > I use django 1.6.1 and python 3.3.3 in windows8. I

Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-21 Thread Johannes Schneider
yes, but the problem is that we manually give them a pk. Maye it's the best to reduce the question to the following: Which (undocumented) field is better for this case? * instance._state.db (checking if this is None) * instance_state.adding (checking for True) bg, Johannes On 21.01.2014 10:07,

Re: Django Survey App

2014-01-21 Thread Yazmin Lucy Cumberbirch
Hi! Thanks for your suggestion! I have tried to use it, I installed formly and added it to my INSTALLED_APPS and to the urls, but I cant manage to get it working. I also downloaded the pinax account project but can't run it. Any change you can give me hand with it? pinax account project wont

Re: UUIDField from django-extensions is not available in Class Based Views

2014-01-21 Thread Timothy W. Cook
SOLVED: (sort of) I am not sure if this is the only or best way to solve the problem. But, since I needed to use get_context_data() in the view anyway. I am now doing this to get ct_id into the view template: def get_context_data(self,**kwargs): context = super(DvStringUpdateView, self).get_

Re: Django Survey App

2014-01-21 Thread Yazmin Lucy Cumberbirch
Solved the problem :) Thanks for the help. Will see if it does all my boss wants ^^ On Tuesday, January 21, 2014 11:10:45 AM UTC+1, Yazmin Lucy Cumberbirch wrote: > > Hi! > > Thanks for your suggestion! > > I have tried to use it, I installed formly and added it to my > INSTALLED_APPS and to t

Saving models with NOT NULL ForeignKeys referencing each other

2014-01-21 Thread antialiasis
Hi, I just bumped into this issue. Say I have the following models: class Foo(models.Model): bar = models.ForeignKey('Bar', related_name='foos') class Bar(models.Model): default_foo = models.ForeignKey(Foo, related_name='+') Basically, the idea is that each bar has many foos, but one

Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-21 Thread Avraham Serour
pk is not necessarily id, in any case if you are the one adding it then you already know that the object didn't come from the db, in order to check that later I would add an attribute to the object and check it's presence, if not present it means it came from the db. On Tue, Jan 21, 2014 at 11:55

Re: Saving models with NOT NULL ForeignKeys referencing each other

2014-01-21 Thread Russell Keith-Magee
On Tue, Jan 21, 2014 at 6:54 PM, antialiasis wrote: > Hi, > > I just bumped into this issue. Say I have the following models: > > > class Foo(models.Model): > bar = models.ForeignKey('Bar', related_name='foos') > > class Bar(models.Model): > default_foo = models.ForeignKey(Foo, related_na

displaying manytomany fields in template

2014-01-21 Thread splucena
Template: {% for per in person_list%} {{ per }} {% for spec in per.specialization_id.all %} {{ spec }} {% endfor %} {% endfor %} Here's my code in the template. I'ts not doing what I intend to see. The table looks like this: FullName | Programming | Web D

AttributeError: 'TaggableManager' object has no attribute 'primary_key'

2014-01-21 Thread vinoth kumar renganathan
When i making new migration with this command "python manage.py schemamigration blogger --auto" it shows " You cannot use --auto on an app with no migrations. Try --initial." so i try to run "python manage.py schemamigration blogger --initial" . And i got this in my terminal Traceback (most rec

Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-21 Thread Erik Cederstrand
Den 21/01/2014 kl. 10.55 skrev Johannes Schneider : > yes, but the problem is that we manually give them a pk. > > Maye it's the best to reduce the question to the following: > Which (undocumented) field is better for this case? > * instance._state.db (checking if this is None) > * instance_stat

Re: KeyError: u"Unknown language code 'en-us'."

2014-01-21 Thread Geotribu
Hi Jonathan, Thanks to yhou I've found what was wrong in my configuration file ! Thanks again and I've a good day. A. Le lundi 20 janvier 2014 17:11:55 UTC-3:30, Jonathan Pentecost a écrit : > > There is no language code "en-us" in django. `from > django.conf.global_settings import LANGUAGES

Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-21 Thread Johannes Schneider
thnx guys for all that input. On 21.01.2014 14:06, Erik Cederstrand wrote: Den 21/01/2014 kl. 10.55 skrev Johannes Schneider : yes, but the problem is that we manually give them a pk. Maye it's the best to reduce the question to the following: Which (undocumented) field is better for this ca

Re: Django Survey App

2014-01-21 Thread Ovnicraft
On Tue, Jan 21, 2014 at 5:14 AM, Yazmin Lucy Cumberbirch wrote: > Solved the problem :) Thanks for the help. Will see if it does all my boss > wants ^^ > > > On Tuesday, January 21, 2014 11:10:45 AM UTC+1, Yazmin Lucy Cumberbirch > wrote: >> >> Hi! >> >> Thanks for your suggestion! >> >> I have tr

Re: Adding an API to an existing Django app

2014-01-21 Thread Dennis Plöger
Hi! You could use content negotiation to achieve what you want > http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html > No, that's not what I want. I'm actually looking for a way to lift my REST api to the same level as my Web UI. I have a completely working Web UI, that uses models or query

Odd issue with 1.6.1 (as opposed to 1.5.5)

2014-01-21 Thread François Schiettecatte
Hi I am wondering if there is something about CONN_MAX_AGE in 1.6.1 and accessing objects from a script (as opposed to as part of an HTTP request). I have set CONN_MAX_AGE to 60 (seconds) but I don't see the connection closing after that interval. In fact I am seeing the connection idle for mor

Re: rendering HTML as a select item

2014-01-21 Thread Bill Freeman
Have you confirmed that it isn't the browser doing this? That is, with the mark safe in place, have you looked at the output with curl? Or have you made a static html page with the desired construct in it, and viewed it in the browser? It may bee that option elements can't contain block level el

Insite help

2014-01-21 Thread Matthew Stroud
I have been working on an application and it's working quite well. However I have been requested to have insite help integrated in to the site (e.g. a help button). Though I could just create static pages and serve them up, I would much rather have something that has a WYSIWYG editor that I can

Re: rendering HTML as a select item

2014-01-21 Thread Larry Martell
On Tue, Jan 21, 2014 at 8:53 AM, Bill Freeman wrote: > Have you confirmed that it isn't the browser doing this? > > That is, with the mark safe in place, have you looked at the output with > curl? > > Or have you made a static html page with the desired construct in it, and > viewed it in the brow

Re: Insite help

2014-01-21 Thread Avraham Serour
https://django-cms.org/ On Tue, Jan 21, 2014 at 5:55 PM, Matthew Stroud wrote: > I have been working on an application and it's working quite well. > However I have been requested to have insite help integrated in to the site > (e.g. a help button). Though I could just create static pages and s

Re: Flatpages - Django 1.5.1

2014-01-21 Thread James
Fixed. After some Google-fu I set SITE_ID = 2 and it worked. On Monday, January 20, 2014 4:41:05 PM UTC-8, James wrote: > > I’m having trouble implementing flatpages in Django 1.5.1 - I’m new to > Django/Python (~3 months) so any insight is appreciated. > > I’ve added flatpages in APPS and MIDDLE

Adding custom javascript to admin

2014-01-21 Thread Larry Martell
I have a model that I need to add some custom javascript processing to its admin form, which is this: class CategoryAdmin(admin.ModelAdmin): radio_fields = {"data_path_ip": admin.HORIZONTAL} list_display = ('name', 'event_path', 'data_path', 'file_spec', 'data_path_ip') list_filter = (

Re: Adding custom javascript to admin

2014-01-21 Thread Larry Martell
On Tue, Jan 21, 2014 at 9:08 AM, Larry Martell wrote: > I have a model that I need to add some custom javascript processing to > its admin form, which is this: > > class CategoryAdmin(admin.ModelAdmin): > radio_fields = {"data_path_ip": admin.HORIZONTAL} > list_display = ('name', 'event_pa

Re: Seperate fields for SelectDateWidget in template

2014-01-21 Thread ernando
Hi, You have to look on MultiWidget and use it as base to create your own one. - Dmitry On Monday, January 6, 2014 7:22:07 PM UTC+3, Voyager wrote: > > I have Googled a lot but I can't find an answer. I want to use > SelectDateWidget in one of my forms but I want the select boxes in > separat

Re: Insite help

2014-01-21 Thread Enyert Viñas
Right now you dont need WYSIWYG editors. Just learn Chrome DevTools and use a text editor. For example Vim, Sublime Text or Emacs. You can try an IDE like eclipse or PyCharm too. Regards. 2014/1/21 Matthew Stroud > I have been working on

Re: displaying manytomany fields in template

2014-01-21 Thread Jonathan Pentecost
You will need to provide the Person model to decipher what is going on in your template. On Tuesday, 21 January 2014 17:34:00 UTC+11, splucena wrote: > > > > Template: > > {% for per in person_list%} > > {{ per }} > {% for spec in per.specialization_id.all %} > {{ spec

Re: AttributeError: 'TaggableManager' object has no attribute 'primary_key'

2014-01-21 Thread Jonathan Pentecost
I think there is a problem with the taggit library, possibly similar to https://github.com/alex/django-taggit/issues/186 ? On Tuesday, 21 January 2014 19:21:08 UTC+11, vinoth kumar renganathan wrote: > > When i making new migration with this comm

Re: Overriding admin sidebar

2014-01-21 Thread Jonathan Pentecost
Your not loading the "trans" tag, https://docs.djangoproject.com/en/1.5/topics/i18n/translation/#internationalization-in-template-code On Tuesday, 21 January 2014 12:32:56 UTC+11, larry@gmail.com wrote: > > I am trying to override the admin sidebar block. As a starting point I > just copie

Re: Overriding admin sidebar

2014-01-21 Thread Larry Martell
Thanks!! On Tue, Jan 21, 2014 at 1:43 PM, Jonathan Pentecost wrote: > Your not loading the "trans" tag, > https://docs.djangoproject.com/en/1.5/topics/i18n/translation/#internationalization-in-template-code > > > On Tuesday, 21 January 2014 12:32:56 UTC+11, larry@gmail.com wrote: >> >> I am t

Question about django_session table.

2014-01-21 Thread Chen Xu
Hi everyone, I am wondering when I use db as my session backend, does django_session table auto adds an entry to it when I call login? Thanks in advance -- ⚡ Chen Xu ⚡ -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Error in Django Admin When I try to add.

2014-01-21 Thread Dharwin Perez
I was trying to make a API Dispatcher, but when i try to add anything in Django Admin, run APIdispatcher and return Bad Request. I think that is some in the URL because when i comment those line, Django Admin works correctly. urls.py url(r'^(?P.*)/(?P.*)/(?P.*)/(?P.*)/$', 'People.views.APIdis

Opening up multiple database connections per request?

2014-01-21 Thread jeff do
Is it possible to open up multiple database connections inside of one request in Django? I am using Django 1.6 and Python3.3. In my use case, I have a web application that executes raw SQL against a data warehouse we have. For example, one page may require five different SQL queries to be ex

Re: Opening up multiple database connections per request?

2014-01-21 Thread Russell Keith-Magee
Hi Jeff, Correct - Django has one database connection per request. If you want to open multiple connections, you're going to look into Django's support for multiple databases. You're using django.db.connection; this is really just shorthand for django.db.connections['default']. If you define an '

django with no relational db?

2014-01-21 Thread devash
I am building an app with no relational DB. All data will be in flat files now and nosql dbs in future. I plan to use django-tastypie for rest api and mostly pure python from rest api code to connect to file system and non relational backend python api. I do not plan to use Django ORM.

Re: django with no relational db?

2014-01-21 Thread Alex Mandel
On 01/21/2014 06:56 PM, devash wrote: > > I am building an app with no relational DB. All data will be in flat files > now and nosql dbs in future. > > I plan to use django-tastypie for rest api and mostly pure python from > rest api code to connect to file system and non relational backend

Cannot import name execute_manager

2014-01-21 Thread MAurice
Hello django users, I have a problem when i try to sync my db or runserver on my ubuntu 13.10. of cant import name execute manger Help me out thanks File "manage.py", line 2, in from django.core.management import execute_manager ImportError: cannot import name execute_manager -- You recei

Re: Cannot import name execute_manager

2014-01-21 Thread Mike Dewhirst
On 22/01/2014 6:16pm, MAurice wrote: Hello django users, I have a problem when i try to sync my db or runserver on my ubuntu 13.10. of cant import name execute manger Help me out thanks You are probably running Django 1.6.x which doesn't have execute_manager. Here is the 1.5.x code which expla

Re: Cannot import name execute_manager

2014-01-21 Thread Mike Dewhirst
On 22/01/2014 6:36pm, Mike Dewhirst wrote: On 22/01/2014 6:16pm, MAurice wrote: Hello django users, I have a problem when i try to sync my db or runserver on my ubuntu 13.10. of cant import name execute manger Help me out thanks You are probably running Django 1.6.x which doesn't have execute_