Re: can't get STATICFILES to work (Django dev version)
Check this http://stackoverflow.com/questions/7650893/serving-static-files-on-my-own-server/7651021#7651021 On Oct 4, 4:14 am, Mike Dewhirst wrote: > On 3/10/2011 10:00pm, Gelonida N wrote: > > > On 09/26/2011 10:21 PM, nara wrote: > >> I am having trouble getting STATICFILES to work. I have read the docs, > >> and followed the instructions, but I never get my css files to load. > >> My current workaround is to put all the css inline in my template > >> file, but that should not be a permanent solution. > > Here is a bit of my own interpretation which seems to work ... > > Project layout ... [0] > > projroot PROJECT_ROOT [1] > === === === === === === === === === === === === === === === === === > --- creds project credentials non-versioned for security > --- htdocs production webserver document root [2] > --- --- static all collected static files - STATIC_ROOT [3] > --- --- --- app1 app1 static files root > --- --- --- --- css app1 css > --- --- --- --- images app1 static images > --- --- --- --- js app1 javascript > --- --- --- app2 app2 static files root > --- --- --- --- css app2 css > --- --- --- --- images app2 static images > --- --- --- --- js app2 javascript > --- --- media content-related media - MEDIA_ROOT [4] > --- --- --- app1 app1 content media root > --- --- --- --- images app1 content images > --- --- --- --- videos app1 content videos > --- --- --- app2 app2 content media root > --- --- --- --- images app2 content images > --- --- --- --- videos app2 content videos > > --- PROJECT SRC_ROOT (for urls.py, settings.py etc) [5] > --- --- app1 app1 source (models.py etc) > --- --- --- locale app1 root for i18n/i10n translations/formats > --- --- --- static app1 static files root [6] > --- --- --- --- css app1 default stylesheets > --- --- --- --- js app1 javascript > --- --- --- templates app1 templates (eg base_app.html) > --- --- --- tests app1 unit tests > --- --- app2 app2 source (models.py etc) > --- --- --- locale app2 root for i18n/i10n translations/formats > --- --- --- static app2 static files root [6] > --- --- --- --- css app2 default stylesheets > --- --- --- --- js app2 javascript > --- --- --- templates app2 templates (eg base_app.html) > --- --- --- tests app2 unit tests > --- --- static project static files - STATICFILES_DIR [7][8] > --- --- --- css project stylesheets (eg project.css) > --- --- --- images project (static, not-content) images > --- --- --- js project javascript libraries > --- --- templates project templates (base.html) > --- --- --- admin admin (base_site.html for branding admin) > --- --- wsgi-bin wsgi script dir [8] > > [0] This is my preference. It isn't mandated by Django. > [1] Convenience only - not a Django setting > [2] Not used in development only in production > [3] Don't put anything here - use manage.py collectstatic instead [10] > [4]https://docs.djangoproject.com/en/dev/ref/settings/#media-root > [5] Convenience only - not a Django setting [9] > [6]https://docs.djangoproject.com/en/dev/howto/static-files/#basic-usage > [7]https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#static... > [8]http://code.google.com/p/modwsgi/wiki/InstallationInstructions > > Static Files > > > Provided 'django.contrib.staticfiles' is in INSTALLED_APPS, static files > kept in two standard locations ... > > - project//static (if different app static files are needed) > - project/static (actually, any directories in STATICFILES_DIRS) > > ... will be automatically found and served by the development server at > the URL nominated in STATIC_URL. > > In production they need to be all collected and copied into the > directory root specified in STATIC_ROOT. This relies on the production > webserver (eg Apache) being configured to serve files in the STATIC_ROOT > directory at the URL nominated in STATIC_URL. > > This collecting should be done via './manage.py collectstatic' just once > per fresh source deployment and then only if the static files have changed. > > Static files settings: > = > [9] > # My preferred project path location for static files > STATICFILES_DIRS = ( > os.path.join(SRC_ROOT, 'static/').replace('\\','/'), > ) > if DEBUG: > i = 0 > for item in STATICFILES_DIRS: > i += 1 > print('STATICFILES_DIRS = %s (#%s)' % (item, i )) > > [10] > # I prefer to keep STATIC_ROOT differences here rather than urls.py > if DEBUG: > STATIC_ROOT = os.path.join(PROJECT_ROOT, > 'htdocs/static/').replace('\\','/') > print('STATIC_ROOT = %s %s' % (STATIC_ROOT, '(collectstatic)')) > else: > # actual staging and production webserver directory > STATIC_ROOT = '/srv/www/%s/htdocs/static/' % PROJECT > > > Do you ran > > ./manage.py ru
Passing request.user to FormWizard?
Hi guy's i want to know how pass request.user to my Form Wizard?, any idea? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Error deleting user form Admin Panel
Hi guys, i dont know from where is coming this error... but two hours ago all was working fine... but know when i try to delete a user from the Django Admin i got this error: TypeError: coercing to Unicode: need string or buffer, User found Somebody know why? complete error code: TypeError at /admin/auth/user/ coercing to Unicode: need string or buffer, User found Request Method: POST Request URL:http://www.domain.com/admin/auth/user/ Exception Type: TypeError Exception Value: coercing to Unicode: need string or buffer, User found Exception Location: /home/user/webapps/django/lib/python2.5/django/ utils/encoding.py in force_unicode, line 71 Thanks guys --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Admin, two links to different views ?
No body? :( On Aug 7, 2:11 am, Asinox wrote: > Hi guys, in django admin the views that show the register's just have > a link to "edit", but what happen if a need an extra(S) links to > another views? > > for example: > > i have view that my show list of registered People, the nick is > linking to the Edit page (the normal way of Django), but i need > another links that will show me the "articles" of the people and > another the "comments" of the people. > > how ill make this with django admin? > > Thanks --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Admin, two links to different views ?
Hi guys, in django admin the views that show the register's just have a link to "edit", but what happen if a need an extra(S) links to another views? for example: i have view that my show list of registered People, the nick is linking to the Edit page (the normal way of Django), but i need another links that will show me the "articles" of the people and another the "comments" of the people. how ill make this with django admin? Thanks --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Pagination in the admin , where is?
oh man :) thanks :) so easy :) On Aug 6, 10:55 pm, "Adam V." wrote: > ModelAdmin.list_per_page will let you control how many items appear on > a particular admin > list:http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contri... > > On Aug 6, 7:50 pm, Asinox wrote: > > > > > Well, i cant find any about it, i want to know if the pagination exist > > in the admin... i think that "yes"..but .. i cant see any thing > > about.. > > > thanks --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Pagination in the admin , where is?
Well, i cant find any about it, i want to know if the pagination exist in the admin... i think that "yes"..but .. i cant see any thing about.. thanks --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: python md5
Thanks guys :) On Aug 6, 2:32 pm, James Bennett wrote: > On Thu, Aug 6, 2009 at 1:16 PM, Asinox wrote: > > Thanks Alex Gaynor :) is working :) > > It's very important to note that the documentation for this module > would have given you the same information. In general, you should be > doing your best to read and familiarize yourself with documentation so > that you'll be able to answer your own questions and be more > productive. > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: python md5
Thanks Alex Gaynor :) is working :) On Aug 6, 1:57 pm, Alex Gaynor wrote: > On Thu, Aug 6, 2009 at 12:55 PM, Asinox wrote: > > > Hi guys, please i need to know why md5 return this: > > > > > > the way that im using: > > > def encriptar(): > > toEncode = pickle.dumps(datetime.now) > > encoded = md5.new(toEncode) > > > return encoded > > > Thanks > > You can call the hexdigest() method on the md5 object to get a string > of the hash. > > Alex > > -- > "I disapprove of what you say, but I will defend to the death your > right to say it." -- Voltaire > "The people's good is the highest law." -- Cicero > "Code can always be simpler than you think, but never as simple as you > want" -- Me --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Im lost with Save function in model and saving data from Form
Thanks Daniel for reply ill tell u my problem, this form work fine in the User Panel , but in the Admin dont work. exactly my problem: i have a form... when the form is saved, im saving "pub_date" data in another database table, that is fine in the User Panel, but in the Admin panel don't work. i know that im lost with overriding the Save() function, bcz i dont know where exactly ill put this, im reading django doc's a lot, but im lost with this part. Thanks On Aug 6, 2:00 pm, Daniel Roseman wrote: > On Aug 6, 6:38 pm, Asinox wrote: > > > > > > > Hi guys, i need a litter help, i know that if i want a Form from Model > > i need to use ModelForm, but im lost with something... i have a view > > that render a Form (ModelFrom) and save this, but now i need to use > > the funcion SAVE in the Model (for use in the admin)... but im > > lost... bcz in the view form i have a litter code saving some data > > like Date, etc... in this way: > > > obj = form.save(commit = false) > > > obj.pub_date = datetime.now > > > --- > > > but now i need to know if the SAVE function need to be in the both > > place's (model and view function) sorry i need a litter sample... > > > Thanks and sorry > > I don't understand your problem. You've used form.save with > commit=False to create an unsaved model instance, then changed the > pub_date. Now all you need to do is obj.save() to save it to the > database. > -- > DR. --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
python md5
Hi guys, please i need to know why md5 return this: the way that im using: def encriptar(): toEncode = pickle.dumps(datetime.now) encoded = md5.new(toEncode) return encoded Thanks --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Im lost with Save function in model and saving data from Form
Hi guys, i need a litter help, i know that if i want a Form from Model i need to use ModelForm, but im lost with something... i have a view that render a Form (ModelFrom) and save this, but now i need to use the funcion SAVE in the Model (for use in the admin)... but im lost... bcz in the view form i have a litter code saving some data like Date, etc... in this way: obj = form.save(commit = false) obj.pub_date = datetime.now --- but now i need to know if the SAVE function need to be in the both place's (model and view function) sorry i need a litter sample... Thanks and sorry --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django admin panel how add extra function in form processing?
Sorry krylatij, im new with django, i will try :) thanks On 4 ago, 11:22, krylatij wrote: > Why do you need admin here? > You can generate it in the save() method of your model. --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django admin panel how add extra function in form processing?
Hi guys, somebody know how ill use a extra function in any form processing in the Django admin?, the problem is that i need to generate a encrypted code in the moment that a form is sendinga and save the code in the database in the user's account panel i did it... but i dont know how ill make this in the Django Admin... the problem is that the Administrator person need to generate the encrypted code too. Any idea? Thanks :) * sorry with my english --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: "join" query in Django?
Thanks Malcom for replay, but, is not working for me, i think that is simple just .filter("field1__field2"), but i cant make the join i try with .filter("field1__field2") where the field1 is the PK and the field2 is the FK. here is my query: p = Diligencia.objects.filter(Q(socio=request.user.id),Q(status=0) | Q (status=1)| Q(status=3)).filter("id__diligencia") and the error is: too many values to unpack im new with Django i cant understand this error, i searched and i cant find answer about it. The another try was: p = Diligencia.objects.filter(Q(socio=request.user.id),Q(status=0) | Q (status=1)| Q(status=3)).select_related() in this case i dont have errors but the data that i want to show from the second table is not showing... and Django dont have any setting function that will show the "SQL" that is happening in any query, like CodeIgniter "Profiler APP", that show you the SQL and you will see if the query is selecting the data that you want... im lost with Django...i missing PHP and Codeigniter :(, but i want to learn Django Im sorry with my english and my errors with djando :( --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
"join" query in Django?
Hi, guys, how or where is the "join" query in Django? i think that Django dont have "join"..but how ill make join? Thanks --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how encrypt datetime.now with python?
Thanks a lot guys :) --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
how encrypt datetime.now with python?
hi guys, i want to encrypt the "datetime.now()" , im try with base64 but base64 need string... how ill encrypt ? Thanks :) --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how save data into more than one table?
Thanks, i did it, i dont know if in the best way but im saving data in two tables :) thanks :) On Jul 30, 12:47 am, Asinox wrote: > Thanks a lot Mike, very nice help, you example helpe me with another > thing :) good!!! > > now, when i said "key" (sorry!!) i want to say "some code like an > encryption key, and random number, etc". > > im reading the django help and i cant find any topic about this part > (how make query than affect two or more tables)and in the same way > nothing about who get the last id. > > I think that Django is very nice, but the documentation need more > details o maybe be more clear. > > Thanks for u replay Mike :) > > On Jul 29, 11:36 pm, mike wrote: > > > > > I'm not clear on what you mean by "key". Foreignkey? Or for > > instance, an encryption key stored in two tables? I'm left to guess > > you mean a foreignkey. > > > In this case, the second 'table' you refer to could have a foreignkey > > relating it back to the first table. If this is what you mean, > > then ... > > > Table 1: Child > > - id: AutoField > > - fn: CharField > > - ln: CharField > > > Table 2: Evaluation > > - id: AutoField > > - child: ForeignKey(Child) > > - results: CharField > > > Each would have a corresponding Form with all fields. > > > Then in the request.POST processing... > > > child_form = childForm(request.POST) > > eval_form = evalForm(request.POST) > > > if child_form.is_valid() and eval_form.is_valid(): > > new_child = child_form.save() > > eval_form = evalForm(request.POST, instance=new_child) > > eval_form.save() > > > Keep in mind, this always creates a new record in Child table, since > > the childForm was instantiated without an instance. But that's > > different topic anyway. > > > Also, if you need to access the pk of the new_child, you simply access > > it via new_child.pk > > i.e. > > new_child = child_form.save() > > new_pk = new_child.pk > > > There is another way, but it depends a bit on the design of your > > models. > > hint: get object (if it exists) from second table, and update the > > corresponding fieldhttp://docs.djangoproject.com/en/1.0//topics/db/queries/ > > > Regards, > > > Mike --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how save data into more than one table?
Thanks a lot Mike, very nice help, you example helpe me with another thing :) good!!! now, when i said "key" (sorry!!) i want to say "some code like an encryption key, and random number, etc". im reading the django help and i cant find any topic about this part (how make query than affect two or more tables)and in the same way nothing about who get the last id. I think that Django is very nice, but the documentation need more details o maybe be more clear. Thanks for u replay Mike :) On Jul 29, 11:36 pm, mike wrote: > I'm not clear on what you mean by "key". Foreignkey? Or for > instance, an encryption key stored in two tables? I'm left to guess > you mean a foreignkey. > > In this case, the second 'table' you refer to could have a foreignkey > relating it back to the first table. If this is what you mean, > then ... > > Table 1: Child > - id: AutoField > - fn: CharField > - ln: CharField > > Table 2: Evaluation > - id: AutoField > - child: ForeignKey(Child) > - results: CharField > > Each would have a corresponding Form with all fields. > > Then in the request.POST processing... > > child_form = childForm(request.POST) > eval_form = evalForm(request.POST) > > if child_form.is_valid() and eval_form.is_valid(): > new_child = child_form.save() > eval_form = evalForm(request.POST, instance=new_child) > eval_form.save() > > Keep in mind, this always creates a new record in Child table, since > the childForm was instantiated without an instance. But that's > different topic anyway. > > Also, if you need to access the pk of the new_child, you simply access > it via new_child.pk > i.e. > new_child = child_form.save() > new_pk = new_child.pk > > There is another way, but it depends a bit on the design of your > models. > hint: get object (if it exists) from second table, and update the > corresponding fieldhttp://docs.djangoproject.com/en/1.0//topics/db/queries/ > > Regards, > > Mike --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how save data into more than one table?
Well im talking about save a form yes, but in the same moment i want to save x data in another table, for example, i want to generate some "key" while im saving the form data, but i want to save the "key" in another table. Thanks On Jul 29, 8:52 pm, mike wrote: > On Jul 29, 3:39 pm, Asinox wrote: > > > Hi guys, i cant find a example about how ill save data in two or more > > tables... somebody help me please > > > Thanks > > You essentially use two form instances and feed both to your > template. You can have multiple django forms in a single html form, > so when they're submitted, you simply check that both django forms are > valid before saving. > > Here's a snippet: > > if request.method == 'POST' and request.POST.get('save', '') == > 'Save': > > Form1 = mainForm(request.POST) > Form2 = subForm(request.POST) > > if Form1.is_valid() and Form2.is_valid(): > # do whatever else you need > # > # then save forms > Form1.save() > Form2.save() > > # return success response... > else: > # return forms for corrections... --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django and related_name
Thanks, guys im sorry Ramiro, something bother you?, im sorry. i think the problem with the indentation is the copy/paste in case of wrong indentation django/python show error's. Yes Mike is a decimal :( On Jul 29, 9:54 pm, Ramiro Morales wrote: > On Wed, Jul 29, 2009 at 6:23 PM, Asinox wrote: > > > Hi guys, first im so sorry with my english, im new with Django, u > > know ;) > > > I have a problem with a related_name, the tables are fine, but the > > problem is that in the Select (DropDown) the data display is "bad", in > > this way: Tarifas_object: > > > Html code: > > > Tarifas object > > > how ill display the correct data? > > > my model: > > > [lots of ugly code snipped] > > Firstly, the fact that English isn't your native language (it isn't mine > either) doesn't mean it is fine to use thinks like "u" instead of you, > it's basically a matter of respect for the people that will read your > message. > > Second, you don't need to paste your entire models, trim them > to the field that are relevant to question you are asking, there > is no point in subjecting the reader (potentially wanting > to help you) to wade through many irrelevant lines of code, Also, > the code you pasted seems to have very bad indentation, I don't > know if that's an artifact from your copy/paste operation or > real problems. > > One of these formatting/indentation errors could explain > the problem you describe: > > > def __inicode__(self): > > return self.precio > > This isn' t correctly indented to be considered a method of your > Tarifas model, it is being interpreted as a module level > function. Obviously, the name is wrong too, it should be > __unicode__ > > Regards, > > -- > Ramiro Moraleshttp://rmorales.net > > PyCon 2009 Argentina - Vie 4 y Sab 5 Septiembre > Buenos Aires, Argentinahttp://ar.pycon.org/2009/about/ --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
how save data into more than one table?
Hi guys, i cant find a example about how ill save data in two or more tables... somebody help me please Thanks --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django and related_name
Hi guys, first im so sorry with my english, im new with Django, u know ;) I have a problem with a related_name, the tables are fine, but the problem is that in the Select (DropDown) the data display is "bad", in this way: Tarifas_object: Html code: Tarifas object how ill display the correct data? my model: class Tarifas(models.Model): recarga = models.CharField(max_length=7, help_text='Codigo de la tarifa') precio = models.DecimalField(max_digits=7, decimal_places=2) diligencias = models.PositiveIntegerField(max_length=3) def __inicode__(self): return self.precio class Meta: verbose_name_plural="Tarifas" class Recarga(models.Model): socio = models.ForeignKey(User) fecha = models.DateField(auto_now_add=True) #valor = models.DecimalField(max_digits=6, decimal_places=2,verbose_name='Valor de la recarga', help_text= "Introduzca valores numericos ej.: 150.00") valor = models.ForeignKey(Tarifas, related_name='recarga_valor') diligencias = models.IntegerField(max_length=3, verbose_name='Cantidad de diligencias recargadas') tiponcf = models.IntegerField(max_length=1,choices=TIPO_NCF, verbose_name='Tipo de comprobante fiscal') ncf = models.CharField(max_length=19,verbose_name='Numero de comprobante fiscal') cajero = models.CharField(max_length=20) tipotarj = models.CharField(choices=TIPOS_TARJETAS, max_length=20, verbose_name='Tipo de tarjeta') numtarj = models.IntegerField(max_length=16, verbose_name='Numero de tarjeta') seguridad = models.IntegerField(max_length=3) forma_pago = models.CharField(max_length=10, verbose_name='Forma de pago') banco = models.CharField(max_length=20) numerock = models.IntegerField(max_length=8, verbose_name='Numero de cheque') def __unicode__(self): return u'%s %s %s %s' % (self.socio,self.diligencias, self.fecha) class Meta: ordering = ['socio'] Thanks guys. --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Where is the "Else if"... ?
Hi guy, im looking for the simpley if ...else if but i cant see in the django documentation Thanks :) --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: user profiles and the admin
im new , but i think that u need this part: class UserProfileAdmin(UserAdmin): inlines = [UserProfileInline] list_display = ('user', 'sex','phone') regards, On Jul 28, 3:01 pm, Chris Curvey wrote: > I'm having a bit of a brain cramp here...I'm trying to add some extra > fields to my user profiles, but I can't seem to get the fields to show > up in the admin interface. I've added the admin.py directory to my > application root, but the fields obstinately will not show up in the > admin interface. > > The only odd thing that I'm doing is that I don't have a single > models.py file with lots of classes, instead I have a models directory > containing an __init__.py file. Anyway, here's my admin.py > > admin.site.unregister(User) > > class UserProfileInline(admin.StackedInline): > model = ClientReviewProfile # this contains my extra fields. > > class UserProfileAdmin(UserAdmin): > inlines = [UserProfileInline] > > admin.site.register(User, UserProfileAdmin) > > Any ideas what I might be missing? --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Where are the admin app icons from?
The icons : site-packages\django\contrib\admin\media\img\admin :) On Jul 25, 1:46 pm, Margie wrote: > Thanks Alex - I will check those out. But if anyone knows where the > admin icons came from, I'd still love to know ... > > Margie > > On Jul 24, 4:01 pm, Alex Gaynor wrote: > > > > > On Fri, Jul 24, 2009 at 5:12 PM, Margie wrote: > > > > Hi, > > > > I'm wondering if the icons in the admin app (for example, the > > > addlink.gif icon) come from some standard icon (free) icon package > > > where there are more goodies of the same sort? Anyone have any > > > pointers for where those came from? > > > > Margie > > > I don't know where the Django ones came from (they may have been > > custom designed for all I know), but if you're looking for good free > > icons I'm quite fond of the famfamfam silk icon > > set:http://www.famfamfam.com/lab/icons/silk/ > > > Alex > > > -- > > "I disapprove of what you say, but I will defend to the death your > > right to say it." -- Voltaire > > "The people's good is the highest law." -- Cicero > > "Code can always be simpler than you think, but never as simple as you > > want" -- Me --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: '_CheckLogin' object has no attribute 'objects' ??
Thanks Dan Harris for reply well u gave me a idea the problem was the name of the Model and the Name of the view...problem with the "same name".. Thanks :) On Jul 25, 8:26 pm, Dan Harris wrote: > Looks just like you have an error in your programming, the name of > your view is "Dpatas", then you attempt to later call > "Dpatas.objects.filter()" as if Dpatas was a model. The _CheckLogin is > coming from your use of the @login_required decorator I would imagine. > > Hopefully that helps, > > Dan > > On Jul 25, 8:16 pm, Asinox wrote: > > > > > Hi guys, well.. i dont know what this mean : > > > '_CheckLogin' object has no attribute 'objects' > > > any idea? > > thanks > > > in my views.py > > > from django.shortcuts import render_to_response, get_object_or_404, > > Http404 > > from django.conf.urls.defaults import * > > from django.template import RequestContext > > from django.contrib.auth import authenticate, login, logout > > from django.contrib.auth.decorators import login_required > > > @login_required > > #listar todas las patas > > def Dpatas(request): > > data = Dpata.objects.filter() > > return render_to_response('account/dpatas.html',{'registros': > > data},context_instance = RequestContext(request)) --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
'_CheckLogin' object has no attribute 'objects' ??
Hi guys, well.. i dont know what this mean : '_CheckLogin' object has no attribute 'objects' any idea? thanks in my views.py from django.shortcuts import render_to_response, get_object_or_404, Http404 from django.conf.urls.defaults import * from django.template import RequestContext from django.contrib.auth import authenticate, login, logout from django.contrib.auth.decorators import login_required @login_required #listar todas las patas def Dpatas(request): data = Dpata.objects.filter() return render_to_response('account/dpatas.html',{'registros': data},context_instance = RequestContext(request)) --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Getting data from Django ModelForm ?
Hi guys, i have a problem with ModelForm, the problem is that in the user private area there is a Form (ModelForm), but in this Form i have a Select, this select show the parent articles , so the problem is that the Select show all parent articles, from all users How ill just show the parent articles of the logged user? bcz the Select in the Model is a ForeignKey from another table. There's a method that ill write in the Model or in the ModelForm? sorry with my english --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: problem with milliseconds and mysql database
Thanks for replay Fredecir. Im sorry i fixed, the problem is that im new with Django... and Django make some work for me ...and i was thinking wrong :) if i have a field DateTime defined in my model with auto_add=True, i dont need to render the field hidden or something, bcz Django will send the data automatically :) The best Django Pow jejeje On Jul 25, 9:28 am, Frédéric Hébert wrote: > Hi, > > could you be more explanatory in your question ? > > How do you set your field value ? via a models.DateTimeField ? > > About the example that you 've given : is it the solution or what's > giving the error ? > > I've tried your example and it works fine. > > Try to look for answers in django.db.fields.__init__ in DateTimeField class > > Frédéric > > 2009/7/25 Asinox : > > > > > Hi, guy, i have a problem trying to save "datetime" in mysql. > > > the problem is that mysql dont need milliseconds in the datatime > > field... > > > how ill send datatime in format "2009-12-12 1:25:30" without that > > python and Django say: Enter a valid date/time in -MM-DD HH:MM[:ss > > [.uu]] format ?? > > > Thanks > > --http://www.openidfrance.fr/fhebert --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
problem with milliseconds and mysql database
Hi, guy, i have a problem trying to save "datetime" in mysql. the problem is that mysql dont need milliseconds in the datatime field... how ill send datatime in format "2009-12-12 1:25:30" without that python and Django say: Enter a valid date/time in -MM-DD HH:MM[:ss [.uu]] format ?? Thanks --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
html text field ...disabled in form?
hi, guys, how ill make a html text field with attr disabled? Thanks --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
@login_required() dont work
Hi guys, im trying to use the login and logout functions of Django, but my @login_required() dont work, dont redirecto to the login form and show the view where the user need to be logged... VIEW from django.shortcuts import render_to_response, get_object_or_404, Http404 from django.contrib.auth.decorators import login_required from diligencia.diligencias.models import UserProfile, Diligencia @login_required() def index(request): entradas = Diligencia.objects.all() return render_to_response('account/listar_deligencias.html', {'listar': entradas}) SETTINGS LOGIN_REDIRECT_URL = '/accounts/profile/' LOGIN_URL = '/accounts/login/' What's wrong? Thanks --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django-registration .missing templates?
ok, ...there no exist's :( --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
django-registration .missing templates?
Hi guys, im trying to use the django-registration...im new with django, but i was thinking that maybe some templates are missing, like registration, login... i cant found ..but i dont know if i need to create the templates... Some help? Thanks --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
how add email field to user registration?
Hi guys, im new with Django, i want to know how ill add a email field to the registration form from the User model. thanks --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
how ill generate some code in the django admin (like a tracking number)
hi guys, im new with django, but im developing a website ... i hope that somebody help me with this problem: how ill generate some code in the django admin and show this code in input and save in database? the problem is that i need to generate some code (like a tracking number) when the user send some news or the administrator user's add some news too... how ill generate the code and save in database or show form the database... thanks u --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
New with Python and Django
Hi guy's, im new with Python and Django, well im learning Python using Django... im php user and CodeIgniter Framework, so i want to know something about admin generator... What i need to make a User Panel (user will write article, upload pictures, etc) ? or the samen Admin Generator will help me? Thanks --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Hi, im new with Django
Hi, im Asinox, im a php user , CodeIgniter Framewor user, but i want to test something different to PHP, so why not Python. But i have a litter problem, im using window with WAMP, my python path is : E:\wamp\bin\Python25\, my Django installation is: E:\wamp\bin \Python25\Lib\site-packages\django my htpdocs is e:\wamp\www, ¿how ill run the Django from my htpdocs?, ¿why Django go into "site-package" ?, ¿from where ill run this : django-admin.py ?, so i dont like the framework that first need somet Console command...i love CodeIgniter for this razon. I want to test Django, but im lost with the complicate ambient. In the tutorial "Writing your first Django app, part 1" i saw this command ( import django ), but ¿From where i need to type this command?, because i got error about it, "is not a recognized internal or external command..". and the last one, the tutorial say: "From the command line, cd into a directory where you’d like to store your code, then run the command django-admin.py startproject mysite. This will create a mysite directory in your current directory." ... this command "django- admin.py startproject mysite" dont is recognized too. Some help please, in lost... Thanks --~--~-~--~~~---~--~~ 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 to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---