Model Loading Problem

2009-11-03 Thread Collin Anderson
l calls get_models() which forces all models to be registered. This seems related to http://code.djangoproject.com/ticket/1796. Am I the only one who has ran into this problem? I can think of several workarounds, but is there an actual solution to this problem,

Filtering only on Annotations

2010-01-19 Thread Collin Anderson
Taking the example from: http://docs.djangoproject.com/en/dev/topics/db/aggregation/#filter-and-exclude Publisher.objects.filter(book__rating__gt=3.0).annotate(num_books=Count ('book')) Is there anyway to have the filter only apply to the annotation, so it would return all publishers, with some h

Quick Query Question

2007-05-15 Thread Collin Anderson
I am working with a laptop rental program, and I was wondering if there is a better way to do this lookup. This works fine, but it seems like it could be better. from django.db import models class Laptop(models.Model): def laptops_out_on(date): 'get a list of laptops out on a given d

Re: Migrating from OneToOneField to ForeignKey in Django models

2015-01-12 Thread Collin Anderson
Hi, Did you figure it out? This seems like a bug. Can you reproduce it with a fresh project? Thanks, Collin On Friday, January 9, 2015 at 8:49:56 AM UTC-5, Maciej Szopiński wrote: > > Hi everyone, > > I've encountered an issue when working with django and I can't seem to > find a way out of th

Re: What forms library do you pick for a new Project?

2015-01-12 Thread Collin Anderson
Hi, I personally always do it by hand without a library. What are you hoping to get out of your form library? Collin On Friday, January 9, 2015 at 9:18:29 AM UTC-5, Frank Bieniek wrote: > > Hi All, > > I do need a recommendation for the current top notch forms library to use > for a new bigger

Re: Two QuerySets on a FormSet

2015-01-12 Thread Collin Anderson
Hi, You can merge the two querysets like this. Would that help? qs = Song.objects.filter(artist__made_by=request.user) | Song.objects.filter (album__made_by=request.user) or use models.Q from django.db.models import Q qs = Song.objects.filter(Q(artist__made_by=request.user) | Q(album__made_by=

Re: Every field is readonly in admin site

2015-01-12 Thread Collin Anderson
Hi, Are they not showing up in the admin at all, or are they showing up but read-only? Are you calling "admin.site.register(MyModel)" in admin.py? Is your user a "superuser" in django? Collin On Sunday, January 11, 2015 at 4:30:50 AM UTC-5, Abhinav Agarwal wrote: > > I am not getting and 'cha

Re: modelformset question - interspersing extra forms among existing forms

2015-01-14 Thread Collin Anderson
and form.save() would be the method that should be used. It appears > however that the POST data also end up in the instances. > > I wasn't expecting that, but it appears to work. Is there a preferred or > standard method that I should think about using? > > R. > > On Sun

Re: Many-To-Many Relationship changes not accessible in Model.save() ?

2015-01-14 Thread Collin Anderson
Hi, The admin first calls obj.save(), then it saves the related data. You could try putting your logic in ModeAdmin.save_related() https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_related Collin On Monday, January 12, 2015 at 5:00:54 PM UTC-5, Tobias

Re: object has no attribute 'new_objects' error when saving related objects

2015-01-14 Thread Collin Anderson
Hi, You are using an inline which uses a formset under the hood. When a formset gets saved it gets the expected new_objects, but you're not saving the formset. It might make sense to not use an inline and display the data points by hand. Collin On Tuesday, January 13, 2015 at 8:49:54 AM UTC-

Re: ImportError: No module named check_constraints

2015-01-14 Thread Collin Anderson
Hi, Yes, a full traceback would be helpful, if you can get it. If it's a manage.py commany, you may need to use --traceback. Collin On Tuesday, January 13, 2015 at 5:38:47 AM UTC-5, Jenefa Jeyaraj wrote: > > ImportError: No module named check_constraints > > -- You received this message becau

Re: need help to configure new domain

2015-01-17 Thread Collin Anderson
Hi, Did you figure it out? It looks like you need to configure your urls.py so it's connected with django-cms. Collin On Tuesday, January 13, 2015 at 9:19:09 PM UTC-5, zsandrusha wrote: > > hello i need urgent help to configure django, > i had site on django cms then i loose my old domaind now

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 UT

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): respo

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" means

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

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 UserProfile.DoesN

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 Bro

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 formse

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 templates,

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 authentic

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 Sunda

Re: Canvas OAuth2 From Django View

2015-01-21 Thread Collin Anderson
valid HttpResponse but instead returned > "None" like I've gotten up until now? > Thanks 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 P

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 t

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 P

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 fu

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 here'

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 t

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 U

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 whic

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 an

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 Adm

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: 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: 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 prope

Re: sending email

2015-01-22 Thread Collin Anderson
nuary 21, 2015 at 11:29:51 PM UTC-5, suabiut wrote: > > 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,

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 *Djan

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: 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 adm

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 enti

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: 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 user

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 On

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 o

Re: sending email

2015-01-27 Thread Collin Anderson
low. 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 > wrote: > &g

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. :) Collin

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 upgraded

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! > > Thi

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 w

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 other

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: 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 = M

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, 201

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: 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

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: 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 fo

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, whe

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: 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 F

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 NamedUrlSessionWizardVie

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" file

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. http://gro

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 bec

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 eve

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, 201

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 = modelformset_factory(Scho

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: 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 > AssesmentBuildingD

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: 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: 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 Fata

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 i

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 ma

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 historic

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 rollba

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&location1=ca&ip1=2.2.2.2&hostname2=host2.example.com&location2=wa&ip2=3.3.3.3 Then you could do something like: data = [] i = 0 while True:

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: 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 ou

Re: Django OperationalError

2015-03-10 Thread Collin Anderson
thon manage 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: 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 > expli

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 Rath

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 Sunday,

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 set

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 t

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(): http://django-guardian.readthedocs.org/en/v1.2/userguide/check.html#get-objects-

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 navigat

Re: Django OperationalError

2015-03-12 Thread Collin Anderson
etar Pilipovic > 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" > >> је написао/ла: >> >> Hi Petar,

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 = models.OneToOneField(Us

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: self.assertContains(respon

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 A.objects.get(p

Re: invalid attribute

2014-08-01 Thread Collin Anderson
all of your methods are indented too much. They should be at the same level as `class Meta`, not part of it. -- 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 dja

Re: Redirect with string?

2014-08-01 Thread Collin Anderson
redirect is a django shortcut for an http redirect response, not a file/pipe redirect. You need to use a python socket to connect to the ip address. http://stackoverflow.com/questions/68774/best-way-to-open-a-socket-in-python -- You received this message because you are subscribed to the Googl

Re: Image upload problem with UserProfile and my form

2014-08-01 Thread Collin Anderson
This looks wrong to me: > > > so maybe, rearranging your code a bit: {% if form.avatar %} {% endif %} {{ form.avatar }} -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving e

Re: BigInt / Long for Auto Incrementing PK

2014-08-01 Thread Collin Anderson
> > Hi, you can use a bigintegerfield > > and set it as primary-key > . > But will it auto-increment when you save? -- You received this message b

Re: unsupported opperand type(s)

2014-08-01 Thread Collin Anderson
> > def was_published_recently(self): > return self.pub_date >= timezone.now - datetime.timedelta(days=1) > timezone.now() -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails fro

Re: unsupported opperand type(s)

2014-08-01 Thread Collin Anderson
p.id == 3 is just fine. It's auto-incrementing, and even if you delete items, an object will never get p.id == 1 again. If you really want a Poll with id=1, either clear out your database, or create it manually like so: p = Poll(id=1, question="What's new?", pub_date=timezone.now()) p.save() --

Re: Going throught the Django tutorial help pls

2014-08-01 Thread Collin Anderson
> > It currently shows a list of the polls, what I am trying to work out is > how to print out the integer value that is associated with that pole. Is poll.id what you want? In the template it would be {{ poll.id }} Or: Poll.objects.get(name="Test").id -- You received this message because yo

Re: Get latest timestamp+value from each group

2014-08-01 Thread Collin Anderson
I'm not an ORM/SQL pro myself, so if I were doing this, I would just cache/denoralize the last value onto the device whenever there's a new log. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving e

Re: Going throught the Django tutorial help pls

2014-08-02 Thread Collin Anderson
What does the error say? -- 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-u

  1   2   3   4   5   6   7   >