Re: django.db.migrations.graph.NodeNotFoundError:

2016-12-23 Thread Collin Anderson
Hi, Do you want to copy and paste your error message? (I assume it's similar, but it might have some better clues.) My guess you have a migration that's referencing a migration file that was deleted or something. Collin On Thursday, December 22, 2016 at 7:33:48 PM UTC-6, skerdi wrote: > > I

Re: ProgrammingError: relation "auth_user" does not exist.

2016-12-23 Thread Collin Anderson
Hi, Have you tried running ./manage.py makemigrations and then ./manage.py migrate? That's needed to actually create the table. Collin On Thursday, December 22, 2016 at 12:25:58 PM UTC-6, Biplab Gautam wrote: > > I tried to set up custom user model by inheriting from AbstractBaseUser as >

Re: existing database connectivity

2016-12-23 Thread Collin Anderson
Hi, You could try re-installing psycopg2 to see if that fixes it. Collin On Thursday, December 22, 2016 at 1:55:53 AM UTC-6, Rasika wrote: > > > I am followed the steps as I am getting in tutorials > when I run the command : > python manage.py migrate > this is giving me following error > >

Re: MultiWidget not rendering

2016-12-23 Thread Collin Anderson
Hi, I think you want something like this. class Fourteen(forms.Form): mywidget = forms.DateField(widget=DateSelectorWidget()) Collin On Monday, December 19, 2016 at 1:13:17 PM UTC-6, Farhan Khan wrote: > > Unfortunately that does not display. > In the template I had it as {{ fourteen }}

Re: return values from static files to django admin

2015-11-05 Thread Collin Anderson
Hi, You may need to also calculate the possible options in python. Some hacky code that might help: class AdminRoutingInlineForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(AdminRoutingInlineForm, self).__init__(*args, **kwargs) field1 =

Re: jquery and django template

2015-11-05 Thread Collin Anderson
Hi, Are you trying to show the user what filters are being applied to the data, or are you trying to filter the data based on a user selection? Collin On Monday, November 2, 2015 at 2:51:36 AM UTC+1, varun naganathan wrote: > > I basically have the database entries in the namespace of my

Re: Django bootstrap3_datetime widget in admin site doesn't pass form data

2015-11-05 Thread Collin Anderson
Hi Ilia, The default admin widget looks for id_0 and id_1, but if you use a custom widget, that is responsible for looking for its own value (like publish_time_1). You could check out DateTimePicker's source code to see what it's actually doing. Thanks, Collin On Sunday, November 1, 2015 at

Re: mssql databASE CONNECTION to Django

2015-11-05 Thread Collin Anderson
Hello, I'd recommend using django 1.7 until mssql gets compatible with django 1.8. Thanks, Collin On Friday, October 30, 2015 at 3:31:35 PM UTC+1, Sid wrote: > > sorry tim I know I am asking a dumb question...can you please tell me what > is the best way to make it work please if

Re: Locking / serializing access to one element in database

2015-11-05 Thread Collin Anderson
(jahr=Jahr, monat=Monat).update(value=new_value ) Collin On Wednesday, October 28, 2015 at 8:50:09 PM UTC+1, Carsten Fuchs wrote: > > Hi Collin, hi all, > > Am 27.10.2015 um 19:56 schrieb Collin Anderson: > > Yes, an exception will be raised. > > Thinking further about this,

Re: [django_tables2] Expected table or queryset, not 'str'.

2015-11-05 Thread Collin Anderson
Hi, Do you to post your traceback if you're still getting this error? Thanks, Collin On Wednesday, October 28, 2015 at 2:17:28 PM UTC+1, Leutrim Osmani wrote: > > Can you please tell me how did you fixed this error ? > > On Monday, April 29, 2013 at 9:21:29 AM UTC+2, binith a k wrote: >> >> You

Re: Standalone Project using django ORM

2015-11-05 Thread Collin Anderson
Hi, It looks like you stack trace is somehow getting cut off. My guess is it's trying to import something that either doesn't exist or has a syntax error. Collin On Wednesday, October 28, 2015 at 12:39:06 AM UTC+1, ADEWALE ADISA wrote: > > The screen shot is attached. There is no error

Re: Safe tag is working differently for different view.

2015-11-05 Thread Collin Anderson
Hello, Are you sure they're using the same template? (If you change something does it actually affect both views?) Is one of the views using mark_safe? Collin On Tuesday, October 27, 2015 at 9:29:02 PM UTC+1, sonu kumar wrote: > > I am having two views both are extending from same base.html

Re: Django Models Joining and Normalising

2015-10-28 Thread Collin Anderson
Hello, I'd personally keep it all in one model for as long as possible. It will really simplify queries and it should make your code a lot cleaner. Wait til you have some actual performance problems before splitting the models up. Collin On Wednesday, October 14, 2015 at 12:11:55 PM UTC-4,

Re: Flakey tests and django.db.utils.InterfaceError: connection already closed

2015-10-28 Thread Collin Anderson
Hello, Here are some questions that might help debugging this: Do other tests that use the database run ok? If you run _only_ this test, is it still a problem? Are you using threads at all? Is there an exception that's being silenced somewhere else? Collin On Tuesday, October 27, 2015 at

Re: Polymorphic class and geomodels?

2015-10-28 Thread Collin Anderson
Hello, Are you trying to combine multiple models into one, like this? class PolyModel(pdmpunto, pdmtransetto, pdmarea): pass You could also try asking on the geodjango list: http://groups.google.com/group/geodjango Collin On Monday, October 26, 2015 at 7:18:24 AM UTC-4, Luca Moiana

Re: Adding gif file to existing project

2015-10-27 Thread Collin Anderson
Hi Gary, This sounds like an issue with Ninja-IDE. You could try asking on their mailing list: http://groups.google.com/group/ninja-ide/topics Thanks, Collin On Sunday, October 25, 2015 at 10:51:13 PM UTC-4, Gary Roach wrote: > > Django 1.8 > Python 3.4 > Debian 8 (jessie) with kde desktop

Re: Locking / serializing access to one element in database

2015-10-27 Thread Collin Anderson
Yes, an exception will be raised. As an example, Django uses force_insert when creating sessions: https://github.com/django/django/blob/32ef48aa562e6aaee9983f5d0f1c60f02fd555fb/django/contrib/sessions/backends/db.py#L86 On Saturday, October 24, 2015 at 2:36:15 PM UTC-4, Joakim Hove wrote: > >

Re: makemigrations and language_code

2015-10-27 Thread Collin Anderson
Hi, is libapp using ugettext_lazy? That's what the admin app is using. Collin On Thursday, October 22, 2015 at 2:53:53 AM UTC-4, Hugo Osvaldo Barrera wrote: > > > On Tue, Oct 20, 2015, at 10:39, Aron Podrigal wrote: > > Simply run > > ./manage.py makemigrations myapp > > > That will

Re: Dynamic Formset Radiobutton Issue

2015-10-24 Thread Collin Anderson
Hello, That formset jQuery script it quite ancient (2009). You could try using jQuery 1.2.6 and see if it works correctly with that version. Collin On Friday, October 23, 2015 at 8:54:49 AM UTC-4, Jur Remeijn wrote: > > So I'm using a dynamic formset within django: >

Re: Locking / serializing access to one element in database

2015-10-24 Thread Collin Anderson
Hi Carsten, Something that might help: depending on how your unique keys are set up, if the thread thinks that the object is new, it could try using .save(force_insert=True). That way it won't overwrite a different object with the same PK. Thanks, Collin On Thursday, October 22, 2015 at

Re: Complex form in modelform

2015-10-24 Thread Collin Anderson
Hi, For starters, here's an example of a formset for multiple images: http://stackoverflow.com/questions/32889199/how-to-upload-multiple-images-using-modelformset-django Collin On Monday, October 19, 2015 at 4:56:18 PM UTC-4, Arnab Banerji wrote: > > Hi - I am trying to create a form from a

Re: Django 1.7.6 TypeError when applying migration with ForeignKey with default

2015-03-12 Thread Collin Anderson
Hi, Maybe g() should return the id instead of the instance? That does seem a bit odd that it wouldn't accept an A() instance as the default. Collin On Wednesday, March 11, 2015 at 7:43:35 AM UTC-4, Krzysztof Ciebiera wrote: > > I have created a model A: > > def g(): > return

Re: Testing Django: testing template at different time

2015-03-12 Thread Collin Anderson
Hi, You could try using freezegun to run the test as if it were a certain time of day. https://pypi.python.org/pypi/freezegun Or, you could say something like: if 9 <= datetime.datetime.now().hour < 17: self.assertContains(response, "It's working time!") else:

Re: Different user profile associated to a each user group

2015-03-12 Thread Collin Anderson
Hi, I'd personally recommend re-using the same model and having a "type" field for whether it's corporate or private. Otherwise, you'd need to do something like: class Corporate(models.Model): user = models.OneToOneField(User) class Private(models.Model): user =

Re: Django OperationalError

2015-03-12 Thread Collin Anderson
r Pilipovic <iam...@gmail.com > > wrote: > >> Heh, lol, Ok tax Collin I will do that. I was thinking that i need to >> delete mine migration from the terminal, but I will try that, tnx >> 10.03.2015. 18.01, "Collin Anderson" <cmawe...@gmail.com > &g

Re: [django 1.7.6] system error: 10054 An existing connection was forcibly closed by the remote host

2015-03-12 Thread Collin Anderson
Hi, Interesting. If you switch back to previous version of django you don't have that problem? Is it a slow query? Are you using MySQL or MSSQL? Collin On Tuesday, March 10, 2015 at 8:55:44 PM UTC-4, Weifeng Pan wrote: > > Hi, > > > I upgrade to latest version of django. Every time I

Re: Filtering a QuerySet by the result of user.has_perm

2015-03-12 Thread Collin Anderson
Hi Adam, It's pretty inefficient, but you can do: MyModel.objects.filter(pk__in=[obj.pk for obj in MyModel.objects.all() if user.has_perm('read', obj)]) But, actually, I think you want to use get_objects_for_user():

Re: Getting 500 error on ASO

2015-03-11 Thread Collin Anderson
Hi Michael, Are you checking your Apache log? Also, be sure to set up ADMINS so you can get emails for any django errors. I believe runfastcgi is gone from django now, along with all of django.core.servers.fastcgi. At work we used to host on ASO too. We now use Linode. Digital Ocean is good

Re: Django server serving cached template pages

2015-03-10 Thread Collin Anderson
Hi, Yes, apparently many people get tripped up on this step. Is this django1.7? create a blank "blank_site.html". <- I assume you mean create a blank base_site.html? I assume this is with manage.py runserver? (If it's apache/uwsgi/gunicorn, you need to reload the program when changing the

Re: my mysite/templates/admin/base_site.html is ignored (tutorial unclear?)

2015-03-10 Thread Collin Anderson
Hi, To be clear, you should have this setting: TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')] and in your mysite/templates/admin/base_site.html you should have something like: {% block branding %} Polls Administration {% endblock %} Does that all look right? Thanks, Collin On

Re: Accessing Django models using DJANGO_SETTINGS_MODULE

2015-03-10 Thread Collin Anderson
Hi, Hmm... maybe try ChatRoom.objects.all().all() ? :) If you run this, you can see if it's actually running sql or not: import logging; logging.basicConfig(level=logging.DEBUG) Are you sure you're using the same database? :) Collin On Sunday, March 8, 2015 at 8:41:30 AM UTC-4, Dheerendra

Re: Existing database - new project

2015-03-10 Thread Collin Anderson
Hi, inspectdb makes step #1 much easier. If you're not planning on removing some of the columns or restructuring things, I'd recommend #1. Collin On Saturday, March 7, 2015 at 9:31:24 AM UTC-5, Derek wrote: > > I have taken route 1 before; its a bit more messy because you may have to >

Re: Django OperationalError

2015-03-10 Thread Collin Anderson
e sqlflush, syncdb, > migrate <http://ur1.ca/jv371>. I have notice that there was no migration > to apply at the end, and the error is still there. > Is there something else I can do, or how can I approach this differently. > Best > Petar > > On Fri, Mar 6, 2015 at

Re: Django Admin Page

2015-03-06 Thread Collin Anderson
Hi, That's odd. Maybe try updating django? It looks like you're using 1.8 pre-alpha from 3 months ago. Collin On Friday, February 20, 2015 at 1:40:03 AM UTC-5, Tim Co wrote: > > Hello, > > We are trying to run a local development server for our django python app. > We are able to connect to

Re: how pass get parameter django bootstrap pagination

2015-03-06 Thread Collin Anderson
Hi, If you have the request context processor installed, you can do this: {% bootstrap_paginate object_list range=request.GET.range %} Collin On Thursday, March 5, 2015 at 4:35:33 AM UTC-5, SHINTO PETER wrote: > > {% load bootstrap_pagination %} > {% bootstrap_paginate object_list range=10

Re: getting tuples from http request.GET

2015-03-06 Thread Collin Anderson
Hi, Normally query arguments are separated by &. If you're able to send the data like this: https://mydesktop.com/validator?hostname1=host1.example.com=ca=2.2.2.2=host2.example.com=wa=3.3.3.3 Then you could do something like: data = [] i = 0 while True: i += 1 try:

Re: Rolling back to practice on old bugs

2015-03-06 Thread Collin Anderson
Hi, I always type: PYTHONPATH=.. ./runtests.py Collin On Wednesday, March 4, 2015 at 4:30:54 PM UTC-5, Javis Sullivan wrote: > > I am following this tutorial here > "Writing your > first Django patch" and while it directs me to

Re: Populating Django app db with JSON data

2015-03-06 Thread Collin Anderson
Hi Sandeep, A snapshot (or at least a diff from the previous one) is stored when you run makemigrations. Collin On Wednesday, March 4, 2015 at 2:15:41 PM UTC-5, Murthy Sandeep wrote: > > Hi > > thanks for the info. > > The docs also say that RunPython runs “custom Python code > in a

Re: Django(1.7) admin - separate user-profile section

2015-03-06 Thread Collin Anderson
Hi, If you just add a custom __str__ (or __unicode__ on py2) it might do what you want. def __str__(self): return str(user) Otherwise, in UserTokenAdmin, set list_display = ['user'] Collin On Wednesday, March 4, 2015 at 2:15:32 PM UTC-5, Flemming Hansen wrote: > > Hi all, > > I need to

Re: Django 1.7 tutorial part 4, url

2015-03-06 Thread Collin Anderson
Hi, That seems strange. The error says that there's no question with id=1. Are you sure there's a question with id=1? The ending slash seems important to me. I don't know why it would work without it. Collin On Wednesday, March 4, 2015 at 2:15:32 PM UTC-5, Daniel Altschuler wrote: > > I ran

Re: Fatal Error in initializing sys standard streams

2015-03-06 Thread Collin Anderson
Hi, That doesn't look good :) Maybe try reinstalling python. Collin On Wednesday, March 4, 2015 at 11:11:12 AM UTC-5, sriraag paawan wrote: > > > Hello Guys, > > I am new to Django.. i am using Django 1.7.4 and Python 3.4 > > I was about to complete Django tutorial part-5 about tests but a

Re: Can't make ManyToMany form fields hidden

2015-03-06 Thread Collin Anderson
https://code.djangoproject.com/ticket/24453 On Wednesday, March 4, 2015 at 12:40:40 AM UTC-5, Eric Abrahamsen wrote: > > Hi, > > I'm making some heavily customized model formsets, to encourage my users > to input data. Mostly that involves cutting down the number of huge > drop-down menus they

Re: Django OperationalError

2015-03-06 Thread Collin Anderson
Hi, The problem is that django_session doesn't exist in your database. Either it was never created or it was created and then later deleted. Does running manage.py migrate re-create it? Collin On Monday, March 2, 2015 at 11:36:51 PM UTC-5, Petar Pilipovic wrote: > > Hello James, sorry for not

Re: django Search page

2015-03-06 Thread Collin Anderson
Hi, You'll need to use javascript for that. Collin On Monday, March 2, 2015 at 2:27:35 AM UTC-5, Sabeen Sha wrote: > > which is the best way to implement the following:: > i will be having a text box and a Add button > > Along with a table below it containing headers class >

Re: [1.8] MultiHost with template dir per Host

2015-03-06 Thread Collin Anderson
Hi, You might need to modify the template engine directly. Collin On Sunday, March 1, 2015 at 6:31:57 PM UTC-5, Neyoui wrote: > > Hi, > > I had create a middleware, that is able to change the template directory > per host on the fly. > But it stopped working since I upgraed to Django 1.8 and I

Re: How to save user to foreignKey field for new records in modelFormset case?

2015-03-06 Thread Collin Anderson
Hi, The form doesn't have access to the current user. I'd attach it using the view. Thanks, Collin On Wednesday, February 25, 2015 at 3:53:40 AM UTC-5, Mike wrote: > > Hi, > I have created modelFormset using SchoolHistory model and SchoolForm form. > > "SchoolFormSet =

Re: JSON Response

2015-02-20 Thread Collin Anderson
Hi, It sounds like you click "submit" and then get a page showing the raw json? That sounds like it could be a bug in your code. Either the event handler is not connected, or there's an error. You could try checking "Preserve Log" in the developer console. Collin On Thursday, February 19,

Re: matplotlib pyplot stop working

2015-02-20 Thread Collin Anderson
Hi, The freezing could be a memory leak. http://stackoverflow.com/questions/7125710/matplotlib-errors-result-in-a-memory-leak-how-can-i-free-up-that-memory Could the image be cached by the browser, does shift+F5 refresh it? The easiest way to fix it would be to use a different url/filename

Re: How to host django application in redhat using virtual environment?

2015-02-20 Thread Collin Anderson
Hi, Here's a tutorial. https://devops.profitbricks.com/tutorials/deploy-django-with-virtualenv-on-centos-7/ Collin On Thursday, February 19, 2015 at 8:29:47 AM UTC-5, SHINTO PETER wrote: > > How to host django application in redhat using virtual environment? > -- You received this message

Re: Seems like a geodjango bug with multiple databases

2015-02-19 Thread Collin Anderson
Hi, Interesting. What version of django is this? Here's something to try: Room.objects.using('another').select_related('hotel').get(pk=10) It could very well be an issue with GeoManager / GeoQuerySet. You also could ask on the geodjango list to see if anyone else has run into that.

Re: Trouble changing from sqlite3 to postgres

2015-02-19 Thread Collin Anderson
Hi, It seems strange that it would be trying to convert a "date" column to an integer. Since you're creating a new database from scratch, you could try deleting your migrations and generating them from scratch to see if that helps. Otherwise, what does your "app_1.0003_auto_20141126_2333"

Re: Form Wizard: how to send instance_dict based on the request

2015-02-19 Thread Collin Anderson
Hi, You could instead just override get_form_instance(step). That way you'll have access to self.request. Collin On Tuesday, February 17, 2015 at 8:26:30 PM UTC-5, Karim Gorjux wrote: > > Hello mates! > > I have some problems to understand how to set the view for > the

Re: Can migrated apps depend on unmigrated apps?

2015-02-19 Thread Collin Anderson
Hi Carsten, I in my experience, it _sometimes_ works to have migrated apps depend on unmigrated apps. If you haven't yet, you could try generating migrations for the unmigrated app, and reference them using MIGRATION_MODULES. Collin On Tuesday, February 17, 2015 at 5:00:26 PM UTC-5, Carsten

Re: Handling FormSet client side with javascript

2015-02-19 Thread Collin Anderson
Hi, Sorry for the late reply. Does simply using {{ formset.media }} work? Collin On Friday, February 13, 2015 at 11:02:31 AM UTC-5, aRkadeFR wrote: > > Hello everyone, > > I'm using FormSet in order to add multiple object at once on > a view. To have a more user friendly approach, I created a

Re: JsonResponse and Ajax function.

2015-02-19 Thread Collin Anderson
Hi, Sorry for the late reply. Do you need to use JSON.parse(response).status? Collin On Tuesday, February 10, 2015 at 8:33:58 AM UTC-5, elcaiaimar wrote: > > Hello! > > I've written a code to delete db registers and I want to call an ajax > function when the delete is done. > At the moment,

Re: Django: get profiles having auth.Group as foreign key

2015-02-19 Thread Collin Anderson
Hi, Sorry for the late reply. Do you just want something like this? {% for dashboard in group.dashboard_set.all %} {{ dashboard.d_name }} etc {% endfor %} Collin On Tuesday, February 10, 2015 at 12:41:15 AM UTC-5, itsj...@gmail.com wrote: > > I have an model which uses auth.models Group as

Re: Custom model field and custom widget

2015-02-19 Thread Collin Anderson
Hi, Sorry for the late reply. Check out editable=False if you haven't. Collin On Friday, January 30, 2015 at 9:03:41 AM UTC-5, Thomas Weholt wrote: > > Hi, > > I need to create a custom django model field, a varchar(10) field which > has a calculated value set on save on the model using it and

Re: How to detect (daily) User Login when using cookies?

2015-01-30 Thread Collin Anderson
> On Tuesday, January 27, 2015 at 9:00:15 PM UTC+1, Collin Anderson wrote: >> >> Hi, >> >> Would it make sense to simply keep a record of when the last time you've >> seen the user is? >> >> Collin >> >> On Friday, January 23, 2015 at 4:43

Re: Reduce start up time for manage.py

2015-01-30 Thread Collin Anderson
Hi, Many people would recommend against this, but if you can put the imports for your heavy 3rd party libraries inside functions and methods, that allow them to be loaded only if needed. I would also recommend in general to simply have fewer libraries and apps (easier said than done :) Also,

Re: Best practice to render the view based on the user

2015-01-30 Thread Collin Anderson
Hi, Not sure about whether it's a good idea or not. If statements might also be good enough. Be careful with security, but in theory something like this should work: method_name = 'person' + person.type method = getattr(self, method_name) output = method() Collin On Wednesday, January 28,

Re: django / tastypie - how to exclude a resource attribute from obj_create, but keep it for listing

2015-01-30 Thread Collin Anderson
Hi Eugene, Would it work to something like this in your obj_create? bundle.data.pop('blueprint', None) Collin On Tuesday, January 27, 2015 at 11:01:56 AM UTC-5, Eugene Goldberg wrote: > > I have the following tastypie resource: > > class WorkloadResource(ModelResource): > # blueprints =

Re: path to django from jython

2015-01-30 Thread Collin Anderson
Hi, I think you to make sure django is on your PYTHONPATH / sys.path Collin On Tuesday, January 27, 2015 at 10:51:13 AM UTC-5, Josh Stratton wrote: > > Okay, stupid question, but how do I source django when jusing jython? I > have django installed using pip and jython installed locally. I've

Re: Create Django token-based Authentication

2015-01-30 Thread Collin Anderson
Hi, What happens when you try? :) Your setup is pretty complicated, but I don't know if REST framework will help much. Collin On Tuesday, January 27, 2015 at 12:00:59 AM UTC-5, Hossein Rashnoo wrote: > > I have my authentication service on django. I want to role as web-service > to gave

Re: Putting picture thumbnails within admin page

2015-01-29 Thread Collin Anderson
Hi, Any luck? Try looking at the Network tab of the developer console to see what the errors are. Collin On Monday, January 26, 2015 at 7:31:54 PM UTC-5, bradford li wrote: > > > I am trying to put thumbnail pictures of my photos within my admin page. I > am currently running into the issue

Re: Wanted: Best practices for setting "_" (to ugettext/ugettext_lazy)

2015-01-27 Thread Collin Anderson
Hi, Why reset it at the end of your module? Why not use ugettext_lazy everywhere? from django.utils.translation import ugettext_lazy as _ (Disclaimer: I've never used translations before :) Collin On Saturday, January 24, 2015 at 3:46:31 AM UTC-5, Torsten Bronger wrote: > > Hallöchen! > >

Re: gis: geo_db_type error in run_checks() in 1.7 (not 1.6)

2015-01-27 Thread Collin Anderson
Hi, You could also try the geodjango mailing list if nothing else. http://groups.google.com/group/geodjango Collin On Sunday, January 25, 2015 at 6:04:57 PM UTC-5, dne...@destinati.com wrote: > > Hi, > > Wanted to throw this out there, not sure truly if it is my fault or a bug. > > Just

Re: Forms test run on development database instead of test database

2015-01-27 Thread Collin Anderson
Hi, I just tried out your project. Looking at the stacktrace, the test module is importing forms (before the test starts). The forms module is running a query on startup for choices. https://github.com/merwan/django-choicefield/blob/master/myapp/forms.py Don't do queries on startup. :)

Re: sending email

2015-01-27 Thread Collin Anderson
below. now when i click on authorized Leave button > an email should be send to the test user. please point me to right > direction. > [image: Inline image 1] > > [image: Inline image 2] > > Cheers, > > On Fri, Jan 23, 2015 at 1:18 PM, Collin Anderson <cmawe...@gmail.c

Re: programming error in group by clause

2015-01-27 Thread Collin Anderson
Hi, What database are you using? If you can reproduce this in a simple project, feel free to open a ticket about it. Thanks, Collin On Sunday, January 25, 2015 at 12:51:31 AM UTC-5, satya wrote: > > Need some help on fixing the following error. I recently moved to 1.8alpha > version from an

Re: Django: How to customize the admin form for specific model

2015-01-27 Thread Collin Anderson
Hi, You could have the images be inline: class CommentImageInline(models.TabularInline): model = CommentImage extra = 0 class CommentAdmin(models.ModelAdmin): inlines = [CommentImageInline] Though, you may need to use a custom widget to get the actual images to show up. Collin

Re: unable to open project

2015-01-27 Thread Collin Anderson
Hi, What happens when you try? Collin On Saturday, January 24, 2015 at 3:59:55 AM UTC-5, abhishek kumar wrote: > > I am unable to open my project again. As i am using virtual enviroment in > windows. > -- You received this message because you are subscribed to the Google Groups "Django

Re: How do you link your Django project to a domain

2015-01-27 Thread Collin Anderson
I use namecheap, but yes, domains.google.com has a nice user interface. On Saturday, January 24, 2015 at 8:22:33 AM UTC-5, patrickbeeson wrote: > > You might also check out Google's recently launched domain registrar at > domains.google.com. > > On Saturday, January 24, 2015 at 2:01:43 AM UTC-5,

Re: login_required in urlpatterns TypeError 'tuple' object is not callable

2015-01-27 Thread Collin Anderson
Hi, Something like this might work: from home.urls import urlpatterns as home_urls url('^home/', include(list(login_required(x) for x in home_urls))) Collin On Friday, January 23, 2015 at 7:09:30 PM UTC-5, Vijay Khemlani wrote: > > I may be mistaken, but I don't think you can decorate an

Re: Dictionary in admin interface

2015-01-27 Thread Collin Anderson
Hi, The admin doesn't really have a way to do this. You could edit KeyValuePair inline on Dictionary. Why not have a "Params" model that has a ForeignKey to Request? Collin On Friday, January 23, 2015 at 1:32:21 PM UTC-5, Sven Mäurer wrote: > > I want to manage a dictionary inline over the

Re: How to detect (daily) User Login when using cookies?

2015-01-27 Thread Collin Anderson
Hi, Would it make sense to simply keep a record of when the last time you've seen the user is? Collin On Friday, January 23, 2015 at 4:43:41 AM UTC-5, Tobias Dacoir wrote: > > I'm using django-allauth and I receive a signal when a user logs in. Now I > want to store each day the user logs in.

Re: Unable to save object with images while using FormWizard in Django 1.7 and Python 3.4

2015-01-27 Thread Collin Anderson
Hi, Use items() instead of iteritems(). Collin On Thursday, January 22, 2015 at 11:31:23 AM UTC-5, Frankline wrote: > > ​Hi all​, > I am having a problem saving a Django form using the *FormWizard > * > while using

Re: sending email

2015-01-22 Thread Collin Anderson
: > > Thanks, > I am trying to send email to the users that their email address is stored > in the database on the auth_user table. can someone please point me to the > right direction. > > Cheers, > > > On Thu, Jan 22, 2015 at 3:03 PM, Collin Anderson <cmawe

Re: makemigrations complains about a ForeignKey not being Unique

2015-01-22 Thread Collin Anderson
Hi, I think you might want to use a common abstract base class. You want a completely separate database table for the two models, right? Collin On Wednesday, January 21, 2015 at 10:17:08 PM UTC-5, Samuel Jean wrote: > > Hi there, > > Does anybody know of a way to trick Django 1.7 (or the

Re: Remote Authentication (out-of-the-box)

2015-01-22 Thread Collin Anderson
Hi, RemoteUserBackend is for Apache or Windows IIS, I don't think it's what you want. Do you have a local copy of the user table on hand? If so just query the matching username and call "django.contrib.auth.login()" on it. Otherwise, you'll need to use a custom backend. Collin On Wednesday,

Re: block php requests

2015-01-22 Thread Collin Anderson
Hi, I had broken link emails enabled for a while. Over time, my nginx.conf config grew into this: location /_vti_inf.html { return 404; } location /crossdomain.xml { return 404; } location ~/cache/eb91756ae6745d22433f80be4ec59445$ { return 404; } # some sort of plugin? location

Re: Strange Behavior from the Django Admin (following tutorial on a shared server)

2015-01-22 Thread Collin Anderson
Hi, What's likely happening is that django or passenger is crashing. Is there any log available? Collin On Wednesday, January 21, 2015 at 2:13:45 AM UTC-5, Ed Volz wrote: > > Hi all, > > New to Django so I was following along with the tutorial and can get to > the point of logging into the

Re: Is Django suitable for this purpose?

2015-01-22 Thread Collin Anderson
Hi, As others have mentioned, it's totally possible. Regardless of using Django or not, the integration could easily be the hardest part, and that's where the "up to a minute delay" could come in. Collin On Tuesday, January 20, 2015 at 4:52:33 PM UTC-5, Mike Taylor wrote: > > I want to have

Re: Binding model data to a formset without POST

2015-01-22 Thread Collin Anderson
Hi, Interesting. I've never heard of someone wanting to show validation errors on the initial data when the page first loads. I have however wanted to manually bind data to a form before. Last time I checked it's not super trivial, because you could for instance have a SplitDateTimeWidget

Re: OneToOne field versus model inheritance

2015-01-22 Thread Collin Anderson
Hi, Django doesn't really provide a way to create a subclass from an already existing object in the admin. It's actually pretty hard to do even in the code. So for that reason I'd recommend the non subclass with the OneToOneField. Actually, if I were doing it, this is what I would do: class

Re: How to check appname via Django commands?

2015-01-22 Thread Collin Anderson
Hi, I don't think the project name is stored in the database. You can sometimes access the project name this way: settings.SETTINGS_MODULE.split('.')[0] Collin On Tuesday, January 20, 2015 at 6:33:38 AM UTC-5, Sugita Shinsuke wrote: > > Hello Vijay > > Thank you for replying. > > But, I want

Re: sending email

2015-01-21 Thread Collin Anderson
Hi, Yes, this is possible. Something like: from django.core.mail import send_mail def authorized_leave(request): form = MyForm() if request.method == 'POST': form = MyForm(request.POST) if form.is_valid(): obj = form.save() send_mail('Subject

Re: post_save signal not working in Django 1.7

2015-01-21 Thread Collin Anderson
Hi, Does the object in post_save have a pk/id? Are you using transactions? Collin On Monday, January 19, 2015 at 1:22:37 PM UTC-5, Luis Matoso wrote: > > Something similar is happening with me too: on a post_save of model it > isn't created yet on database, so several > error are raised by

Re: Flood of ''Invalid HTTP_HOST header" mails

2015-01-21 Thread Collin Anderson
Hi, So django is rejecting hosts even though they are listed in ALLOWED_HOSTS? Are you using apache/mod_wsgi by chance? It could be loading the settings for the wrong website. I assume you are reloading the server in between changes to the file. Collin On Monday, January 19, 2015 at 1:18:11

Re: Desperately need Django help!

2015-01-21 Thread Collin Anderson
Hi, A new CSRF token gets generated after you log in, so you'll need to ask django for the new one, or simply ready the new value from document.cookie. Collin On Monday, January 19, 2015 at 3:08:34 AM UTC-5, Neil Asnani wrote: > > Hi, I am trying to build a single page, restful application to

Re: Canvas OAuth2 From Django View

2015-01-21 Thread Collin Anderson
s again for the help. > > Henry > > On Saturday, January 17, 2015 at 7:33:40 AM UTC-6, Collin Anderson wrote: > >> Hi, >> >> Use urllib/urllib2 or requests to POST to other websites. Python can do >> it natively. >> >> try: # Python 3 >> fr

Re: Queryset .count() breaks when counting distinct values generated by .extra()

2015-01-21 Thread Collin Anderson
Hi, I don't use extra() a lot, but it could be that count() clears out extra. This doesn't exactly answer your question, but you may want to try your query on the 1.8 alpha using the new available expressions. You might be able to do this without needing extra() at all in 1.8. Collin On

Re: Help a newb with authentication and registration

2015-01-19 Thread Collin Anderson
Hi, Here's a nice tutorial: http://musings.tinbrain.net/blog/2014/sep/21/registration-django-easy-way/ Collin On Saturday, January 17, 2015 at 1:20:56 PM UTC-5, Ben Gorman wrote: > > I've spent the past few weeks trying to set up a custom (but not > unreasonable) user registration and

Re: How to make generic variables available in settings and contexts?

2015-01-19 Thread Collin Anderson
Hi All, Also, check out assignment_tags if you haven't seen them. https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#assignment-tags Collin On Sunday, January 18, 2015 at 8:09:58 AM UTC-5, James Schneider wrote: > > If you need it in all of (or a large majority of) your

Re: formset - how to set a from error from formset.clean?

2015-01-19 Thread Collin Anderson
Hi, You might be able to do something like: self.forms[3].add_error('field_name', 'error message') https://docs.djangoproject.com/en/dev/ref/forms/api/#django.forms.Form.add_error Collin On Saturday, January 17, 2015 at 10:46:27 PM UTC-5, Richard Brockie wrote: > > Hi everyone, > > In a

Re: Uniqueness of "."

2015-01-19 Thread Collin Anderson
Hi, Yes, looking at the code, it appears that there's nothing preventing you from creating clashing custom permissions. Ideally, the unique_together should be on ('content_type__app_name', 'codename') if that's even possible. Collin On Friday, January 16, 2015 at 1:37:02 PM UTC-5, Torsten

Re: post_save signal not working in Django 1.7

2015-01-19 Thread Collin Anderson
Hi, Are you using AUTH_USER_MODEL? I assume your logging is set up correctly? Here's a snippet from one of my projects if you want to try out some similar code: def user_save_handler(sender, **kwargs): user = kwargs['instance'] try: user.userprofile except

Re: Django Admin UI Bug - 1.7.3

2015-01-18 Thread Collin Anderson
me.prj_name) But django is expecting this also to work: >>> pcts = DvBoolean.objects.all() >>> for p in pcts: ... print(p.prj_name) Collin On Sunday, 18 January 2015 12:31:06 UTC-5, Timothy W. Cook wrote: > > > On Sat, Jan 17, 2015 at 11:49 AM, Collin Anderson <cmawe...@g

Re: Django Admin UI Bug - 1.7.3

2015-01-17 Thread Collin Anderson
Hi, Did you also switch to Python 3? It doesn't seem to be using your __unicode__ method at all. If you query one of these Projects in manage.py shell, do they show the project name? Are you sure that the __unicode__ method is actually attached to your model? Also, FYI, to_field="prj_name"

Re: Canvas OAuth2 From Django View

2015-01-17 Thread Collin Anderson
Hi, Use urllib/urllib2 or requests to POST to other websites. Python can do it natively. try: # Python 3 from urllib import request as urllib_request except ImportError: # Python 2 import urllib2 as urllib_request from django.utils.http import urlencode def my_view(request):

Re: Integration with Legacy DB

2015-01-17 Thread Collin Anderson
Hi, It should be possible to re-write you select statement using the Django ORM, but there's not an automatic way to convert it. There's also raw() which might take the statement as is. https://docs.djangoproject.com/en/dev/topics/db/sql/ Collin On Wednesday, January 14, 2015 at 11:05:08 AM

  1   2   3   4   5   6   7   >