急
On Oct 17, 2014 9:19 PM, <django-users@googlegroups.com> wrote:

>     django-users@googlegroups.com
> <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!forum/django-users/topics>
>   Google
> Groups
> <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!overview>
> <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!overview>
>   Topic digest
>  View all topics
> <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!forum/django-users/topics>
>
>    -  making an http request internally <#1491e42fd01f080a_group_thread_0>
>    - 3 Updates
>    -  django.views.decorators.http.condition decorator
>    <#1491e42fd01f080a_group_thread_1> - 2 Updates
>    -  Solved: save as new in the Admin with 1:1 inlines causes
>    IntegrityError <#1491e42fd01f080a_group_thread_2> - 1 Update
>    -  OSQA multi language tutorial <#1491e42fd01f080a_group_thread_3> - 1
>    Update
>    -  Django 1.7, KeyError: u'manager' error
>    <#1491e42fd01f080a_group_thread_4> - 2 Updates
>    -  Upgrading Django (to 1.7) <#1491e42fd01f080a_group_thread_5> - 1
>    Update
>    -  how to use __init__ in a form (passing an extra variable to the
>    form) <#1491e42fd01f080a_group_thread_6> - 1 Update
>    -  Unable to store static <#1491e42fd01f080a_group_thread_7> - 2
>    Updates
>    -  How to "automatically " populate "last_updated_by" DB columns with
>    the current user's id <#1491e42fd01f080a_group_thread_8> - 1 Update
>    -  How do I create a simple user view web page to create/add mysql db
>    entries? <#1491e42fd01f080a_group_thread_9> - 2 Updates
>    -  Porting to Django Linux with SQL Server Backend
>    <#1491e42fd01f080a_group_thread_10> - 2 Updates
>
>   making an http request internally
> <http://groups.google.com/group/django-users/t/a8cc43d114ecf26b?utm_source=digest&utm_medium=email>
>   jus...@fanout.io: Oct 16 09:02PM -0700
>
> Hey list,
>
> I am writing a middleware class that needs to be able to make HTTP
> requests
> to the application as part of it's processing. I'd like to be able to do
> this internal to the Django app if possible, rather than having to make
> external requests to the webserver hosting the Django app.
>
> I've discovered that I can use django.core.urlresolvers.resolve to obtain
> a
> view function for a given URL. Awesome! This gets me /very/ close, but I'm
> missing a couple of things:
>
> 1) If I simply call the view function obtained from resolve(), it will be
> executed without middleware. I still want all the usual middleware
> processing to occur though.
>
> 2) I'm not sure how to create a fresh HttpRequest object to use for an
> internal request, so my code awkwardly modifies the request object it was
> provided in order to use it for a subrequest. That doesn't feel quite
> proper.
>
> Any tips here would be great. Thanks!
>
> Justin
>   Erik Cederstrand <erik+li...@cederstrand.dk>: Oct 17 02:11PM +0200
>
> > Den 17/10/2014 kl. 06.02 skrev jus...@fanout.io:
>
> > I am writing a middleware class that needs to be able to make HTTP
> requests to the application as part of it's processing. I'd like to be able
> to do this internal to the Django app if possible, rather than having to
> make external requests to the webserver hosting the Django app.
>
> Maybe you can use the Django test client? I believe it supports the
> functions you need.
> https://docs.djangoproject.com/en/1.7/topics/testing/tools/#the-test-client
>
> Erik
>   Collin Anderson <cmawebs...@gmail.com>: Oct 17 05:56AM -0700
>
>
> > 1) If I simply call the view function obtained from resolve(), it will
> be
> > executed without middleware. I still want all the usual middleware
> > processing to occur though.
>
> Undocumented, unsupported, but this might work:
> from myproject import wsgi
> response = wsgi.application.get_response(request)
>
> or get a fresh handler (slower):
> from django.core.handlers.wsgi import WSGIHandler
> handler = WSGIHandler()
> response = handler.get_response(request)
>
>
> > internal request, so my code awkwardly modifies the request object it
> was
> > provided in order to use it for a subrequest. That doesn't feel quite
> > proper.
>
> I think deepcopying the request and modifying it makes sense here.
> Otherwise, depending on what you need, you'll need to copy the session and
> csrf cookies, and set up things like request.META['HTTP_HOST'] by hand.
>   Back to top <#1491e42fd01f080a_digest_top>
>   django.views.decorators.http.condition decorator
> <http://groups.google.com/group/django-users/t/38babbab9b35a1b4?utm_source=digest&utm_medium=email>
>   Anton Novosyolov <anton.novosyo...@gmail.com>: Oct 16 11:20PM -0700
>
> I have a question about this part:
>
> elif (not if_none_match and request.method == "GET" and res_last_modified
> > and if_modified_since and res_last_modified <= if_modified_since):
> > response = HttpResponseNotModified()
>
>
> If I don't use etag, and request method is HEAD then 200 is returned.
>
> Some sites for checking 304 status (e.g. http://last-modified.com/en/ )
> use
> HEAD for checking.
>   Collin Anderson <cmawebs...@gmail.com>: Oct 17 05:42AM -0700
>
> I'm not an http caching expert, but what you say seems right. Want to open
> a ticket?
>   Back to top <#1491e42fd01f080a_digest_top>
>   Solved: save as new in the Admin with 1:1 inlines causes IntegrityError
> <http://groups.google.com/group/django-users/t/aa9bbdbbffe9ed16?utm_source=digest&utm_medium=email>
>   Mike Dewhirst <mi...@dewhirst.com.au>: Oct 17 11:33PM +1100
>
> I discovered a unicode problem related to the degree symbol (°) when
> running under Python 2.7 and dealt with that. It somehow fixed the
> IntegrityError.
>
> One of those things I guess
>
> AWTEW
>
> Mike
>
> On 15/10/2014 9:40 AM, Mike Dewhirst wrote:
>   Back to top <#1491e42fd01f080a_digest_top>
>   OSQA multi language tutorial
> <http://groups.google.com/group/django-users/t/eb509944af615219?utm_source=digest&utm_medium=email>
>   Pavel Vanchugov <pvanchu...@gmail.com>: Oct 17 04:29AM -0700
>
> Helloevryone. Is there more detailed documentation for achieving multi
> language site on django? I don't even know what this is
> https://docs.djangoproject.com/en/1.4/topics/i18n/ All i can see is that
> django can "multi language" and that's it.
>   Back to top <#1491e42fd01f080a_digest_top>
>   Django 1.7, KeyError: u'manager' error
> <http://groups.google.com/group/django-users/t/c13c80ec09848555?utm_source=digest&utm_medium=email>
>   Taenyon Kim <xos...@gmail.com>: Oct 17 02:23AM -0700
>
> Example
>
> class ModelA(models.Model):
> fielda = models.CharField(max_length=10)
>
> class ModelB(models.Model):
> modela = models.ForeignKey(ModelA)
> fieldb = models.CharField(max_length=10)
>
>
> When I query like "modela_instance.modelb_set()", then I will get
> KeyError:
> u'manager' as shown below:
>
> <
> https://lh6.googleusercontent.com/-sQpoxLasu-c/VEDevTQcTII/AAAAAAAAANI/w9rEdIzap4M/s1600/Screen%2BShot%2B2014-10-17%2Bat%2B%25E1%2584%258B%25E1%2585%25A9%25E1%2584%2592%25E1%2585%25AE%2B6.17.15.png
> >
>
> How can I solve this problem?
>   Sanjay Bhangar <sanjaybhan...@gmail.com>: Oct 17 04:39PM +0530
>
> > fieldb = models.CharField(max_length=10)
>
> > When I query like "modela_instance.modelb_set()", then I will get
> > KeyError: u'manager' as shown below:
>
> AFAIK, you want something like "modela_instance.modelb_set.all()" - just
> modela_instance.modelb_set() is the manager instance that you call call
> methods on (like 'all', 'filter', etc.), but calling the manager directly
> doesn't quite work, as you found out :)
>
> All the best,
> Sanjay
>   Back to top <#1491e42fd01f080a_digest_top>
>   Upgrading Django (to 1.7)
> <http://groups.google.com/group/django-users/t/dc8c5749820b3db6?utm_source=digest&utm_medium=email>
>   Fred Stluka <f...@bristle.com>: Oct 17 04:05AM -0400
>
> Sounds good! Thanks!
>
> --Fred
> ------------------------------------------------------------------------
> Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
> Open Source: Without walls and fences, we need no Windows or Gates.
> ------------------------------------------------------------------------
> On 10/15/14 8:17 PM, Andrew Pinkham wrote:
>   Back to top <#1491e42fd01f080a_digest_top>
>   how to use __init__ in a form (passing an extra variable to the form)
> <http://groups.google.com/group/django-users/t/a3b0330866ad1130?utm_source=digest&utm_medium=email>
>   dk <demi...@gmail.com>: Oct 17 12:36AM -0700
>
> thanks Carl, that was extremely clear, step by step.
>
> took me a little bit to get the self.fields, since I was trying to
> override directly as ratiooo.choices.
> and I move the django.setup() to the top of the file after the imports
> (meantime). not sure what it does, I know that just need to be call before
> any query if not they don't work =(
>
>
> class FormDishes(forms.Form):
> your_email = forms.EmailField(initial="a...@b.com")
> ratiooo = forms.ChoiceField(choices="", widget=forms.RadioSelect(),
> initial=1)
> def __init__(self, *args, **kwargs):
> self.restaurant_id = kwargs.pop("restaurant_id")
> super(FormDishes, self).__init__(*args, **kwargs)
> self.options = self.make_choices()
> self.fields["ratiooo"].choices=self.options
>
> def make_choices(self):
> all = Dish.objects.filter(restaurant_id=self.restaurant_id)
> options_ratio = []
> for i in all:
> options_ratio.append((i.id, i.name))
> return options_ratio
>   Back to top <#1491e42fd01f080a_digest_top>
>   Unable to store static
> <http://groups.google.com/group/django-users/t/1be431bf088bd49a?utm_source=digest&utm_medium=email>
>   Sachin Tiwari <sachin.tiwar...@gmail.com>: Oct 16 09:30PM -0700
>
> Hi All
>
> Thanks for your kind support,
>
> I tried with single quotes <link rel="stylesheet" href="{% static
> 'static/css/bootstrap.min.css' %}" /> but it also did not works,
>
> My static url is
> STATIC_URL = '/static/'
>   Javier Guerra Giraldez <jav...@guerrag.com>: Oct 17 12:30AM -0500
>
> On Thu, Oct 16, 2014 at 4:21 AM, Sachin Tiwari
>
> > STATICFILES_DIRS = (
> > os.path.join(PROJECT_PATH, "static"),
> > )
>
>
> I think you're repeating the 'static' subdirectory name. in the HTML try
>
> <script src="{%static "js/bootstrap.min.js"%}"></script>
>
>
>
> --
> Javier
>   Back to top <#1491e42fd01f080a_digest_top>
>   How to "automatically " populate "last_updated_by" DB columns with the
> current user's id
> <http://groups.google.com/group/django-users/t/75aa384408f1e630?utm_source=digest&utm_medium=email>
>   Mike Dewhirst <mi...@dewhirst.com.au>: Oct 17 10:51AM +1100
>
> +1
>
> Well said Carl.
>
> Ken, if you do "stuff" outside Django it means you need to maintain code
> in more than one place. I was warned against such as a youngster so I
> have never done it but I suspect it will either drive you mad or cost
> you dearly.
>
> For the external updaters, how will you keep their changes when Django
> users are possibly subverting them? And vice versa?
>
> I would suggest you keep everything in the ORM and highly visible.
> Choose the save(self, request.user) method and keep your costs down.
>
> Good luck
>
> Mike
>
> On 17/10/2014 3:12 AM, Carl Meyer wrote:
>   Back to top <#1491e42fd01f080a_digest_top>
>   How do I create a simple user view web page to create/add mysql db
> entries?
> <http://groups.google.com/group/django-users/t/d66be02e9a81dfc9?utm_source=digest&utm_medium=email>
>   Bovine Devine <bovinedev...@gmail.com>: Oct 16 04:32PM -0700
>
> On Thursday, October 16, 2014 2:28:38 PM UTC-7, Collin Anderson wrote:
>
> > class MyModel(models.Model):
> > pub_date = models.DateField(default=timezone.now)
>
> > Collin
>
> Thanks Collin but does this belong in my models.py, views.py or forms.py?
> I already had the following in my models.py:
>
> from django.db import models
> from django.utils import timezone
>
>
> class Hardwareid(models.Model):
> hardwareid_text = models.CharField(max_length=200)
> pub_date = models.DateTimeField('date added')
> def __unicode__(self):
> return self.hardwareid_text
>   Bovine Devine <bovinedev...@gmail.com>: Oct 16 04:47PM -0700
>
> Hmm not sure what happened but I modified my models.py section:
>
> class Hardwareid(models.Model):
> hardwareid_text = models.CharField(max_length=200)
> pub_date = models.DateTimeField('date added')
> def __unicode__(self):
> return self.hardwareid_text
>
> to match what you had recommended:
>
> class Hardwareid(models.Model):
> hardwareid_text = models.CharField(max_length=200)
> pub_date = models.DateField('default=timezone.now)
> def __unicode__(self):
> return self.hardwareid_text
>
> and now it works! I can enter data to submit from that page and it ended
> up
> in my mysql db. Thanks for all your help Collin.
>   Back to top <#1491e42fd01f080a_digest_top>
>   Porting to Django Linux with SQL Server Backend
> <http://groups.google.com/group/django-users/t/586933c769e6ba98?utm_source=digest&utm_medium=email>
>   Kelvin Wong <wongo...@gmail.com>: Oct 16 02:52PM -0700
>
> Your options are limited if you want to connect to a 2012 SQL Server. The
> azure driver is the only one that would work for us and we tested
> everything we could find.
>
> K
>
>
> On Thursday, October 16, 2014 7:50:15 AM UTC-7, robert brook wrote:
>   robert brook <software.by.pyt...@gmail.com>: Oct 16 03:32PM -0700
>
> Thank you for your response.
>
> I saw that you mentioned that you were getting seg faults
>
> I noticed on a web site that there was an entry that might overcome that
> problem
> http://www.kcaran.com/entries/technology/linux/linuxodbc.html
>
> ***************
>
> sing Red Hat, you may get a ‘Segmentation Fault’ using DBI, even though
> connecting to the database works fine with *tsql*. If this happens, try
> setting the following environmental variable: PERL_DL_NONLAZY = 1
> Read this Usenet thread for more details
> <
> http://groups.google.com/group/perl.dbi.users/tree/browse_frm/thread/995131d999ca388/b3d60553c8f87d4d?rnum=1&hl=en&q=redhat+DBI+%22segmentation+fault%22&_done=%2Fgroup%2Fperl.dbi.users%2Fbrowse_frm%2Fthread%2F995131d999ca388%2Fd0fb4863311789f6%3Flnk%3Dst%26q%3Dredhat+DBI+%22segmentation+fault%22%26rnum%3D1%26hl%3Den%26#doc_f937fadc7f1ba28d
> >
>
> *NOTE:* This appears to be fixed.
> https://rhn.redhat.com/errata/RHBA-2006-0319.html
>
> ***************
>
> On Thursday, October 16, 2014 1:18:21 AM UTC-4, WongoBongo wrote:
>   Back to top <#1491e42fd01f080a_digest_top>
>    You received this digest because you're subscribed to updates for this
> group. You can change your settings on the group membership page
> <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!forum/django-users/join>
> .
> To unsubscribe from this group and stop receiving emails from it send an
> email to django-users+unsubscr...@googlegroups.com.
>

-- 
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-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKY1KbX1XJ87Vc04pSNch4wshHwEtnickz6mm-xGBeCSmoHZ-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to