Saturday, June 30, 2012

Re: Handling millions of rows + large bulk processing (now 700+ mil rows)

Great

On Jun 30, 2012 6:10 PM, "Cal Leeming [Simplicity Media Ltd]" <cal.leeming@simplicitymedialtd.co.uk> wrote:
Hi all,

As some of you know, I did a live webcast last year (July 2011) on our LLG project, which explained how we overcome some of the problems associated with large data processing.

After reviewing the video, I found that the sound quality was very poor, the slides weren't very well structured, and some of the information is now out of date (at the time it was 40mil rows, now we're dealing with 700+mil rows).

Therefore, I'm considering doing another live webcast (except this time it'll be recorded+posted the next day, the stream will be available in 1080p, it'll be far better structured, and will only last 50 minutes).

The topics I'd like to cover are:

* Bulk data processing where bulk_insert() is still not viable (we went from 30 rows/sec to 8000 rows/sec on bulk data processing, whilst still using the ORM - no raw sql here!!)
* Applying faux child/parent relationship when standard ORM is too expensive (allows for ORM approach without the cost)
* Applying faux ORM read-only structure to legacy applications (allows ORM usage on schemas that weren't properly designed, and cannot be changed - for example, vendor software with no source code).
* New Relic is beautiful, but expensive. Hear more about our plans to make an open source version.
* Appropriate use cases for IAAS vs colo with SSDs.
* Percona is amazing, some of the tips/tricks we've learned over.

If you'd like to see this happen, please leave a reply in the thread - if enough people want this, then we'll do public vote for the scheduled date.

Cheers

Cal

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Handling millions of rows + large bulk processing (now 700+ mil rows)

+1

On 1 July 2012 10:40, Setiaman Lee <setiaman.lee@gmail.com> wrote:

Hi Cal,
Interesting topic. Count me in.

On Jun 30, 2012 11:10 PM, "Cal Leeming [Simplicity Media Ltd]" <cal.leeming@simplicitymedialtd.co.uk> wrote:
Hi all,

As some of you know, I did a live webcast last year (July 2011) on our LLG project, which explained how we overcome some of the problems associated with large data processing.

After reviewing the video, I found that the sound quality was very poor, the slides weren't very well structured, and some of the information is now out of date (at the time it was 40mil rows, now we're dealing with 700+mil rows).

Therefore, I'm considering doing another live webcast (except this time it'll be recorded+posted the next day, the stream will be available in 1080p, it'll be far better structured, and will only last 50 minutes).

The topics I'd like to cover are:

* Bulk data processing where bulk_insert() is still not viable (we went from 30 rows/sec to 8000 rows/sec on bulk data processing, whilst still using the ORM - no raw sql here!!)
* Applying faux child/parent relationship when standard ORM is too expensive (allows for ORM approach without the cost)
* Applying faux ORM read-only structure to legacy applications (allows ORM usage on schemas that weren't properly designed, and cannot be changed - for example, vendor software with no source code).
* New Relic is beautiful, but expensive. Hear more about our plans to make an open source version.
* Appropriate use cases for IAAS vs colo with SSDs.
* Percona is amazing, some of the tips/tricks we've learned over.

If you'd like to see this happen, please leave a reply in the thread - if enough people want this, then we'll do public vote for the scheduled date.

Cheers

Cal

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: advantages and disadvantages of Raw sql queries in django

On 01/07/2012 06:25 πμ, Javier Guerra Giraldez wrote:
> <snip>
> in short: an application model is _not_ an OOP view of the database;
> it's the implementation of the conceptual data objects as handled by
> the application.
>
>

All right, I see the advantages. Nice technique.
Thanks a lot.

--
--------------------------------------------------------------
Nick Apostolakis
e-mail: nickapos@oncrete.gr
Web Site: http://nick.oncrete.gr
--------------------------------------------------------------


--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: SimpleListFilter filter UserProfile

In the filter, you are trying the filter User objects on timestamp field which does not exist.

In line 42 of admin.py, try filtering on "userprofile__timestamp__gte"

-Sandeep

On Thursday, June 28, 2012 1:20:03 PM UTC+5:30, yillkid wrote:
Hi all !

I want filter a field of UserProfile (field name: timestamp),

models.py:   http://dpaste.com/764723/

admin.py:   http://dpaste.com/764724/

But when I press the filter, browser show:   http://dpaste.com/764725/

--- --- --- --- --- --- --- --- --- ---

According the error message, I can get class "UserProfile",
but if I want to  filter timestamp, how should I do ?

thx :-)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/RqU1cpZr3CAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Handling millions of rows + large bulk processing (now 700+ mil rows)

Count me in please.



On Saturday, June 30, 2012 8:40:27 PM UTC+5:30, Cal Leeming [Simplicity Media Ltd] wrote:
Hi all,

As some of you know, I did a live webcast last year (July 2011) on our LLG project, which explained how we overcome some of the problems associated with large data processing.

After reviewing the video, I found that the sound quality was very poor, the slides weren't very well structured, and some of the information is now out of date (at the time it was 40mil rows, now we're dealing with 700+mil rows).

Therefore, I'm considering doing another live webcast (except this time it'll be recorded+posted the next day, the stream will be available in 1080p, it'll be far better structured, and will only last 50 minutes).

The topics I'd like to cover are:

* Bulk data processing where bulk_insert() is still not viable (we went from 30 rows/sec to 8000 rows/sec on bulk data processing, whilst still using the ORM - no raw sql here!!)
* Applying faux child/parent relationship when standard ORM is too expensive (allows for ORM approach without the cost)
* Applying faux ORM read-only structure to legacy applications (allows ORM usage on schemas that weren't properly designed, and cannot be changed - for example, vendor software with no source code).
* New Relic is beautiful, but expensive. Hear more about our plans to make an open source version.
* Appropriate use cases for IAAS vs colo with SSDs.
* Percona is amazing, some of the tips/tricks we've learned over.

If you'd like to see this happen, please leave a reply in the thread - if enough people want this, then we'll do public vote for the scheduled date.

Cheers

Cal

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Dp3MO3-Qh6UJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Management form in Model Formsets

Hi,

I am using Django 1.2 and developing using Model formsets. Using JavaScript, I am allowing the user to dynamically "Add another" formset on the template, but I can't figure out what exactly I have to modify in the management forms, for all the formsets to be successfully saved.

The documentation points out to three properties in the management form - form-TOTAL_FORMS, form-INITIAL_FORMS and form-MAX_NUM_FORMS. But I don't understand, which properties I have to exactly modify and how, when a new formset is being added dynamically using JavaScript ?

Thanks :)

Regards,
Samar

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Ecs6EVDku_YJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: i want to display a student profile from the database and am unable to do that.plz help

hii..thanks for your concern friend....i did not able to get your point......can you please tell this in little more brief....actually i want to enter the roll number from the user and then that number could filter the data from the database and display the whole profile of the student..

On Sun, Jul 1, 2012 at 1:12 AM, Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote:
On Sat, 30 Jun 2012 11:54:35 -0700 (PDT), rick
<manishgirdhar88@gmail.com> declaimed the following in
gmane.comp.python.django.user:

>
> this is my views.py.
>
> def studentid(request):
>     if request.method == 'POST':
>         form = Student_loginForm(request.POST)
>         if form.is_valid():
>             cd = form.cleaned_data
>             rollno = cd['rollno']
>             p = form.save()
>         rollno = request.POST.get('rollno')
>         rollno=int(rollno)
>         results = Add_record.objects.filter(Student_ID=rollno)
>         return HttpResponseRedirect(reverse('record_system.views.search',
> args=(results)))

        Note: if args is supposed to be a tuple, you need to include a
trailing ,

                args = (results, )

        Otherwise, each item (if there are more than one) in results is
being treated as a separate positional argument.

        Other than that minor syntactic nit, one may need to see
"Add_record"...

        Also, what is the expected behavior if .is_valid() comes back false?

        As coded, regardless of the .is_valid() return, you appear to fetch
"rollno" from the request object (replacing any value saved from the
clean data branch).
--
        Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: advantages and disadvantages of Raw sql queries in django

On Sat, Jun 30, 2012 at 5:26 PM, Nick Apostolakis <nickapos@oncrete.gr> wrote:
> Interesting idea, I haven't used that yet, could you give an example of
> that?
> Would you use a method calling the ORM that would include something like
> self.objects.select_related().bla bla?

for example: when modelling the requested/accepted/rejected of a
'friendship' relation between 'person' records, you have to design the
exact DB representation, but later on you might want to modify that
representation. Ideally, such changes shouldn't impact _all_ your
code.

specifically: my Person model has a ManyToManyField to 'self' called
'friends', where the intermediate table ('Friendship' model) has a
'state' field. These are implementation details, so i added some
methods to get the list of friends, list of unanswered requests sent,
received, and rejections sent and received:

def get_friends(self):
return self.friends.filter(as_B__state=Friendship.ACCEPTED)

def get_sent_requests_unanswered(self):
return self.friends.filter(as_B__state=Friendship.REQUESTED)

def get_rcvd_requests_unanswered(self):
return self.receivedRequests.filter(as_A__state=Friendship.REQUESTED)

def get_sent_requests_rejected(self):
return self.friends.filter(as_B__state=Friendship.REJECTED)

def get_rcvd_requests_rejected(self):
return self.receivedRequests.filter(as_A__state=Friendship.REJECTED)

as you can see, these queries are readable enough to be used anywhere;
but if later on i want to replace the single 'friends' link field with
several independent relationships, i don't have to search through all
my code, just the models.py

similarly, there are methods to send a request and to accept or reject
it. Again, the code is simple enough that it could be used directly;
but encapsulating it with the Person model makes it easy to maintain
consistency:

for example, the friendship request method:

def send_friend_request(self, target):
try:
f = Friendship.objects.get(personA=self, personB=target)
return f in (Friendship.REQUESTED, Friendship.ACCEPTED)
except Friendship.DoesNotExist:
Friendship.objects.create(
personA=self, personB=target,
state=Friendship.REQUESTED)
return True

doesn't allow a second request if one is already pending or rejected.
if later on this policy is changed (maybe a rejector could change
mind, or an old request could expire, etc), i know where to do the
changes.

also, this lets the views be _really_ thin. since the interface
presented by the models is really close to the conceptual data objects
presented to the users. After that, adding for example a REST layer
isn't hard; since it only has to use the same high-level methods as
the HTML views. again, consistency is guaranteed by the common
underlying implementation.

in short: an application model is _not_ an OOP view of the database;
it's the implementation of the conceptual data objects as handled by
the application.

--
Javier

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Optimistic Locking in Django?

If you read over the linked discussion it's quite possible, just an issue of how disruptive it would be to the ORM APIs.

On Saturday, June 30, 2012, Dennis Lee Bieber wrote:
On Sat, 30 Jun 2012 15:24:59 -0700 (PDT), ydjango <neerashish@gmail.com>
declaimed the following in gmane.comp.python.django.user:

>
> I did google search on "optimistic locking". Most discussion are very old.
>
> Has Django added any features to support it or what are folks generally
> doing?

       Since the locking relies upon the database engine itself, Django
probably can't do anything for it -- it would require the front-end to
know about features of the engine, and that could be a significant
impact if one changes the engine later (not to mention the overhead of
looking up some feature list for each engine so it can execute different
code based on what type of locking is available).
--
       Wulfraed                 Dennis Lee Bieber         AF6VN
       wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



--
--
Steven

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Optimistic Locking in Django?

On Sat, 30 Jun 2012 15:24:59 -0700 (PDT), ydjango <neerashish@gmail.com>
declaimed the following in gmane.comp.python.django.user:

>
> I did google search on "optimistic locking". Most discussion are very old.
>
> Has Django added any features to support it or what are folks generally
> doing?

Since the locking relies upon the database engine itself, Django
probably can't do anything for it -- it would require the front-end to
know about features of the engine, and that could be a significant
impact if one changes the engine later (not to mention the overhead of
looking up some feature list for each engine so it can execute different
code based on what type of locking is available).
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Optimistic Locking in Django?

I started looking into it a while back: https://code.djangoproject.com/ticket/16549

The work broke down into ensuring that the updated/deleted/matched counts were returned from the internal ORM objects. Then there was a fair amount of discussion of what the public API of the ORM could provide on top of that. It's kind of died out a bit, I'd like to get back to it and rekindle the discussion when I can find some time.
--
Steven


On Sat, Jun 30, 2012 at 5:24 PM, ydjango <neerashish@gmail.com> wrote:

I did google search on "optimistic locking". Most discussion are very old.

Has Django added any features to support it or what are folks generally doing?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/oaykVwXK58wJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Query with GeoDjango

On Sat, Jun 30, 2012 at 8:31 PM, Odagi <fcmiranda@gmail.com> wrote:
It's working! Thanks a lot. 
Is There a problem with mixing regular models fields with geomodels ones?

No, there's no problem, as long as you remember to use a GeoManager on every model that ever does geospatial queries (whether or not it has any geospatial fields itself)

-Ethan

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re:Handling millions of rows + large bulk processing (now 700+ mil rows)

Hi Cal,
Interesting topic. Count me in.

On Jun 30, 2012 11:10 PM, "Cal Leeming [Simplicity Media Ltd]" <cal.leeming@simplicitymedialtd.co.uk> wrote:
Hi all,

As some of you know, I did a live webcast last year (July 2011) on our LLG project, which explained how we overcome some of the problems associated with large data processing.

After reviewing the video, I found that the sound quality was very poor, the slides weren't very well structured, and some of the information is now out of date (at the time it was 40mil rows, now we're dealing with 700+mil rows).

Therefore, I'm considering doing another live webcast (except this time it'll be recorded+posted the next day, the stream will be available in 1080p, it'll be far better structured, and will only last 50 minutes).

The topics I'd like to cover are:

* Bulk data processing where bulk_insert() is still not viable (we went from 30 rows/sec to 8000 rows/sec on bulk data processing, whilst still using the ORM - no raw sql here!!)
* Applying faux child/parent relationship when standard ORM is too expensive (allows for ORM approach without the cost)
* Applying faux ORM read-only structure to legacy applications (allows ORM usage on schemas that weren't properly designed, and cannot be changed - for example, vendor software with no source code).
* New Relic is beautiful, but expensive. Hear more about our plans to make an open source version.
* Appropriate use cases for IAAS vs colo with SSDs.
* Percona is amazing, some of the tips/tricks we've learned over.

If you'd like to see this happen, please leave a reply in the thread - if enough people want this, then we'll do public vote for the scheduled date.

Cheers

Cal

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Handling millions of rows + large bulk processing (now 700+ mil rows)

El 30/06/12 17:10, Cal Leeming [Simplicity Media Ltd] escribió:
> Hi all,
>
> As some of you know, I did a live webcast last year (July 2011) on our
> LLG project, which explained how we overcome some of the problems
> associated with large data processing.
>
> After reviewing the video, I found that the sound quality was very
> poor, the slides weren't very well structured, and some of the
> information is now out of date (at the time it was 40mil rows, now
> we're dealing with 700+mil rows).
>
> Therefore, I'm considering doing another live webcast (except this
> time it'll be recorded+posted the next day, the stream will be
> available in 1080p, it'll be far better structured, and will only last
> 50 minutes).
>
> The topics I'd like to cover are:
>
> * Bulk data processing where bulk_insert() is still not viable (we
> went from 30 rows/sec to 8000 rows/sec on bulk data processing, whilst
> still using the ORM - no raw sql here!!)
> * Applying faux child/parent relationship when standard ORM is too
> expensive (allows for ORM approach without the cost)
> * Applying faux ORM read-only structure to legacy applications (allows
> ORM usage on schemas that weren't properly designed, and cannot be
> changed - for example, vendor software with no source code).
> * New Relic is beautiful, but expensive. Hear more about our plans to
> make an open source version.
> * Appropriate use cases for IAAS vs colo with SSDs.
> * Percona is amazing, some of the tips/tricks we've learned over.
>
> If you'd like to see this happen, please leave a reply in the thread -
> if enough people want this, then we'll do public vote for the
> scheduled date.
>
> Cheers
>
> Cal
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
That would be great!

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Query with GeoDjango

It's working! Thanks a lot. 
Is There a problem with mixing regular models fields with geomodels ones?



But, you need to use a `objects = GeoManager()` on the Restaurants model (as well as the Place model) per the docs: https://docs.djangoproject.com/en/dev/ref/contrib/gis/model-api/#django.contrib.gis.db.models.GeoManager

 -Ethan

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/4FdC-Q1mfuUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Query with GeoDjango

On Sat, Jun 30, 2012 at 8:19 PM, Nikolas Stevenson-Molnar <nik.molnar@consbio.org> wrote:
Try a double underscore between distance and lte.


But, you need to use a `objects = GeoManager()` on the Restaurants model (as well as the Place model) per the docs: https://docs.djangoproject.com/en/dev/ref/contrib/gis/model-api/#django.contrib.gis.db.models.GeoManager

 -Ethan


_Nik

On 6/30/2012 5:18 PM, Odagi wrote:
> Hello all. I'm wondering how to resolve this problem with a
> GeoDjango.This are my models:
>
>
> from django.db import models
> from django.contrib.gis.db import models as geomodels
> from django.contrib.gis.geos import Point
> from django.contrib.gis.measure import D
>
> class Place(geomodels.Model):
>     name = models.CharField(max_length=50)
>     point = geomodels.PointField(null=True)
>     objects = geomodels.GeoManager()
>
>     def __unicode__(self):
>         return u"%s the place" % self.name
>
>
> class Restaurant(models.Model):
>     place = models.OneToOneField(Place, primary_key=True)
>     serves_hot_dogs = models.BooleanField()
>     serves_pizza = models.BooleanField()
>
>     def __unicode__(self):
>         return u"%s the restaurant" % self.place.name
>
>
>
> How can I get all Restaurants that serve pizza in a radio of 45km of a
> given (geolocation) point?
> I'm trying something like:
>
> pnt = Point(-34.5875015259, -58.6725006104)
> Restaurant.objects.all().filter(place__point__distance_lte=(pnt,
> D(km=45)))
>
> But it's not working:
> Join on field 'point' not permitted. Did you misspell 'distance_lte' for the lookup type?
>
> Any ideas?
> Thanks in advance.
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/eGmII8v1GMMJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.


--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Query with GeoDjango

Try a double underscore between distance and lte.

_Nik

On 6/30/2012 5:18 PM, Odagi wrote:
> Hello all. I'm wondering how to resolve this problem with a
> GeoDjango.This are my models:
>
>
> from django.db import models
> from django.contrib.gis.db import models as geomodels
> from django.contrib.gis.geos import Point
> from django.contrib.gis.measure import D
>
> class Place(geomodels.Model):
> name = models.CharField(max_length=50)
> point = geomodels.PointField(null=True)
> objects = geomodels.GeoManager()
>
> def __unicode__(self):
> return u"%s the place" % self.name
>
>
> class Restaurant(models.Model):
> place = models.OneToOneField(Place, primary_key=True)
> serves_hot_dogs = models.BooleanField()
> serves_pizza = models.BooleanField()
>
> def __unicode__(self):
> return u"%s the restaurant" % self.place.name
>
>
>
> How can I get all Restaurants that serve pizza in a radio of 45km of a
> given (geolocation) point?
> I'm trying something like:
>
> pnt = Point(-34.5875015259, -58.6725006104)
> Restaurant.objects.all().filter(place__point__distance_lte=(pnt,
> D(km=45)))
>
> But it's not working:
> Join on field 'point' not permitted. Did you misspell 'distance_lte' for the lookup type?
>
> Any ideas?
> Thanks in advance.
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/eGmII8v1GMMJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.


--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Query with GeoDjango

Hello all. I'm wondering how to resolve this problem with a GeoDjango.This are my models:


from django.db import models
from django.contrib.gis.db import models as geomodels
from django.contrib.gis.geos import Point
from django.contrib.gis.measure import D

class Place(geomodels.Model):
    name = models.CharField(max_length=50)
    point = geomodels.PointField(null=True)
    objects = geomodels.GeoManager()

    def __unicode__(self):
        return u"%s the place" % self.name


class Restaurant(models.Model):
    place = models.OneToOneField(Place, primary_key=True)
    serves_hot_dogs = models.BooleanField()
    serves_pizza = models.BooleanField()

    def __unicode__(self):
        return u"%s the restaurant" % self.place.name

    

How can I get all Restaurants that serve pizza in a radio of 45km of a given (geolocation) point?
I'm trying something like:

pnt = Point(-34.5875015259, -58.6725006104)
Restaurant.objects.all().filter(place__point__distance_lte=(pnt, D(km=45)))

But it's not working:
Join on field 'point' not permitted. Did you misspell 'distance_lte' for the lookup type?

Any ideas?
Thanks in advance.




--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/eGmII8v1GMMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: advantages and disadvantages of Raw sql queries in django

On 30/06/2012 10:58 μμ, Javier Guerra Giraldez wrote:
>
> Even when using the ORM, any complex query is a good candidate to be
> encapsulated as part of the model. Ideally, the model should expose a
> high level view of your data objects, not simply an easy to use view
> of the database.
>
>

Interesting idea, I haven't used that yet, could you give an example of
that?
Would you use a method calling the ORM that would include something like
self.objects.select_related().bla bla?

Thanks

--
--------------------------------------------------------------
Nick Apostolakis
e-mail: nickapos@oncrete.gr
Web Site: http://nick.oncrete.gr
--------------------------------------------------------------


--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Optimistic Locking in Django?


I did google search on "optimistic locking". Most discussion are very old.

Has Django added any features to support it or what are folks generally doing?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/oaykVwXK58wJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: advantages and disadvantages of Raw sql queries in django

On Sat, Jun 30, 2012 at 1:33 AM, Mike Dewhirst <miked@dewhirst.com.au> wrote:
> I firmly believe in using the ORM for everything until i am forced to use
> handwritten SQL.

absolutely agree


> I could also argue against custom SQL because it contains business logic and
> i prefer to keep that all in one place, ie., in models in python code.

of course, when you have to use SQL, the best place to put it is in
the models file, either on the model itself or on a custom manager.
That way, if/when you modify the database representation, you don't
have to change other parts of the code.

Even when using the ORM, any complex query is a good candidate to be
encapsulated as part of the model. Ideally, the model should expose a
high level view of your data objects, not simply an easy to use view
of the database.

--
Javier

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: i want to display a student profile from the database and am unable to do that.plz help

On Sat, 30 Jun 2012 11:54:35 -0700 (PDT), rick
<manishgirdhar88@gmail.com> declaimed the following in
gmane.comp.python.django.user:

>
> this is my views.py.
>
> def studentid(request):
> if request.method == 'POST':
> form = Student_loginForm(request.POST)
> if form.is_valid():
> cd = form.cleaned_data
> rollno = cd['rollno']
> p = form.save()
> rollno = request.POST.get('rollno')
> rollno=int(rollno)
> results = Add_record.objects.filter(Student_ID=rollno)
> return HttpResponseRedirect(reverse('record_system.views.search',
> args=(results)))

Note: if args is supposed to be a tuple, you need to include a
trailing ,

args = (results, )

Otherwise, each item (if there are more than one) in results is
being treated as a separate positional argument.

Other than that minor syntactic nit, one may need to see
"Add_record"...

Also, what is the expected behavior if .is_valid() comes back false?

As coded, regardless of the .is_valid() return, you appear to fetch
"rollno" from the request object (replacing any value saved from the
clean data branch).
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

i want to display a student profile from the database and am unable to do that.plz help


this is my views.py.

def studentid(request):
    if request.method == 'POST':
        form = Student_loginForm(request.POST)
        if form.is_valid():
            cd = form.cleaned_data
            rollno = cd['rollno']
            p = form.save()
        rollno = request.POST.get('rollno')
        rollno=int(rollno)
        results = Add_record.objects.filter(Student_ID=rollno)
        return HttpResponseRedirect(reverse('record_system.views.search', args=(results)))


def search(request,Student_ID ):
    p = get_object_or_404(Add_record, pk=Student_ID)
    p.save()
    return render_to_response('add_record/search.html', locals(), context_instance=RequestContext(request))


and am getting error on browser that

NoReverseMatch at /record_system/studentid/

Reverse for 'record_system.views.search' with arguments '(<Add_record: Add_record object>,)' and keyword arguments '{}' not found.


thanks in advance..

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/UwDmhLfnsyUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: settings and constants on a reusable app

Support an additional variable MY_APP_USE_OTHER_CONSTANT (MY and
MY_APP, are, I hope, not the prefixes you are actually using), which
defaults to False and which the project settings file can override to
True.

On Fri, Jun 29, 2012 at 9:06 AM, Marc Aymerich <glicerinu@gmail.com> wrote:
> On Fri, Jun 29, 2012 at 11:08 AM, Thomas Rega <tr@pyt3ch.com> wrote:
>> Am 28.06.12 17:30, schrieb Marc Aymerich:
>>
>>> Hi,
>>> I'm developing a reusable application and I'm having troubles with
>>> constant values on settings.
>>>
>>> Imagine that the reusable application comes with the following settings.py
>>>
>>> # MY_APP/settings.py
>>> from django.conf import settings
>>> MY_CONSTANT = 'C1'
>>> MY_OTHER_CONSTANT = 'C2'
>>> MY_SETTING = getattr(settings, 'MY_SETTING', CONSTANT)
>>>
>>>
>>> But for your project you want to override the default value of
>>> MY_SETTING by MY_OTHER_CONSTANT. So you edit your project settings.py
>>> and adds these two lines:
>>>
>>> # Project settings.py
>>> ....
>>> from MY_APP.settings import settings as my_app_settings
>>> MY_SETTING = my_app_settings.MY_OTHER_SETTING
>>>
>>>
>>> But this is going to fail because of the import order.
>>>
>>> Is there any consistent way to handle this situation?
>>>
>>> Thanks!
>>
>> Hi,
>>
>> what about the idea to overwrite these values via a 'local_settings.py'
>> file?
>>
>> An example can be found here:
>> https://bitbucket.org/chris1610/satchmo/src/1255b19295c7/satchmo/projects/skeleton/settings.py
>
> Hi thomas, thanks :)
>
> Yeah, actually I'm using a local_settings.py file, but at the end it
> will be the same as using settings.py since local_settings.py is
> imported by settings.py. :(
>
>
> --
> Marc
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: javascript in django template not executed when request is sent via ajax

On Sat, Jun 30, 2012 at 11:54 AM, Psamathos <peter.murawski@gmail.com> wrote:
> If your web server is in fact serving the content with the incorrect
> Content-Type header (You can verify this by inspecting the response in the
> Net tab of Firebug or Chrome) jQuery can convert the response regardless of
> the content-type if you specify a two space-separated values in your
> dataType. Try dataType: "text html" in your $.ajax function.

I've been poking around with the debugger. For reference, here's the code:

var $form = $('form.roll');
url = $form.attr('action');

var $report = $('#report');

$.ajax({
url: url,
data: $form.serialize(),
dataType: 'html',
success: function (html, textStatus) {
$report
.html($('#report', html).html())
.css({
opacity: 1.0
});
style_preview_table();
}


The html variable passed into the success function contains the entire
page, including the javascript. I tried doing:

$report.html(html)

But the parts of the page that were not the results (i.e. #report) all
were duplicated (the page was displayed within the page). But even
there, the javascript wasn't included in the page, even though is was
in the html variable.

$('#report', html).html() contained just the html, without the
javascript. What I need is some way to get both the javascript and the
html of $('#report') and then pass that into $report.html(). Are there
javascript or jQuery methods that will allow me to do that?

Alternatively I could extract the javascript from the html variable
passed into the success function. But then how would I make that part
of $report.html()?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: javascript in django template not executed when request is sent via ajax

curl (or its windows equivalents) will tell you exactly what django sent, as
would poking around from a suitably placed pdb.set_trace()

On Fri, Jun 29, 2012 at 8:42 PM, Larry Martell <larry.martell@gmail.com> wrote:
> On Fri, Jun 29, 2012 at 4:54 PM, Jani Tiainen <redetin@gmail.com> wrote:
>> I meant that if for some reason Django sends incorrect content type from a
>> view or something like that your javascript framework might guess
>> incorrectly your ajax request content type and not parse script tags.
>
> Is there a way I can test to see if this is occurring?
>
>
>>
>>
>> On Sat, Jun 30, 2012 at 1:51 AM, Jani Tiainen <redetin@gmail.com> wrote:
>>>
>>> It's known limitation of your ajax request and has nothing to do with
>>> Django nor templates. Or well it might do.
>>>
>>> Most of the javascript frameworks can extract script and inject it
>>> correctly to current DOM. Since you mention jquery I guess that you're using
>>> that for ajax queries so make sure that your $.ajax() has dataType attribute
>>> to set as 'html'. It should (according to docs) parse script parts
>>> correctly.
>>>
>>>
>>> On Fri, Jun 29, 2012 at 11:45 PM, Larry Martell <larry.martell@gmail.com>
>>> wrote:
>>>>
>>>> I have a django template that has some javascript/jQuery code in it
>>>> that defines some keyup event handers. If a user goes to the URL
>>>> directly the javascript is executed, and the event handers all work
>>>> fine. There is also a field that they can type in that triggers the
>>>> same URL request to be sent via ajax. When they do this, it seems that
>>>> the html is rendered, but the javascript is not executed. I discovered
>>>> this by noticing that the page was rendered, but none of the
>>>> javascript event handers were being called. I proved this by adding:
>>>>
>>>>
>>>> <script type="text/javascript">
>>>> alert('here we are');
>>>> </script>
>>>>
>>>> to the template, and the alert doesn't show when the request comes
>>>> from ajax. But if I go to the URL directly it does.
>>>>
>>>> Is this a known issue? Is there some way I can get my javascript code
>>>> to run to install my event handlers when the request comes from ajax?
>>>>
>>>> TIA!
>>>> -larry
>>>>
>>>> --
>>>> 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+unsubscribe@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/django-users?hl=en.
>>>>
>>>
>>>
>>>
>>> --
>>> Jani Tiainen
>>>
>>> - Well planned is half done, and a half done has been sufficient before...
>>>
>>
>>
>>
>> --
>> Jani Tiainen
>>
>> - Well planned is half done, and a half done has been sufficient before...
>>
>> --
>> 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+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: javascript in django template not executed when request is sent via ajax

If your web server is in fact serving the content with the incorrect Content-Type header (You can verify this by inspecting the response in the Net tab of Firebug or Chrome) jQuery can convert the response regardless of the content-type if you specify a two space-separated values in your dataType. Try dataType: "text html" in your $.ajax function.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/XB_Q1y7lXlQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: adding fields into another apps forms (in plugin style)

I think he wants to load the plugins in a dynamic way. If you look how the admin package of django works you will have the answer:

The class AdminSite has a method register, which adds a model, on which the site builds itself. So each plugin can register its own admin stuff in a admin module.

Your task is to write your own class that registers plugins and to make a global instance of it.

Am Mittwoch, 19. Januar 2011 15:38:07 UTC+1 schrieb Shawn Milochik:
You can just subclass the form or modelform.

Shawn

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/tkvtGsvvXm8J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: invalid keyword argument for this function

Yes its different.I was trying to say i tried your way and get rid of that error.

Thanks

On Sat, Jun 30, 2012 at 8:56 PM, Sunny Nanda <snanda85@gmail.com> wrote:
This is a different error, and I don't see anything in the code snippet that might have caused this error (except if you are doing something in the Event model's save method)

You would need to debug it further, and pinpoint the location of this error.


On Saturday, June 30, 2012 8:37:34 PM UTC+5:30, Nikhil Verma wrote:
Yes its with the braces ")" also.

On Sat, Jun 30, 2012 at 8:36 PM, Nikhil Verma <varma.nikhil22@gmail.com> wrote:
Hi Sunny

I am trying with this

            event_genre = event_form.cleaned_data['event_genre']
            event_public = event_form.cleaned_data['event_public']
            event_obj.save()

            category_obj.event_genre.add(event_genre),
      category_obj.event_public.add(event_public



and getting this traceback:-


Exception Type: TypeError at /event/createevent/
Exception Value: int() argument must be a string or a number, not 'QuerySet'


On Sat, Jun 30, 2012 at 8:30 PM, Sunny Nanda  wrote:

Hi Nikhil,

Just to reiterate :), you need to remove both event_public & even_genre while creating the instance of the model, since both of them are M2M Fields. Take a look at the example in my previous mail.

If you are getting this exception somewhere else, please send that code snippet so we might able to see the problem.

Thanks,
Sandeep


On Saturday, June 30, 2012 8:14:28 PM UTC+5:30, Nikhil Verma wrote:
Hi Sunny

I realized that earlier sunny, and cleared that defect but i get stuck into this error

Traceback:

Exception Type: TypeError at /event/createevent/
Exception Value: 'event_genre' is an invalid keyword argument for this function

Any help ?

Thanks in advance


On Sat, Jun 30, 2012 at 7:08 PM, Sunny Nanda  wrote:

Hi Nikhil,

You can not use an object's M2M field until it has been saved to the db.
So, you would have to call the "save" method on the instance, or use "create" method to create the instance.
            category_obj = Category.objects.create(
                            type = categoryform.cleaned_data['type']
                            )
            event_public = categoryform.cleaned_data['event_public']
            event_genre = categoryform.cleaned_data['event_genre']
            category_obj.event_genre.add(event_genre),
            category_obj.event_public.add(event_public),
            # No need to call save here
            # category_obj.save() 

The reason behind this is that M2M Fields are represented by intermediate tables with references to the two linked objects. If you need to add a row in it, both referenced objects should already be saved in the db with valid primary keys.

H2H
-Sandeep


On Saturday, June 30, 2012 1:21:30 PM UTC+5:30, Nikhil Verma wrote:
Hi All

I have the following models like this :-


class EventGenre(models.Model):
    genre_choices = models.CharField(max_length=255)
   
    def __unicode__(self):
        return self.genre_choices
   
class EventPublic(models.Model):
    choicelist = models.CharField(max_length=255)
  
    def __unicode__(self):
        return self.choicelist

class Category(models.Model):
    """
    Describes the Event Category
    """
   
    type = models.CharField(max_length=20,\
                                  choices=EVENT_TYPE,\
                                  help_text = "type of event"
                                  )
    # Genre of event like classical,rock,pop ,indie etc
    event_genre = models.ManyToManyField(EventGenre)
   
    # audience for this event like adults ,children etc
    event_public = models.ManyToManyField(EventPublic)
   
    def __unicode__(self):
        return self.type

This is my category form

class CategoryForm(forms.Form):
    type = forms.CharField(max_length=80, \
                           widget=RadioSelect(choices=EVENT_TYPE)
                           )
    event_genre = forms.ModelMultipleChoiceField(
                        queryset = EventGenre.objects.all(),
                        widget=CheckboxSelectMultiple,
                        required=False
                        )
    event_public = forms.ModelMultipleChoiceField(
                        queryset = EventPublic.objects.all(),                         
                        widget=CheckboxSelectMultiple,
                        required=False
                        )

This is my views.py

def eventcreation(request):
    if request.method == "POST":
        event_form = EventForm(request.POST,request.FILES,prefix="eventform")
        categoryform = CategoryForm(request.POST)
        if event_form.is_valid():
            event_obj = Event(
            venue_name = event_form.cleaned_data['venue_name'],
            date_created = event_form.cleaned_data['event_start_date'],
            date_completed = event_form.cleaned_data['event_end_date'],
            event_ticket_price = event_form.cleaned_data['event_ticket_price'],
            eventwebsite = event_form.cleaned_data['eventwebsite'],
            keyword = event_form.cleaned_data['keyword'],
            description = event_form.cleaned_data['description'],
            status = event_form.cleaned_data['status'],
            event_poster = event_form.cleaned_data['event_poster']
            )
        if categoryform.is_valid():
            category_obj = Category(
                            type = categoryform.cleaned_data['type'],
                            event_public = categoryform.cleaned_data['event_public'], # It is giving error
                            event_genre = categoryform.cleaned_data['event_genre'],   # It is giving error   
                            )
           
            category_obj.event_genre.add(event_genre),
            category_obj.event_public.add(event_public),
            category_obj.save()
           
           
        else:
            print "Form is getting Invalid"
    else:
      
        event_form = EventForm()
        categoryform = CategoryForm()
    return render_to_response('event/event.html',
                              {
                              'eventform':event_form,
                              'categoryform':categoryform,
                              },
                              context_instance=RequestContext(request)
                              )
           
I am trying to add a ManyToMany Field and gets this traceback :-

Exception Type: TypeError at /event/createevent/
Exception Value: 'event_public' is an invalid keyword argument for this function

Can anybody point out whats going wrong ?

Thanks in advance.


--
Regards
Nikhil Verma
+91-958-273-3156

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/9y6fVygzELMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



--
Regards
Nikhil Verma
+91-958-273-3156

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/zrcm159aC3YJ.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



--
Regards
Nikhil Verma
+91-958-273-3156




--
Regards
Nikhil Verma
+91-958-273-3156

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Ft4a4VmU_sgJ.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



--
Regards
Nikhil Verma
+91-958-273-3156

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Use regular expression to retrieve all image tags from a given content

Why not use html parse lib? BeautifulSoup(http://www.crummy.com/software/BeautifulSoup/) for expample

from BeautifulSoup import BeautifulSoup
soup = BeautifulSoup('put_youp_html_code_as_string')
images = soup.find_all('img')

If you need exactly regular expressions, watch this video: http://www.youtube.com/watch?v=kWyoYtvJpe4

суббота, 30 июня 2012 г., 20:37:13 UTC+8 пользователь mo.mughrabi написал:
Hello, 

am really a noob with regular expressions, I tried to do this on my own but I couldn't understand from the manuals how to approach it. Am trying to find all img tags of a given content, I wrote the below but its returning None

 content = i.content[0].value
            prog
= re.compile(r'^<img')
            result
= prog.match(content)
           
print result

any suggestions?


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/wAd5IjIA8ngJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.