Where does SessionMiddleware load the session object from the SessionStore backend?

2011-05-12 Thread Andy
I was looking at the source code of SessionMiddleware: class SessionMiddleware(object): def process_request(self, request): engine = import_module(settings.SESSION_ENGINE) session_key = request.COOKIES.get(settings.SESSION_COOKIE_NAME, None)

Re: Where does SessionMiddleware load the session object from the SessionStore backend?

2011-05-12 Thread Andy
Thanks. I did notice the load() method. But can you tell me where is that method called? On May 12, 5:39 pm, Kirill Spitsin wrote: > On Thu, May 12, 2011 at 01:58:07PM -0700, Andy wrote: > > ... > > > So basically SessionStore just creates a new instance without trying >

Re: Where does SessionMiddleware load the session object from the SessionStore backend?

2011-05-12 Thread Andy
Thank you. On May 12, 6:54 pm, Kirill Spitsin wrote: > On Thu, May 12, 2011 at 03:39:39PM -0700, Andy wrote: > > Thanks. I did notice the load() method. > > > But can you tell me where is that method called? > > session[key]: > > SessionBase.__getitem__(key): >

VirtualHost and external IP

2010-12-17 Thread andy
I have the following in my apache httpd.conf file ServerName mastermac Alias /site_media/ /var/www/django_projects/master_mac_enterprise/ master_mac_enterprise/site_media/ Order deny,allow Allow from all Options -Indexes WSGIScr

Re: VirtualHost and external IP

2010-12-18 Thread andy
Thanks Craig, and yes it's for my personal network and not any company. On Dec 18, 6:50 am, "W. Craig Trader" wrote: > Andy ... > > Really hard to answer this without any knowledge of your network > architecture.  Presumably you have some sort of firewall/router/NAT

Re: VirtualHost and external IP

2010-12-18 Thread andy
Thanks Craig, and yes it's for my personal network and not any company. On Dec 18, 6:50 am, "W. Craig Trader" wrote: > Andy ... > > Really hard to answer this without any knowledge of your network > architecture.  Presumably you have some sort of firewall/router/NAT

Custom SQL questions

2010-12-19 Thread Andy
I need to execute some SQL queries involving joins and it seems like custom SQL is the way to go. A couple of questions: 1) In the doc (http://docs.djangoproject.com/en/1.2/topics/db/sql/ #executing-custom-sql-directly) there's an example: cursor.execute("SELECT foo FROM bar WHERE baz = %s", [s

Re: Custom SQL questions

2010-12-19 Thread Andy
On Dec 19, 3:48 pm, Maksymus007 wrote: > you get array of arrays. > First array contains rows. Every row is just an array of fields, order is > the same as in your query. What if my query is "SELECT * FROM ..."? In that case what ordering would the fields be in? -- You received this message

Re: Custom SQL questions

2010-12-19 Thread Andy
> > I presume you already tried out to do your JOIN queries using the Django > ORM? Is there a way to specify JOIN using the Django ORM? The 2 tables I'm joining aren't related through a foreign key. -- You received this message because you are subscribed to the Google Groups "Django users" g

Re: Custom SQL questions

2010-12-19 Thread Andy
On Dec 19, 5:06 pm, "Jonas H." wrote: > On 12/19/2010 10:20 PM, Andy wrote: > > > Is there a way to specify JOIN using the Django ORM? The 2 tables I'm > > joining aren't related through a foreign key. > > Why don't you use a relation field

Re: Custom SQL questions

2010-12-19 Thread Andy
On Dec 19, 6:20 pm, Tim Sawyer wrote: > I think so, yes.  Something like this: > > You can then do something like > > anObjectA = ObjectA.objects.filter(id=1)[0] > objectBs = ObjectB.objects.filter(object_a=anObjectA) This requires 2 separate queries, right? I'm hoping to just have 1 trip to t

How does Django handle Foreign Key in MySQL?

2010-12-21 Thread Andy
Say I have these models: class Musician(models.Model): first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) class Album(models.Model): artist = models.ForeignKey(Musician) name = models.CharField(max_length=100) MySQL with MyISAM tables doesn't

How to verify the content-type & charset of uploaded file?

2010-12-25 Thread Andy
In the doc (http://docs.djangoproject.com/en/1.2/topics/http/file- uploads/#uploadedfile-objects) it is stated that: "UploadedFile.content_type The content-type header uploaded with the file (e.g. text/plain or application/pdf). Like any data supplied by the user, you shouldn't trust that the uplo

How to scale out uploaded file storage & serving?

2010-12-25 Thread Andy
I'm building a website where users can upload photos and I'd also convert uploaded photos into thumbnails (probably using sorl- thumbnail). When everything fits in one server, I would just use FileField() and handle_uploaded_file() as detailed in the doc. Planning ahead, if the website gets popul

Save uploaded file to remote machines?

2010-12-27 Thread Andy
I'm using forms.FileField() to allow users to upload photos. After a photos is uploaded, I want to save the photo to one or more than one remote machine(s) which are dedicated to serving images. How do I do that? Thanks. -- You received this message because you are subscribed to the Google Grou

Re: current recommendations for using email as username

2011-03-08 Thread Andy
Is the 30 characters limit enforced by the database or by Django? If the limit is set by the database, would altering the DB schema work? On Mar 4, 10:51 pm, Shawn Milochik wrote: > > Email addresses have been allowed since version 1.2 < > >http://docs.djangoproject.com/en/1.2/topics/auth/#api-r

Re: What is the best server for Django

2011-03-09 Thread Andy
It really depends on your needs. If you are also running a DB on the server and have significant traffic, virtual servers such as EC2 or Linode might not work well because they tend to have poor IO performance. On Mar 9, 4:53 am, Chen Xu wrote: > I am thinking to buy a server, and integrated wit

Is it safe to change the "id" field of a model from int to bigint in the DB schema?

2011-03-12 Thread Andy
I have a model that may have a lot (billions) of records. I understand that the "id" field of a model is defined as a 32-bits int. So it may not be big enough. Is it safe to just ALTER the database schema to change the "id" field from int to bigint? Would Django break? What happens when the "id" v

Would object creation involving FK still work when the 2 tables involved are in different databases?

2011-03-29 Thread Andy
Hi, Say I have a model: class Note(models.Model) : text = models.TextField() owner = models.ForeignKey(User) If Note and User are located on different databases, would the following still work? note = Note(text='hello world', owner=request.user) I understand that join will not work acr

Do you combine you Django decorators?

2011-04-03 Thread andy
Do you use several Django decorators for your views or do you combine the common ones into one or two custom decorators? This is just something that I have been a bit curious about for a while now as I tend to hate using more that one decorator per view. I have often thought about combining them.

Re: Confusion with ROOT_URLCONF

2011-04-03 Thread andy
Well I'm guess you don't have to. Both ROOT_URLCONF = "foo.urls" and ROOT_URLCONF = "urls" seem to work fine. On Apr 3, 8:11 am, Roy Smith wrote: > I don't understand how ROOT_URLCONF is declared in settings.py.  If I > put all my apps (and my settings.py file) in a directory "foo", I'm > suppose

Re: Confusion with ROOT_URLCONF

2011-04-03 Thread andy
I'm not really a pro with the who path stuff but this is how I see it. ROOT_URLCONF = 'projectname.urls' In my project I can import projectname and projectname.urls. generally all django project have a __init__.py file which makes it a module, so in your case soco-site should be a valid module wi

Re: Do you combine you Django decorators?

2011-04-04 Thread andy
am Walters wrote: > Hi Andy > > I dont combine them... however: > I was using a couple of decorators for almost every view in one > project. Ended up putting them in middleware. > Are these decorators for every view? Maybe you should consider middleware too. > > cheers >

Re: Problem if my id key is not an integer.

2011-04-04 Thread andy
Did you add a primary_key=True to your char field? On Apr 4, 11:46 am, "David.D" wrote: > My models all extend my custom model class which id is a CharField not > a PositiveIntegerField like the Django's default > django.db.models.Model . > > So, when I try to add a vote, I got a ValueError: > in

Two Django projects with common models and business logic

2014-12-23 Thread andy
mon models and business logic. Thanks in advance. /andy P.S. This is my first post. So pardon me for breaking any forum etiquette. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving ema

Re: Two Django projects with common models and business logic

2014-12-24 Thread andy
Thank you. Since it's only me that'd be using the apps do can I bypass the 'deploy using pip' thing and somehow directly use it in my other projects? /andy On Wednesday, December 24, 2014 12:41:25 AM UTC+5:30, Javier Guerra wrote: > > On Tue, Dec 23, 2014 at 1:22 PM,

Re: Django Rest Framework: Get Data from an external apis

2018-01-25 Thread Andy
you dont have to define any route when getting data from an external api, just use requests.get('https://api.test.com/consumers') to get your data -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: unable to save object Django (2.0)

2018-01-25 Thread Andy
what is the actual error message? Am Dienstag, 23. Januar 2018 21:10:00 UTC+1 schrieb harsh sharma: > > i am trying to save the basic information about a person > i have created a model form for it but i am unable to save the object > (unable to update the database) > > here is my views file > >

django 2 under python 2

2018-01-25 Thread Andy
Hi! pip inside a python2 virtualenv will try to install django 2, which aint working and will fail. I wonder why this is happening because for instance if i install ipython in that same virtualenv pip wont try to install version 6.x because its marked as python3 only. It seems django 2 is missi

weird manager bug

2018-01-25 Thread Andy
Hi, i have created a module for django that basically gives me shadow db with all deleted data and hides all that from django by the use of a custom (not deleted) data manager. So far so good - this works really well, but lately i finally wrote some tests for this project and discovered a weird

Re: django 2 under python 2

2018-01-26 Thread Andy
okay after digging a little bit more yesterday i found out why this is happening .. https://code.djangoproject.com/ticket/28878 its fixed in 2.0.1, but maybe they will be able to reupload 2.0 Just to be clear: i know that django 2 aint working under python2, but its a pain to setup cross versio

Re: Get request, has PK, how do I access the PK data with in the model

2018-01-26 Thread Andy
Travis have a look the very cool and complete django tutorial which explaining how you query models in part2. Once you have create the admin views, watch closely at how the list filters work to get an idea of what you have to do. :) -- You received this message because you are subscribed to th

Re: how do I make django search for male or female without needing to specify an age?

2018-01-28 Thread Andy
Why do you make a POST request for displaying a list? Use GET parameters like its done for admin filters. And for building an API that returns JSON Data use DjangoRestFramework and you will just need to define your serializer fields .. the rest is taken care of for you. That code above looks ove

Re: django 2 under python 2

2018-01-29 Thread Andy
its fixed now .. you can savely install django under python2 again :) Am Donnerstag, 25. Januar 2018 22:39:43 UTC+1 schrieb Andy: > > Hi! > > pip inside a python2 virtualenv will try to install django 2, which aint > working and will fail. > I wonder why this is happening becau

Re: querying multiselectcheckbox

2018-02-01 Thread Andy
Once you fixed the typo in your model name its Participants.objects.filter(track_events__in=['100M', '200M']).values_list('Full_name') And you should use single case for model name (Participant) and lower case for full_name as you did with the other attributes. -- You received this message b

Re: django-vue

2018-02-01 Thread Andy
I made a project template that is already configured to use vue and a lot more. https://github.com/kakulukia/django-default-project Am Mittwoch, 31. Januar 2018 12:55:48 UTC+1 schrieb Mohammad ariyan bin layek: > > Hii guys is there any good resouce to integrate django with vue ? > -- You rec

Travis Problem

2018-02-01 Thread Andy
Hi, im trying to convince Travis to test my app: https://github.com/kakulukia/django-secrets But its failing for all python3 versions. Because my system python 3 is 3.6.4 i just installed pyenv, created a 3.6.3 (latest python 3.6 at Travis) virtualenv and ran the tests. On my local system they

Re: Simple table construct?

2018-02-01 Thread Andy
You could use Djangos geo features to calculate distances. https://docs.djangoproject.com/en/2.0/ref/contrib/gis/ Am Mittwoch, 31. Januar 2018 15:40:41 UTC+1 schrieb MikeKJ: > > This should be real simple but it has me scratching where to start > > Distance/Time between 2 place like > > Distance >

Re: Customizable Invoice

2018-02-02 Thread Andy
Do you have any idea in any programming language you know how to do what you are asking for? -- 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+unsubs

Re: Customizable Invoice

2018-02-02 Thread Andy
Well since your answer is no, you should take you time and learn Python/Dajngo before asking anyone in here to basically write that invoice app for you. :) Basically Django can do what you are asking for, but i'd recommend you to use it only as a backend for this highly UI focused problem. Then

Re: Optimal query for related names in onetomany or manytomany using Django Queryset

2018-02-02 Thread Andy
a) Maybe its an option to put the foreign key to the other model? This way you dont need to make a join to find out if there is a relation. b) Save the existing ralation status to model A c) cache the A.objects.filter(bs__isnull=False) query But apart from that i fear you cannot do much more, s

Re: Optimal query for related names in onetomany or manytomany using Django Queryset

2018-02-02 Thread Andy
not that i know of Am Freitag, 2. Februar 2018 15:28:26 UTC+1 schrieb Web Architect: > > Hi Andy, > > Thanks for your response. I was pondering on option a before posting this > query thinking there could be better ways in django/SQL to handle this. But > now I would

Re: In the Admin, Is it possible to make filters on foreign keys usable with lots of related objects?

2018-02-02 Thread Andy
You should rather use search_fields instead of filtering together with the sorting ability of the admin. Thats much more suited for a scenario like described above. The filter is for status fields or something with just a few different entries, otherwise build your own filter to filter for some

Re: In the Admin, Is it possible to make filters on foreign keys usable with lots of related objects?

2018-02-02 Thread Andy
No you didn’t miss anything. He did not understand your question. But like I said before you can always build your own filter. Your problem is highly custom to your DB and model relations. You can’t expect any framework to already have a matching component for that. In my 9 years of Django dev

Re: Travis Problem

2018-02-05 Thread Andy
Which line number are you referring to? i didnt notice missing vars. Am Montag, 5. Februar 2018 15:50:14 UTC+1 schrieb Matemática A3K: > > > > On Thu, Feb 1, 2018 at 9:58 AM, Andy > > wrote: > >> Hi, >> >> im trying to convince Travis to test my app:

Re: Travis Problem

2018-02-05 Thread Andy
have some minutes to spare, please test it and tell me if you can reproduce the problem. Am Montag, 5. Februar 2018 16:30:21 UTC+1 schrieb Matemática A3K: > > > > On Mon, Feb 5, 2018 at 12:23 PM, Andy > > wrote: > >> Which line number are you referring to? >

Re: Travis Problem

2018-02-05 Thread Andy
xport (django_secrets.tests.SecretTest) > -- > Traceback (most recent call last): > File "/home/rodrigo/code/django-secrets/django_secrets/tests.py", line > 32, in test_export > command.handle() > File > "/home/rodrigo/code/django-secr

Re: BooleanField ignored by makemigrations Django 2.0

2018-02-13 Thread Andy
Your app is most likely not listed in installed_apps when makemigrations is not picking up anything. Or its just because you named it model.py instead of models.py? Is any other model of that app picked up by makemigrations? Am Donnerstag, 8. Februar 2018 23:28:19 UTC+1 schrieb Gary Mumford: > >

Re: Syntax Error when trying to migrate to Postgresql

2018-02-14 Thread Andy
Could you post a few more lines of this settings.py? Preferably the whole DATABASES definition. Just in case there actually is a weird invisible character try retyping 'postgresql', but more likely it looks as if you are using wrong quotation marks other than ' or ". I dont even have on my keyb

edit model properties in the admin

2018-02-14 Thread Andy
Im trying to have a custom admin that is also able to edit some model properties, but putting those properties into my fieldsets its complaining Unknown field(s) (foo, bar) specified for Profile. Check fields/fieldsets/exclude attributes of class ProfileAdmin. The properties work in list_displa

Re: edit model properties in the admin

2018-02-14 Thread Andy
. Am Mittwoch, 14. Februar 2018 13:54:30 UTC+1 schrieb Gonzalo Delgado: > > On 14/2/18 08:05, Andy wrote: > > Im trying to have a custom admin that is also able to edit some model > > properties, but putting those properties into my fieldsets its > complaining > >

Re: edit model properties in the admin

2018-02-14 Thread Andy
Am Mittwoch, 14. Februar 2018 14:45:49 UTC+1 schrieb Adler Neves: > > You can have an OneToOneField in the profile referencing Django's User > model with `related_name='profile'`, Well, i know this and the related entry is accessible even without explicitly defining the related_name. You can

Re: Strange problem with Django

2018-02-18 Thread Andy
How did you try to run the command? It sounds that you told you computer to open the file instead. You have to run that in the command shell of your OS. (Terminal on OSX or Powershell in Windows) Am Samstag, 17. Februar 2018 18:48:58 UTC+1 schrieb Tet Yeap: > > Hi, > > I was trying to learn

Re: DjangoUnleashed-2.0

2018-02-20 Thread Andy
How many problems are there and how big is this section? There is quite a gap from 1.8 to 2.0 mainly the new locations of url functions which are nagging you. How can i help? Am Dienstag, 20. Februar 2018 13:21:10 UTC+1 schrieb Midhat Šibonjić: > > Django 2.0 released before 2,5 months. We have

Re: How do I get dynamic choices to a select widget at render time?

2018-02-20 Thread Andy
use django-select2 Am Dienstag, 20. Februar 2018 01:17:26 UTC+1 schrieb Mike Dewhirst: > > Here is an example of get_choices() output ... it comes from a method on > the Question model. > > [('A', 'A - Once?'), ('B', 'B - Twice?'), ('C', 'C - Four times?'), > ('D', 'D - Twelve times?'), ('E',

Re: how can i allow visitors to make an account and post pictures in my django website. something like this

2018-02-20 Thread Andy
Have a look at the official tutorial, give you users acces to the admin and have a look at the fielfield which once you created an admin for your model containing this field will allow anyone to upload files to your project. Am Dienstag, 20. Februar 2018 13:21:10 UTC+1 schrieb miraj: > > how to

Re: help with the poll application." Writing your first Django app".

2018-02-21 Thread Andy
You are not using Django 2.0 and thus the path function is not existing in Django 1.11. Django 2.0 can only be installed with python3, while you are trying to use python 2.7 for that job. apt install python3 python3-pip pip3 install virtualenv virtualenvwrapper mkvirtualenv django-tu

Re: Django web app reaching rest api and CORS problem

2018-02-21 Thread Andy
Why do you use a third component to have a rest api? instead of the django rest framework? Since the problem is inside your custom falcon server, its not in any way related to django .. ask the falcon comunity here instead: https://gitter.im/falconry/user Am Mittwoch, 2. November 2016 14:29:25

Re: template parse error

2018-02-22 Thread Andy
Are you using the defautlt django template engine or something else? Looks correct, but please show the full template, because there might be errors before that point causing this error message. Am Donnerstag, 22. Februar 2018 07:16:32 UTC+1 schrieb suabiut: > > Could not parse the remainder: '==

Re: Getting complex query set with a many to many relationship in django

2018-02-23 Thread Andy
If you want to have Articles then get Article.objects.filter(section=xy).oder_by('section__order') Am Donnerstag, 22. Februar 2018 20:47:31 UTC+1 schrieb James Farris: > > I am trying to *get all article objects that are part of a section* in an > edition that is in an issue. I am stumped, even

Re: help with the poll application." Writing your first Django app".

2018-02-23 Thread Andy
thx :) Am Freitag, 23. Februar 2018 22:16:12 UTC+1 schrieb Haven McConnell: > > This is very good explaintaion > > On Wednesday, February 21, 2018 at 7:17:48 AM UTC-5, Sebastian Saade wrote: >> >> >>

Re: Seeking professional help for frontend design for a small django project

2018-02-27 Thread Andy
Whats in it for the potetial frontnd developer? Money? Just fame? How many pages are you talking about? Am Dienstag, 27. Februar 2018 00:04:45 UTC+1 schrieb cjwalter: > > Hi everybody > > I’ve started a small django website which is up and running but could > benefit from some frontend polish (b

Re: autocomplete

2018-02-27 Thread Andy
for any more complicated admin autocompletes or stuff in the frontend use djang-select2 Am Montag, 26. Februar 2018 18:55:15 UTC+1 schrieb Mafabi Emmanuel: > > how do i design an autocomplete in django 2.0 > > > -- You received this message because you are subscribed to the Google Groups "Djan

Re: Reverse for 'detail' with arguments '('',)' not found. 1 pattern(s) tried: ['(?P[0-9]+)/$']

2018-03-07 Thread Andy
If you actually are inside the profile create view, the profile probably does not have an id yet and thats why the url lookup is failing. The ID will be created on first save of the object. Am Dienstag, 6. März 2018 00:11:53 UTC+1 schrieb anyi.lloyd: > > Am new to Django, please i need help here

Re: Borrowing functionality from Django Admin forms

2018-03-08 Thread Andy
Take a deeper look at the *RelatedFieldWidgetWrapper (https://github.com/django/django/blob/1.3.2/django/contrib/admin/widgets.py#L200)* Am Mittwoch, 7. März 2018 21:11:18 UTC+1 schrieb Justin Johnson: > > I have a user who saw how new objects can be created using the Admin > forms, and asked if

Re: Reverse for 'detail' with arguments '('',)' not found. 1 pattern(s) tried: ['(?P[0-9]+)/$']

2018-03-08 Thread Andy
which one of your calls to detail are failing? or reverse('student:detail', kwargs={'pk': self.pk}) ? if its the second one, try with args=[self.pk] Am Donnerstag, 8. März 2018 19:48:44 UTC+1 schrieb anyi.lloyd: > > Yes it is named profile. > > ----- R

sharing sessions

2018-03-19 Thread Andy
I want to have some sort of SingleSignOn for my application and a forum based on askbot (also Django). I built a REST API to get the session from my application and want to replicated and also get the user from inside askbot. This kind of works, but i cannot decode the session inside the forum.

Re: sharing sessions

2018-03-19 Thread Andy
okay, i made it work like it already should have before my posting .. if only there was no typo in my secret key and askbot was not setting the session serializer to PickleSerializer Works great now! Am Montag, 19. März 2018 12:39:16 UTC+1 schrieb Andy: > > I want to have some s

cors and images via dj-static

2018-04-19 Thread Andy
Hi, is there a way to serve media files via dj-static with the addition of CORS headers? -- 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.

Re: Login with email address, mobile number or username.

2018-04-19 Thread Andy
Firt of all you should start with you own user model because changing it afterwards is not that easy like stated in the docs. >From there you can change the username restrictions to your liking and implement the cell_phone field. Then implement you own version of ModelBackend which is also check

is that really not possible with the Django ORM?

2018-04-27 Thread Andy
In my 10 years playing with Django i found a few bugs, but i never had to fall back to a raw SQL query. Fiddling with Django for almost a full day now im out of ideas except of asking for help here: I have an organizer app with days containing shifts and people working those shifts (M2M). There

Re: django does not open html file properly

2018-04-27 Thread Andy
It looks as if you see all contents of you index.html while also missing all dependencies .. check the network tab of your browser to confirm this. The report created by gephi is probably an html page that is soppused to be opened via the browser directly or served with a webserver. Just renderin

Re: Django and Fullcalendar.

2018-04-27 Thread Andy
What kind of error are you getting? -- 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

How to clean a model after the related models inline forms have been saved?

2018-08-26 Thread Andy
I want to execute a check after the related data from the admin has been saved, but the default clean methods get executed before the formsets are saved. Where could i place my check to have access to a full version of what has been changed on the admin page? -- You received this message becau

Re: How to clean a model after the related models inline forms have been saved?

2018-08-26 Thread Andy
Am Sonntag, 26. August 2018 18:07:25 UTC+2 schrieb Jason: > > why would you want to persist unvalidated data to your db? > >> >> Well, i dont necessarily have to, but i somehow need to be able to perform a query with all updated data taken into account. The easiest solution i came up with is pu

Re: How to clean a model after the related models inline forms have been saved?

2018-08-26 Thread Andy
Am Sonntag, 26. August 2018 18:29:49 UTC+2 schrieb Jason: > > I think we're missing a few things. how fast does this query with updated > values execute after the form submits? > a neglectable amount of milliseconds > if you need to return the value back to the view, can't you do some sort

Re: How to clean a model after the related models inline forms have been saved?

2018-08-26 Thread Andy
Please forget about the persisting data part. The problem is that inside the parent form i dont have access to the related data and the formsets new related data is validated after the parent models data. Inside the formset every related data model does not have access to the other related inst

New custom field and widget for admin

2008-11-19 Thread Andy McKay
ound object managers and I'm a bit stumped. Any ideas appreciated, I have a feeling I'm going about it all wrong (wouldn't be the first or last time :). Thanks -- Andy McKay Site: www.clearwind.ca Blog: www.agmweb.ca/blog/andy --~--~-~--~~~---~

Re: referencing style sheets in templates

2008-11-19 Thread Andy McKay
27;ve already done this, or are not using runserver, we would likely need some more information. Cheers -- Andy McKay Clearwind Consulting Site: www.clearwind.ca Blog: www.agmweb.ca/blog/andy --~--~-~--~~~---~--~~ You received this message be

Re: Is it possible to display multiple forms in a single template file?

2008-11-20 Thread Andy McKay
L twice, only one of them will ever be active. Remove one of those of URL's, then merge the two views together and pass both form1 and form2 to the template. -- Andy McKay Clearwind Consulting Site: www.clearwind.ca Blog: www.agmweb.ca/blog/andy --~--~-~--~~

Re: del session variables

2008-11-20 Thread Andy McKay
of: clear() and flush() http://docs.djangoproject.com/en/dev/topics/http/sessions/#topics-http-sessions Sounds like one of those might be helpful. -- Andy McKay Clearwind Consulting Site: www.clearwind.ca Blog: www.agmweb.ca/

Template tag attribute lookup with abstracted variable

2008-11-21 Thread Andy Young
I'm looking for an elegant way of stepping through my models from within my template tags. I have 3 model classes chained by many-to-many relationships, viz Category --> Item --> Detail. This model pertains to resume data, e.g., Category='Education', Item='Univ1', Detail='Biology coursework'. E

Re: Template tag attribute lookup with abstracted variable

2008-11-22 Thread Andy Young
On Nov 21, 7:03 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > It is deliberate that Django's template language doesn't support > indirect attribute lookup. Helps to keep things simple (part of the > "keep programming out of templates" design goal). You're absolutely right about this, and I

Re: importing all forms/models etc with one statement

2008-11-23 Thread Andy Young
On Nov 23, 8:31 pm, dash86no <[EMAIL PROTECTED]> wrote: > Is there no way to call all models implicitly. For example: > > from mysite.myapp import models > PS. I tried looking round the documentation. I found > this:http://www.djangobook.com/en/1.0/chapter08/ > > from django.conf.urls.defaults im

{% ifequal %} Confusion

2008-11-23 Thread Andy Young
Hi all, I've attempted a shortcut in an {% ifequal %} tag and ran into some unexpected consequences. Basically, I have two DateFields in a model named begin_date and end_date. I am iterating through field names ({{ f }}) and their corresponding values ({{ item|getattr:f }}) to populate a webpag

Re: Need help for sorting

2008-11-25 Thread Andy Young
On Nov 25, 12:27 am, laspal <[EMAIL PROTECTED]> wrote: > Exception Type:         FieldError > Exception Value:        Cannot resolve keyword 'callreports_meetingdate' > into field. Your error indicates a missing model field named 'callreports_meetingdate' since you used a single underscore. Use

Re: How to get the values of a field of the model

2008-11-27 Thread Andy Young
On Nov 27, 12:54 am, izzy <[EMAIL PROTECTED]> wrote: > I still don't get it. "distinct()" is a queryset method for the "objects" manager, just like "all()" is. Since author is a link to the "auth.models.User" class, you would list all unique users with: users = auth.models.User.objects.distinct

Re: Django And os.path Behavior

2008-12-05 Thread Andy McKay
> os.path.exists behaves differently if called from a django app. Why? I don't think it does, for example: ~/sandboxes/arecibo $ ls -al ~/Desktop/ [...snip..] drwxr-xr-x 2 andy andy 68 5 Dec 21:57 El Camarón de la Isla ~/sandboxes/arecibo $ cat test.py # -*- coding: utf-8 -*

file upload with create_object generic view

2008-12-13 Thread Andy Young
Hi all, just to confirm a suspicion I have with using the 'create_object' generic view: #urls.py ... (r'^accepts/photos/$', 'django.views.generic.create_update.create_object', {'model':photologue.models.Photo}), ... renders the form A-OK. However, choosing an image for the file upload field

Re: specify widget in "Admin"

2009-01-13 Thread Andy McKay
com/en/dev/ref/contrib/admin/#filter-horizontal -- Andy McKay www.clearwind.ca | www.agmweb.ca/blog/andy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this grou

global / site-wide variables?

2008-07-21 Thread Andy Lei
change once per day. -Andy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email

Re: Need suggestions on subversion structure for project

2008-09-05 Thread Andy Robinson
s connects to localhost as a standard 'development' user. Then you can check out a project and run it out of the box. Any "real" server connection params should only go in the unversioned custom file. - Andy Robinson, ReportLab --~--~-~--~~~---~--~-

Pickling Querysets (Query?)

2008-09-15 Thread Andy Lei
the pickle is ASCII text, so it should be ok if i store pickles in the database in a text column, right? Thanks, Andy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Pickling Querysets (Query?)

2008-09-15 Thread Andy Lei
thanks a lot guys! On Mon, Sep 15, 2008 at 6:10 PM, Jirka Vejrazka <[EMAIL PROTECTED]>wrote: > > Hi, this is how I do it, but don't rely on effectiveness of this > solution - I'd be the first one to say that I'm a mediocre programmer > :) > > def serialize(data): > '''Input: instance of PluginP

Assigning to foreign key relationships with only the pk

2008-10-20 Thread Andy Lei
ute of the Article object with just the pk? It seems like a wasted database query to do this: r = Reporter.objects.get(pk=pk) Article.reporter = r Article.save() Is there a way I can do something like this: Article.reporter.pk = r Article.save() Thanks a

Re: Assigning to foreign key relationships with only the pk

2008-10-20 Thread Andy Lei
Thanks, that's just the solution I was looking for! Just out of curiosity, is it also possible to do this for many-to-many relationships? On Oct 20, 2:09 pm, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Oct 20, 6:07 pm, "Andy Lei" <[EMAIL PROTECTED]> wrote: >

Re: Created Form - now code works to edit object but add gets NoneType' object is not callable

2009-01-15 Thread Andy Mckay
model = Survey (add in your import statement so it knows what Survey is). Cheers -- Andy McKay ClearWind Consulting: www.clearwind.ca Blog: www.agmweb.ca/blog/andy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goo

Re: Suspicious Operation/ filestorage problem

2009-01-19 Thread Andy Mckay
> SuspiciousOperation: Attempted access to '/img/avatars/default.gif' > denied. If i remember, it's because there's a / at the beginning, you probably want a relative path. -- Andy McKay ClearWind Consulting: www.clearwind.ca Blo

BINARY columns

2009-02-16 Thread Andy Dustman
I'm working on a custom field type for Django which depends on being able to save data in a BINARY column. (Not a big BLOB, just a couple of bytes.) Unfortunately Django (trunk and probably 1.0) keeps trying to turn it into unicode which fails. I'm now using patch.3.txt on http://code.djangoprojec

Re: Is safe unsafe?

2009-02-23 Thread Andy Mckay
ssion to strip only a few, there's lots of hacks that can be done. I use the SGMLParser in Plone, here's an old one: http://code.activestate.com/recipes/52281/ some googling will probably find you more. -- Andy McKay ClearWind C

<    1   2   3   4   5   6   7   >