Extend user model multiple times

2011-11-18 Thread C. Kirby
I'm reading up on extending the user model and planing out a project and wanted to clarify a point. I want to have a single user list to authenticate using the standard user model. I want then to create multiple apps in the project, each with roles and permissions tied to the user defined in the us

Re: Manually added foreign key not working.

2013-02-20 Thread C. Kirby
I strongly recommend South (http://south.aeracode.org/) for adding new fields to existing models. As far as I know it is recommended by the Django core team as well, and they are looking at moving it into Django proper. On Wednesday, February 20, 2013 6:53:39 AM UTC-6, laxglx wrote: > > Hello a

Re: how to create formset field but not used loop in template

2013-03-01 Thread C. Kirby
I do sometimes reference formset forms individually without the loop. Allows me to better create my layout. As for your question Witold, list items in a template can take an index to select a single item. This will only work if you know how many forms are in your formset: {{formset_create_compa

Re: error in filling data in database through admin page

2013-03-01 Thread C. Kirby
It would be helpful to see the model definition(s) and the admin.py if you wrote one On Friday, March 1, 2013 1:06:34 AM UTC-6, Avnesh Shakya wrote: > > hi, > i have got one error during adding data in database though admin > page, actually it was working fine, but i made some attributes o

Re: Problem with testing Django sources

2013-03-11 Thread C. Kirby
You didn't necessarily do anything wrong, if you mean you think you failed running the tests. The test ran and 4 of them are failing. It also looks like it missed 5 expected failures in among the 217 it skipped. If your question is why are the tests failing - you might need to reword your quest

Re: error- A server error occurred. Please contact the administrator.

2013-03-12 Thread C. Kirby
Nobody can really help you unless you give the error you are getting. On Tuesday, March 12, 2013 1:33:40 AM UTC-5, Avnesh Shakya wrote: > > hi, > I m trying to login on my site through my own site, so i have > installed django-facebook, i have set setting in setting.py. Now i m trying > to

Re: error- A server error occurred. Please contact the administrator.

2013-03-12 Thread C. Kirby
curred. Please contact the > administrator." > > I hate when errors say to contact your system administrator, I am my > system administrator and am frustrated by invalid instructions. > > django-facebook? > > C. Kirby wrote: > > Nobody can really help you unless

Re: Access Model data from a ModelFormset form

2013-03-12 Thread C. Kirby
I generally do the same thing as you do Jim, it is normally the easiest. There are ways to get the bound value from the form both in the ModelForm Class and in the template (as a template tag). It is easier to do it as a template tag, but you can't use form.as_p, you need to hit each form elemen

Re: error

2013-03-13 Thread C. Kirby
It looks to be an issue with your facebook api "site domain" settings. This stackoverflow question looks to answer your troubles: http://stackoverflow.com/questions/7184632/given-url-is-not-allowed-by-the-application-configuration On Wednesday, March 13, 2013 5:21:55 AM UTC-5, Avnesh Shakya wrot

Re: I encountered a core exception and need help configuring for a database. My OS is Ubuntu 12.10 32 bit

2013-04-25 Thread C. Kirby
Can you show the file structure of you project like this: /project -app1/ --models.py --views.py -manage.py -settings.py with your actual files and structure? Also it would be useful to see the contents of you manage.py file On Friday, March 22, 2013 12:54:58 AM UTC-5, Lightning wrote: > > CORRE

Re: Unexpected Server Error (500) in tutorial

2013-04-25 Thread C. Kirby
Django 1.5 made a change with https://docs.djangoproject.com/en/1.5/releases/1.5/#allowed-hosts-required-in-production "The new ALLOWED_HOSTSsetting validates the request’s Host header and protects against host-pois

Re: unique not working as expected

2013-05-09 Thread C. Kirby
Could you elaborate on what the resolution was for future people who may run into this problem? On Thursday, May 9, 2013 9:59:00 AM UTC-5, Amber Kulkarni wrote: > > Thanks Tom. > Got the problem.Problem solved on creating new model. > > > On Thu, May 9, 2013 at 6:53 PM, Tom Evans > > wrote: > >>

Re: NoReverseMatch at /accounts/login/ Reverse for 'index' with arguments '()' and keyword arguments '{}' not found.

2013-05-10 Thread C. Kirby
Do you have a urls.py file? To used the url tag with a name you need to have a defined url with that name, example: urlpatterns = patterns('', url(r'^$', 'app.views.index', name="index"), ) On Friday, May 10, 2013 9:38:27 AM UTC-5, Hu Shizhi wrote: > > Hi, > > I am new to Django and am using

Re: Allow visitor to add a form to a formset

2013-05-29 Thread C. Kirby
It's actually not the most straightforward process. Here is a jquery plugin that will help you: http://code.google.com/p/django-dynamic-formset/ And here is a way to do it via POST without using javascript: http://brantsteen.com/blog/django-adding-inline-formset-rows-without-javascript/ On Wed

Re: Scripts to update Django tables

2013-05-29 Thread C. Kirby
Django models instances are python objects and are manipulated as such. Lets say you had a model: def Game(Model): team1 = TextField() team2 = TextField() date = DateField() location = TextField() In order to create new model instances and save them to a database you would do:

Re: linking the logged in user to other models to filter query sets -( noobie )

2013-05-29 Thread C. Kirby
Not knowing the specifics of your UserAccount model I will assume it has an organization = ForeignKeyField(Organization) In that case in your view you can just do: user_organization = request.user.organization and use that to filter the query On Wednesday, May 29, 2013 10:45:54 AM UTC-5, tony

ANNOUNCE: django-modelqueryform

2013-05-29 Thread C. Kirby
I've just placed django-modelqueryform on github http://github.com/ckirby/django-modelqueryform and PyPi. django-modelqueryform is a project that allows users to build somewhat complex queries against a model tree. It can help with complex user s

Re: Multiple Users Logged into a page at the same time

2013-05-31 Thread C. Kirby
Just going of the top of my head here: Create a model like: class OnPage(Model): user = foreignkey(User) page = TextField() In each of your your views do something like: op, created OnPage.objects.get_or_create(user = request.user) op.page = thispage (The view name, the url,

Re: Multiple Users Logged into a page at the same time

2013-05-31 Thread C. Kirby
You could also use middleware instead of the view code to do the same thing. That way you wouldn't have to put that code in every view On Friday, May 31, 2013 10:06:00 AM UTC-5, C. Kirby wrote: > > Just going of the top of my head here: > Create a model like: > > class OnPage

Re: Returning data from view to ajax call

2013-07-03 Thread C. Kirby
An HttpResponse includes http headers and will blow up an ajax call. You want to use a render_to_string method and pass either json or a rendered template (render to string bypasses the headers, render to response will include them) On Wednesday, July 3, 2013 8:14:06 AM UTC-5, larry@gmail.co

Re: Returning data from view to ajax call

2013-07-03 Thread C. Kirby
y put the template code concerning the ajax call in this thread. On Wednesday, July 3, 2013 10:47:38 AM UTC-5, larry@gmail.com wrote: > > On Wed, Jul 3, 2013 at 9:30 AM, C. Kirby > > wrote: > > An HttpResponse includes http headers and will blow up an ajax call.

Re: Django Signal DataBase Change on Template

2013-08-01 Thread C. Kirby
You are describing a push mechanism, ie. the server pushes new data to the client when it becomes available. That is basically untenable in a standard web server/client paradigm, and django explicitly is built for request/response pairs. That said, you can initiate the updates from the client.

Re: Populate choices from model

2013-08-21 Thread C. Kirby
If you want your field to represent another model you should be using a foreign key, not a CharField regio = models.ForeignKey(Regio, default = Regio.objects.get(name = "Amsterdam")) On Wednesday, August 21, 2013 10:24:11 AM UTC-5, Gerd Koetje wrote: > > Hi all, > > How do i populate choices fr

Re: Populate choices from model

2013-08-21 Thread C. Kirby
Why are you trying to link to another model with a CharField and not a ForeignKey? You seem to be trying to do something that is almost certainly not the way is should be done. Perhaps you should explain what you are trying to accomplish. On Wednesday, August 21, 2013 10:44:55 AM UTC-5, Gerd Ko

Re: [View Django] Problem with view that makes add and update

2013-08-26 Thread C. Kirby
Have you verified that the url being called has a music_id? On Monday, August 26, 2013 10:40:52 AM UTC-5, Marcos Luiz Wilhelm wrote: > > Hello! > I'm having problems with a view that makes add and update > The view generates a new record rather than change a instance. > My code is this: http://pas

Re: Implementation and maintainability of an app deployed multiple times in the same website

2013-08-27 Thread C. Kirby
Can each of the different requirements websites be on a different third-level or subdomain? (If your site is foo.com either bar.foo.com, baz.foo.com or foo.com/bar, foo.com/baz_ If so, I would deploy multiple Apache VirtualHosts, each serving an instance of your project. That way the projects ca

Re: Removing the logged in user's name from the list of users in django

2013-08-30 Thread C. Kirby
To remove the current user from your list just use an if statement in your template that tests the user instance you are iterating over against request.user i.e. {% for likes in forum.likes.all %} {% if not likes.user is request.user %}{{likes.get_full_name}}{% endif

Re: Removing the logged in user's name from the list of users in django

2013-08-30 Thread C. Kirby
I think you can use "is", but try this: {% if not likes.user == request.user %} On Friday, August 30, 2013 12:21:41 PM UTC-5, Robin Lery wrote: > > > I am getting an error: > > TemplateSyntaxError at /forum/ > > Unused 'is' at end of if expression. &g

Re: Dynamic image content

2013-09-11 Thread C. Kirby
Sure, it is possible to inline an image in html, it's just a bit of a beast and can make very large html responses. You need to base64 encode the image, and then you inline it as shown on http://www.bigfastblog.com/embed-base64-encoded-images-inline-in-html (and many other pages) On Tuesday, S

Re: When can loading one model trigger another load?

2013-09-11 Thread C. Kirby
Can't be sure without the models, but if enty.tags is a rel field (ForeignKey, ManytoMany), doing entry.tags_list will probably cause that second query. Also, where is the name tags_list coming from? In the Entry query I only see "zinnia_entry"."tags", but to get a rel mapping I would normally

Re: When can loading one model trigger another load?

2013-09-11 Thread C. Kirby
Sorry, I haven't delved deeply into the orm sql generator to help much more. I will ask, did this issue arise when you tried to assertNumQueries(1) and it returned with an error: 2 queries run? On Wednesday, September 11, 2013 3:00:29 PM UTC-5, mark...@gmail.com wrote: > > Oh, I'm sorry. Here's

Re: When can loading one model trigger another load?

2013-09-11 Thread C. Kirby
Are you using any 1.6 specific features? If not it might be worth the few minutes to see what happens in 1.5.3 On Wednesday, September 11, 2013 3:26:24 PM UTC-5, mark...@gmail.com wrote: > > Yes. I originally thought it was a savepoint-related issue (mentioned in > the "What's new" for 1.6), but

Re: django/dajax

2013-09-12 Thread C. Kirby
I would suggest trying the dajax mailing list for app specific help: https://groups.google.com/forum/#!forum/dajaxproject On Thursday, September 12, 2013 4:28:36 AM UTC-5, MikeKJ wrote: > > I simply want to populate a drop select based on what was selected in a > previous drop select box I found

Re: Appointment App

2013-09-12 Thread C. Kirby
I haven't used any of these but some quick googling found - django-schedule - django-booking - django-reservations One of those might get you started

Re: error

2013-09-13 Thread C. Kirby
Both of your return statements are in the context of if request.method == "POST" If you get a method that is not a "POST" (most likely it received a "GET") then the view doesn't return anything. If you require a post I would add: else: return HttpResponse(status = 405) 405 is request not al

Re: How to raise exception in model?

2013-09-16 Thread C. Kirby
If you successfully get to render_to_response (or similar) the template renderer will silently swallow errors. If you want the error to stop rendering and either print an error or a 500 or something similar, test it in the view before rendering. Assuming you have an entry (or list of entries I g

Re: password field showing hashed value on form value update

2013-09-18 Thread C. Kirby
Django doesn't store the original password, that would be a huge security hole. It only has the hashed password available. On Wednesday, September 18, 2013 10:10:02 AM UTC-5, Sivaram R wrote: > > I have views.py to show the form instance and update the instance. > > On edit the form data,all othe

Re: Need help figuring out why my { key:value } doesn't seem to be passed to my view by my javascript file.

2013-09-18 Thread C. Kirby
If you want to use key value pairs like that, and you are modifying data in your database, you should really be using a POST and not a GET On Wednesday, September 18, 2013 10:00:51 AM UTC-5, 7equiv...@gmail.com wrote: > > "So I think that the ajax() function is calling the URL > "/pi/?pathID=so

Re: Django admin - dinamically update through ajax choices of a ChoiceField in a ModelForm

2013-09-21 Thread C. Kirby
If you can, populate the widget with all available choices and then use your JS/AJAX to limit/hide some? On Saturday, September 21, 2013 6:32:03 PM UTC-5, luke lukes wrote: > > Hi everyone. > > I'm stucking with a ModelForm in the admin. I have two ChoicheField which > are populated with choic

Re: CSV output

2013-09-23 Thread C. Kirby
try: value = getattr(object, 'get_%s_display' % field)() except: value getattr(object, field) On Monday, September 23, 2013 4:47:33 PM UTC-5, Lachlan Musicman wrote: > > Ok, so here's the challenging part - how would you get the > get_FOO_display value for some but not all

Re: CSV output

2013-09-23 Thread C. Kirby
Whoops, missed the map step. I think you will need to create a new dict using the try/except above, and then map the new dict to str On Monday, September 23, 2013 5:29:40 PM UTC-5, C. Kirby wrote: > > try: > value = getattr(object, 'get_%s_display' % fi

Re: uptodate Account_balance

2013-10-03 Thread C. Kirby
Use signals: https://docs.djangoproject.com/en/dev/topics/signals/ post_save check the amount deposited or withdrawn and update the balance On Thursday, October 3, 2013 9:42:48 AM UTC-5, MAurice wrote: > > Am creating this project in that a client has an account in a > micro-finance and can als

Re: Copy all the data from an existing database when create the testing database.

2013-10-04 Thread C. Kirby
Do you always want all of the data from the existing database, or is this just a quick way to have "real data" for testing. If it is the latter I would use manage.py dumpdata to generate test fixtures. You can load the fixtures in you tests as needed. Chaim On Friday, October 4, 2013 8:48:45 AM

Re: Looking for a way to detect changes in database records with low storage footprint

2013-10-10 Thread C. Kirby
You could grab the __dict__ of the instance and use that. import hashlib hash = hashlib.md5() hash.update(str(MyModel.objects.get(pk = 1).__dict__)) hash.digest() On Thursday, October 10, 2013 8:55:27 AM UTC-5, DJ-Tom wrote: > > > Thanks, but *how* can I create a hash from a database object in D

Re: Please suggest me best e-tutorial for Django framework.

2013-10-17 Thread C. Kirby
You can ask any questions about django here, including doubts or questions about whether it is best for you. On Thursday, October 17, 2013 7:25:55 AM UTC-5, ssy wrote: > > Hi rush I am new to usage of this site.Can I directly discuss my doubts > with django users like in stackoverflow ? Please

Re: django difference between - one to one, many to one and many to many

2013-10-28 Thread C. Kirby
Those concepts are actually RDBMS (Database) ideas. You would probably be better off reading up on those. This looks to be a pretty good explanation: http://net.tutsplus.com/tutorials/databases/sql-for-beginners-part-3-database-relationships/ On Monday, October 28, 2013 2:06:20 PM UTC-5, Aamu Pa

Re: presetting a field value with ModelForm

2013-11-12 Thread C. Kirby
You don't show your view, which would be helpful but you process the form with commit = false, then set the org, then save so something like: if adviceform.is_valid(): af = adviceform(commit = false) af.organization = org_id#However you get this from the session af.save() On Tuesd

Re: Django development running on 127.0.0.1:8000 not accessible from same machine

2015-01-16 Thread C. Kirby
Try localhost:8000 On Friday, January 16, 2015 at 8:51:50 AM UTC-6, KamalKanta Majhi wrote: > > I h'v just run the django-admin.py runserver command to setup django dev > server. But dev server is not running at http://127.0.0.1:8000/. Also i > h'v tested at http://0.0.0.0:8000/ and http://192

Re: Django Query Set

2015-02-11 Thread C. Kirby
I'm sure someone can help you, but you need to post some more information to get useful support. Please post the models that you are dealing with, as well as maybe an example of the result you are trying to get. On Wednesday, February 11, 2015 at 8:20:59 AM UTC-6, Ajay M wrote: > > I'm on a Dja

Re: How to filter results using forms in Django/Python (best approach) ?

2015-02-24 Thread C. Kirby
I'm sorry I missed this thread at the beginning. I have an app that basically gives you the ability to build "advanced search" forms in almost the same way as model forms. You can take a look at it at https://github.com/ckirby/django-modelqueryform If you try it or at least look at it, please l

Re: How to filter results using forms in Django/Python (best approach) ?

2015-02-25 Thread C. Kirby
7;ll let you know if I try it. > Just for curiosity, what differentiates your project from django-filters > or django-datafilters ? > > Thanks. > > > *Ronaldo Bahia * > > 2015-02-24 12:57 GMT-03:00 C. Kirby >: > >> I'm sorry I missed this thread at

Re: Trying understand static files.

2015-04-23 Thread C. Kirby
Hi John, It can be a little confusing. Once you are in production and not using runserver, django does not serve the static files. This is what happens: The template expands this snippet with a tag: into (something like) this (Taking into account the STATIC_URL that Lachlan discussed above):

Re: how shall I built online address book using Django

2015-05-22 Thread C. Kirby
I think people here will be happy to help if you have specific questions, but don't really want to do your homework for you. If you need to learn about how django works, and how you can start to think about building this application, I recommend doing the tutorial at: https://docs.djangoproject.

Re: web based application to monitor sybase ase database server

2014-07-09 Thread C. Kirby
A fine plan. Do you have a question regarding django? On Wednesday, July 9, 2014 1:20:48 AM UTC-5, anantha sharma wrote: > > Hi, > > I am planing to build web based application to monitor sybase ase database > server the details are given below. > > > In this moment we are monitoring sybase ASE d

Re: Django ManytoMany Relationships

2014-07-15 Thread C. Kirby
ManyToMany fields actually create a new intermediary join table in the database. If you are using an unmanaged database then you will need to create the intermediary table yourself. See the ManyToMany field reference On

Re: simultaneously submit three forms on the same page

2014-07-29 Thread C. Kirby
They are not getting validated, or validation is failing. Also, it looks like you are using model forms. You can get rid of all the for,.cleaned_data.get lines and just use: if emet_form.is_valid() and des_form.is_valid() and fich_form.is_valid(): emet = emet_form.save() des = des_fo

Re: simultaneously submit three forms on the same page

2014-07-29 Thread C. Kirby
They are not getting validated, or validation is failing? Also, it looks like you are using model forms. You can get rid of all the for,.cleaned_data.get lines and just use: if emet_form.is_valid() and des_form.is_valid() and fich_form.is_valid(): emet = emet_form.save() des = des_

Re: Flatpages

2014-08-15 Thread C. Kirby
Is it only occurring on the flatpages test page or all your pages (or is that the only page)? Remember you need ALLOWED_HOSTS set in production[1] [1]https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts On Friday, August 15, 2014 12:40:43 PM UTC-5, Lee Hinde wrote: > > I added flatp

Re: Flatpages

2014-08-15 Thread C. Kirby
There is a warning about APPEND_SLASH = False in the flatpages documentation: Warning If you set APPEND_SLASH to False, you must remove the slash in the catchall pattern or flatpages without a trailing slash will n

Re: custom query app

2014-11-13 Thread C. Kirby
Hi John, I built an app that basically lets you create an advanced search against a model (or related models). I am using it in production on two different applications. If you use it I would be happy to have feedback. You can find it here: https://github.com/ckirby/django-modelqueryform Kirby

Re: Query friends of an user

2013-12-17 Thread C. Kirby
Why not just Friendship.objects.filter(user__pk = 32, status__in = [Friendship.FRIEND, Friendship.FAVORITE]) That will give you a QuerySet of all the friendships a user has. If you just want the list of friends then extend that query with a values_list like so: Friendship.objects.filter(user__p

Re: Query friends of an user

2013-12-17 Thread C. Kirby
Arthur Pires Ribeiro Silva > Universidade Federal de Uberlândia > (34) 9187-4731 > > > On Tue, Dec 17, 2013 at 2:51 PM, C. Kirby >wrote: > >> Why not just Friendship.objects.filter(user__pk = 32, status__in = >> [Friendship.FRIEND, Friendship.FAVORITE]) That will g

Re: Where exactly in the django source code, the default permissions are created?

2013-12-19 Thread C. Kirby
https://github.com/django/django/blob/master/django/contrib/auth/models.py Take a look at the classes Permission, PermissionMixin and AbstractUser On Thursday, December 19, 2013 1:16:45 PM UTC-6, Fabio Caritas Barrionuevo da Luz wrote: > > Hello guys, I'm trying to understand the inner workings

Re: How to deploy a django project in the web?

2013-12-23 Thread C. Kirby
You can read up about deploying django in the deployment section of the docs: https://docs.djangoproject.com/en/1.6/howto/deployment/ On Friday, December 20, 2013 11:36:58 PM UTC-6, Pablo Diaz wrote: > > I've finished my django project but I'm only running it locally. I want to > put it on a we

Re: I can't figure out the django qeryset for retriving a value from a field by a condition

2013-12-24 Thread C. Kirby
Ali, As a general statement, the django ORM will return an entire instance of a model that you can then read values off of. To print the "total" field for each instance of the model with name "xyz" you would do: for mm in MyModel.objects.filter(mobile_name='xyz'): print mm.total While thin

Re: App_step.readme_id may not be NULL

2014-01-30 Thread C. Kirby
A model formset gives you multiple instances of the modelform, so you need to iterate through them: readme_object = readme_form.save() readme_object.user = request.user readme_object.save() for step_form in step_forms:

Re: render .txt file in django template

2014-01-30 Thread C. Kirby
The template engine doesn't have direct access to the filesystem. You will have to pass the file contents from your view to the template: 1.Load the file in your view 2. Read it into a context variable. 3. Render the context variable in your template On Thursday, January 30, 2014 3:29:29 PM UTC

Re: render .txt file in django template

2014-01-30 Thread C. Kirby
. > > Am I wrong? > > > -- > > > 30 Ocak 2014 Perşembe 23:33:11 UTC+2 tarihinde C. Kirby yazdı: >> >> The template engine doesn't have direct access to the filesystem. You >> will have to pass the file contents from your view to the template: >

Re: Using a paginator with two models in the same view

2014-02-11 Thread C. Kirby
Paginator will work on any list/tuple of objects, not just querysets. If you have a way to transform your 2 querysets into a single list you can use that as your pagination object. Not knowing enough about your architecture I can't really discuss how you might go about the transformation step.

Re: how to make https work in django REST framework

2014-02-13 Thread C. Kirby
Zhenwu, You only mentioned it in passing in the last post, but did you say you are running django in production via the manage.py runserver command? You _really_ shouldn't use runserver in production. You should be using a webserver (I guess apache in your case) and wsgi to serve up django.

Re: Django Tutorial 5 - First Tests

2014-02-13 Thread C. Kirby
The names of both those tests imply that your setup will fail them. (I didn't look at the test internals, so I am assuming the test names do what they say) 1. "test_index_view_with_a_future_poll" - you have future polls 2. "test_index_view_with_no_polls" - you have polls in the database On Thu

Re: how to make https work in django REST framework

2014-02-13 Thread C. Kirby
; > /zhenwu > > On Thursday, February 13, 2014 10:18:03 AM UTC-8, C. Kirby wrote: >> >> Zhenwu, >> >> You only mentioned it in passing in the last post, but did you say you >> are running django in production via the manage.py runserver command? You >> _reall

Re: List of default Django tags that are "mid-block" like else

2014-02-13 Thread C. Kirby
Not sure if this is what you mean, but: for --empty --forloop.counter/first/last/etc -- 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...@g

Re: Not pure Django. Chrome versus Safari discrepancy

2014-02-14 Thread C. Kirby
You can try using the @never_cache decorator on the view that captures the page view from django.views.decorators.cache import never_cache That should instruct safari not to cache the page. Sometimes that won't work due to how browsers respect the headers. You can also try the decorator: from

Re: Django + PostgresSQL. I'm a newbie.

2014-02-14 Thread C. Kirby
The topics you are asking about are all over Google. Please do a little work before asking here. No one want to do your research for you, or re-type what is already available to you. If you have searched google and don't understand a reference then you should ask specifically about what you don'

Re: Form that includes one2many relation

2014-02-17 Thread C. Kirby
I would suggest reading up on inline formsets: https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#inline-formsets You can also look at this stackoverflow question regarding how to use them to create instances, as the docs only talk about editing (and expect you to map those idea to c

Re: Newbie Question - Where to store application constants?

2014-02-17 Thread C. Kirby
I would suggest that your example, the price of gold, isn't a constant. If you want to treat it as such then I agree with the above answers. However, you could also look around for APIs that publish commodities values and actually pull the real values in real (or semi real) time. -- You receiv

Re: Anybody out there installed and run DjangoBB?

2014-02-20 Thread C. Kirby
In django the management command syncdb creates the tables you need to use. If you look again at the docs you linked to under "Download and setup basic project:" there is a line ./manage.py syncdb --all That is what sets up the necessary database structures. On Thursday, February 20, 2014 5:

Re: Anybody out there installed and run DjangoBB?

2014-02-20 Thread C. Kirby
, February 20, 2014 10:53:22 AM UTC-6, C. Kirby wrote: > > In django the management command syncdb creates the tables you need to > use. If you look again at the docs you linked to under "Download and setup > basic project:" there is a line > > ./manage.py syncdb --all

Re: Controlling admin ManyToManyField widget with keyboard

2014-02-26 Thread C. Kirby
While holding Ctrl (Command on a Mac), click the spacebar on the relations you want to select. Spacebar handles the toggle action, ctrl(command) keeps you in multi-select mode On Wednesday, February 26, 2014 6:12:09 AM UTC-6, cool-RR wrote: > > Hi, > > How do I control the admin ManyToManyFiel

Re: Controlling admin ManyToManyField widget with keyboard

2014-02-26 Thread C. Kirby
the toggle. (Windows 7 Chrome.) > > > On Wed, Feb 26, 2014 at 6:43 PM, C. Kirby >wrote: > >> While holding Ctrl (Command on a Mac), click the spacebar on the >> relations you want to select. >> Spacebar handles the toggle action, ctrl(command) keeps you in >>

Re: Accessing a python function from a blog post stored in the db?

2014-02-26 Thread C. Kirby
It sounds like your implementation is a little skewed. If a blog post is made of multiple resources (summary, body, multiple image collections, etc.) You should probably have a model or models with the appropriate fields/relationships. That way your template can house all of the template langua

Re: Controlling admin ManyToManyField widget with keyboard

2014-02-26 Thread C. Kirby
behavior of the select box with > the toggle action? Because I'm having trouble with the toggle action, not > the select box. > > > On Wed, Feb 26, 2014 at 8:08 PM, C. Kirby >wrote: > >> It appears that multi-select form widgets cannot be keyboard controlled >>

Re: Controlling admin ManyToManyField widget with keyboard

2014-02-26 Thread C. Kirby
I have no issues with the selecting part. I have > an issue with the moving part. > > > On Wed, Feb 26, 2014 at 11:58 PM, C. Kirby > > wrote: > >> I don't think I am. A ManyToMany relation in admin is represented as a >> select-multiple html widget - is th

Re: Accessing a python function from a blog post stored in the db?

2014-02-26 Thread C. Kirby
2014 4:18:14 PM UTC-6, Dennis Marwood wrote: > > Won't this force my blog posts to all be the same. i.e. Text then a image > scroller? > How would I handle the case where a blog post was Text, image scroller, > text, image scroller? > > On Wednesday, 26 February 2014

Re: Javascript and sessions

2014-02-27 Thread C. Kirby
It sounds like you are trying to implement a wizard. If you are, Django has one built in: https://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/ On Wednesday, February 26, 2014 9:11:38 PM UTC-6, Luke Baker wrote: > > Hey there, > > (Forgive my ignorance) > > My web application

Re: How to host multiple instances of the same app with Windows Apache & WSGI?

2014-02-27 Thread C. Kirby
You can get a wildcard cert that captures all of *.site.com|org|net|etc On Thursday, February 27, 2014 9:18:57 AM UTC-6, DJ-Tom wrote: > > > > Am Dienstag, 25. Februar 2014 13:50:11 UTC+1 schrieb Tom Evans: >> >> >> Use different STATIC_ROOT for each site, eg /static2013 and /static2014. >> >> Bu

Re: Accessing a python function from a blog post stored in the db?

2014-02-28 Thread C. Kirby
lking about something like > https://docs.djangoproject.com/en/dev/intro/tutorial02/#adding-related-objectswhere > I could just insert a slider type of entry and then a text entry and > so on. Is that it? > > On Wednesday, 26 February 2014 14:49:55 UTC-8, C. Kirby wrote: >> &

Re: ".count" in template does not work for "raw" queries

2014-03-10 Thread C. Kirby
The reason .count() doesn't work there is because count() runs a select count(*) query, but that can't run correctly with .raw(). The way to get the count is to cast the Resulting RawQuerySet to a list and run len() on it. This will result in the RawQuerySet getting evaluated however. Alternat

Re: Documentation of modules

2014-03-11 Thread C. Kirby
There is a link to the module index on the django project site. Direct link: https://docs.djangoproject.com/en/1.6/py-modindex/ On Tuesday, March 11, 2014 11:33:24 AM UTC-5, Christian Waterkeyn wrote: > > Hello, > > I am looking for a reference documentation of the django modules. > For example dj

Re: Timeseries Data Collection as a Reusable App

2014-03-11 Thread C. Kirby
Like number 2 but a little more amenable to searching https://github.com/bradjasper/django-jsonfield On Tuesday, March 11, 2014 10:42:24 AM UTC-5, RLange wrote: > > I'm currently working on an app for browsing and visualizing time-series > data. Each point of time-series data may be a mix of Str

Re: Is there a better way to do this?

2014-03-17 Thread C. Kirby
I would do it with a recursive ForeignKey class Employee(models.Model): employee = models.OneToOneField(User) supervisor = models.ForeignKey('self', blank=True, null=True) This keeps the information in one table and pretty clean looking. Allows all employees to have a supervisor, but they

Re: Simple User login not working.

2014-03-20 Thread C. Kirby
If you are using stock User accounts why are you writing a login view? Just use django.contrib.auth.views.login You can pass it your own template in the url definition url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}, name='login' ) On Wednesday, March 1

Re: Custom Login page in Django

2014-03-20 Thread C. Kirby
Are you building your own authentication system as a learning opportunity or to actually use in a production system? If it is for a production system then...don't. There is quite a bit of code in django Users to handle passwords and keep passwords safe and authentication secure. If you want to

Re: How allow public query & download of info from my db

2014-03-21 Thread C. Kirby
I've actually built a small app that generates a form allowing users to do a Meta Query on models django-modelqueryform. I am in the process of a full rewrite of it to make it a lot more customizable, but the initial version works with fields that have choices set or with fields that are a numer

Re: ManytoManyField (through) not showing up !

2014-03-28 Thread C. Kirby
Did you add this field after you had already run syncdb? If so, you won't see it running syncdb again, that command only adds new models, it does not pick up modifications to models. You have a couple of options. 1) If you are in development, you can just drop your existing database and use sy

Re: Filtersets

2014-04-01 Thread C. Kirby
pdate, or just take ideas from it, here it is: https://github.com/ckirby/django-modelqueryform ~C. Kirby On Tuesday, April 1, 2014 6:16:05 AM UTC-5, Conrad Rowlands wrote: > > Hi All. I wonder if anyone can point me in the right direction. I am > building a web api using django and

Re: Moving from 1.2 to 1.6

2014-04-09 Thread C. Kirby
Hi John, You are mostly there, but you are missing necessary headers on the ajax request. It isn't that much code. Just follow the couple of paragraphs of doc and examples here: https://docs.djangoproject.com/en/1.6/ref/contrib/csrf/#ajax Kirby On Wednesday, April 9, 2014 12:47:12 PM UTC-5, Joh

Re: Moving from 1.2 to 1.6

2014-04-09 Thread C. Kirby
ers"? > > The code that includes the 'headers' in the doc's is exactly the part I > don't understand. Where does that code go and how does it relate to my > code. > > Johnf > > On 04/09/2014 10:51 AM, C. Kirby wrote: > > Hi John, >

Re: (1364, "Field 'id' doesn't have a default value") - mysql issue?

2014-04-10 Thread C. Kirby
When you started using mysql did you do a fresh manage.py syndb or sqlite dump > mysql import? If the latter than you almost certainly have incorrect create statements. Drop the mysql db and create it using manage.py syncdb. If you need to import the data from the existing sqlite db I suggest

  1   2   >