Re: Combining queries? A "join" in Python?
On Aug 30, 6:25 am, Tim wrote: > worst case you could always just write the sql query? > > https://docs.djangoproject.com/en/dev/topics/db/sql/ > I have been looking at that already, what I have not yet figured out is how the results map to models if I do a join in the SQL query. Can it create the models for the joined tables as well? > On Aug 29, 8:15 am, graeme wrote: > > > > > > > > > I looks like my attempt to simplify and abstract the problem just made > > it harder to help me: my apologies for that. I was trying to combined > > two different problems rather than ask two questions. Thanks for > > helping despite that. > > > I think I have a solution for most of my problems, as far as getting > > the queries working. I might be back with questions about > > optimisation, but I can live with a little inefficiency in the query I > > need to get working first. > > > On Aug 28, 4:33 am, Matteius wrote: > > > > Since you are combining two sets of different objects you'll want > > > Gelonida's response. Additionally, Use Q to create more logically > > > advanced queries. I find your language difficult to gather what query > > > you are looking for exactly, but here is an example of what I think > > > you might mean: > > > > from django.db.models import Q > > > > the_Ds = D.objects.all().filter(b=B) > > > the_Es = E.objects.all().filter(c=C) > > > > combined = the_Ds | the_Es > > > > # Other Example (an & requires both constraints to be met, and an Or > > > will include the set of all matches. > > > the_As = A.objects.all().filter(Q(constraint1) & Q(constraint2)) > > > the_Bs = B.objects.all().filter(Q(constraint1) | Q(constraint2)) > > > > -Matteius > > > > Don't overlook how powerful this is because Django has Manager classes > > > so you can make your constraints refer to both local properties and > > > foreign key constraints as well as properties within the foreign key > > > lookups. You may find that you wish to edit your schema relationship, > > > perhaps by pointing backwards or reversing the relationship. It is > > > hard to say with the categorical A, B, C, D example, but hope this > > > helps and Good Luck! > > > > On Aug 27, 3:47 pm, Gelonida N wrote: > > > > > On 08/27/2011 11:39 AM, graeme wrote: > > > > > > I have a some models related link this: > > > > > > A has a foreign key on B which has a foreign key on C > > > > > > I also have D with a foreign key on B, and E with a foreign key of C > > > > > > If I do A.filter(**args).select_related() I will get all the As, Bs, > > > > > and Cs I want. > > > > > > How do I get the Ds with a foreign key on a B in my queryset > > > > > (preferably filtered) and all Es with a foreign key on C (also > > > > > preferably filtered) > > > > > > The best I have been able to come up with is to query for all the the > > > > > Ds and Es I want, and combine them with the Bs and Cs in the view. > > > > > > I have a similar problem with another site, except that there not > > > > > every B I want has an A with a foreignkey pointing to it, so I cannot > > > > > just do select_related on A. > > > > > > I am not worried about doing an extra query or two per page. What I > > > > > want to avoid is doing an extra query for each object in a lengthy > > > > > list. > > > > > You can 'or' two query sets with the '|' operator > > > > > so do > > > > queryset1 = Mymodel.objects.all().filter(...) > > > > qyeryset2 = Mymodel.objects.all().filter(...) > > > > > combined = queryset1 | queryset2 -- 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: [] Re: Combining queries? A "join" in Python?
Yes, you can - but not in models.py! I have created a query.py and defined all models for raw queries in that file. Then I do raw SQL as defined here: https://docs.djangoproject.com/en/dev/topics/db/sql/ But you won't be able to update/insert data using this models. regards H. >reply to message: >date: 30.08.2011 02:02:13 >from: "graeme" >to: "Django users" >subject: [] Re: Combining queries? A "join" in >Python? > > > >On Aug 30, 6:25 am, Tim wrote: >> worst case you could always just write the sql query? >> >> https://docs.djangoproject.com/en/dev/topics/db/sql/ >> > >I have been looking at that already, what I have not yet figured out >is how the results map to models if I do a join in the SQL query. Can >it create the models for the joined tables as well? > >> On Aug 29, 8:15 am, graeme wrote: >> >> >> >> >> >> >> >> > I looks like my attempt to simplify and abstract the problem just made >> > it harder to help me: my apologies for that. I was trying to combined >> > two different problems rather than ask two questions. Thanks for >> > helping despite that. >> >> > I think I have a solution for most of my problems, as far as getting >> > the queries working. I might be back with questions about >> > optimisation, but I can live with a little inefficiency in the query I >> > need to get working first. >> >> > On Aug 28, 4:33 am, Matteius wrote: >> >> > > Since you are combining two sets of different objects you'll want >> > > Gelonida's response. Additionally, Use Q to create more logically >> > > advanced queries. I find your language difficult to gather what query >> > > you are looking for exactly, but here is an example of what I think >> > > you might mean: >> >> > > from django.db.models import Q >> >> > > the_Ds = D.objects.all().filter(b=B) >> > > the_Es = E.objects.all().filter(c=C) >> >> > > combined = the_Ds | the_Es >> >> > > # Other Example (an & requires both constraints to be met, and an Or >> > > will include the set of all matches. >> > > the_As = A.objects.all().filter(Q(constraint1) & Q(constraint2)) >> > > the_Bs = B.objects.all().filter(Q(constraint1) | Q(constraint2)) >> >> > > -Matteius >> >> > > Don't overlook how powerful this is because Django has Manager classes >> > > so you can make your constraints refer to both local properties and >> > > foreign key constraints as well as properties within the foreign key >> > > lookups. You may find that you wish to edit your schema relationship, >> > > perhaps by pointing backwards or reversing the relationship. It is >> > > hard to say with the categorical A, B, C, D example, but hope this >> > > helps and Good Luck! >> >> > > On Aug 27, 3:47 pm, Gelonida N wrote: >> >> > > > On 08/27/2011 11:39 AM, graeme wrote: >> >> > > > > I have a some models related link this: >> >> > > > > A has a foreign key on B which has a foreign key on C >> >> > > > > I also have D with a foreign key on B, and E with a foreign key of C >> >> > > > > If I do A.filter(**args).select_related() I will get all the As, Bs, >> > > > > and Cs I want. >> >> > > > > How do I get the Ds with a foreign key on a B in my queryset >> > > > > (preferably filtered) and all Es with a foreign key on C (also >> > > > > preferably filtered) >> >> > > > > The best I have been able to come up with is to query for all the >> > > > > the >> > > > > Ds and Es I want, and combine them with the Bs and Cs in the view >> >> > > > > I have a similar problem with another site, except that there not >> > > > > every B I want has an A with a foreignkey pointing to it, so I cannot >> > > > > just do select_related on A. >> >> > > > > I am not worried about doing an extra query or two per page. What I >> > > > > want to avoid is doing an extra query for each object in a lengthy >> > > > > list. >> >> > > > You can 'or' two query sets with the '|' operator >> >> > > > so do >> > > > queryset1 = Mymodel.objects.all().filter(...) >> > > > qyeryset2 = Mymodel.objects.all().filter(...) >> >> > > > combined = queryset1 | queryset2 > >-- >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. > -- 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.
Check related object attribute in a view
This is probably very simple, but I've been hitting walls ever since I started... I have a model A that contains a link to another model B. B has an "owner" attribute. This owner attribute is translated as a per object permission using guardian. Models: class Service (models.Model): name = models.CharField(max_length=128, unique=True) owner = models.ForeignKey(User) class Deliverable (models.Model): project = models.ForeignKey(Project) service = models.ForeignKey(Service) I would like to allow editing Deliverable only if the current user is allowed to change the corresponding Service. To that end, I tried to subclass UpdateView: class UpdateDeliverableView(UpdateView): def dispatch(self, *args, **kwargs): # Check guardian permissions here return super(ValidateServiceView, self).dispatch(*args, **kwargs) in order to check guardian permissions, I need to access the Service from this view. But I can't seem to find how to access the Deliverable: self.get_object() does not work (complains that UpdateDeliverableView has no 'kwargs') How am I supposed to do it ? I also need the current user but self.request.user complains that self has no 'request' Does anyone have an hint as to how I could do that ? Thanks in advance :) -- 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.
App namespace/packages?
Hi, There are "reusable" apps which provide functionality in a variety of contexts. However, some apps only make sense (because of dependencies) in the context of one or more other apps. For example, I have a relatively big piece of software consisting of (like a good boy) multiple apps, which work together. Some are "core apps", some are optional "plugin apps". The latter could be installed and used, but really only when the core apps are present. Nevertheless, they sit on that same top-level namespace together with all the other "really reusable" apps. I think a shop system is a good example, and looking at satchmo I saw apps called "satchmo_this" and "satchmo_that". I'd rather see such apps packaged up so it's clear where they belong to. Before posting a feature request on the issue tracker I thought I'd ask how other people deal with this situation? I'd love if all apps were in a directory "apps", and the various loaders allowed me to go another level. Cheers, Danny -- 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: Combining queries? A "join" in Python?
I think I need to restate this question with the actual models. Sorry again. I have omitted irrelevant fields (ones I do not want too query against) replacing them with dots. class Category(models.Model): order = models.IntegerField(default=100) .. class CategoryText(models.Model): language = models.CharField(max_length=2,choices=LANG_CHOICES) category = models.ForeignKey(Category,related_name='texts') name = models.CharField(max_length=500) class Meta: unique_together = ('language','category') class SubCategory(models.Model): category = models.ForeignKey(Category) order = models.IntegerField(default=100) class SubCategoryText(models.Model): language = models.CharField(max_length=2,choices=LANG_CHOICES) subcategory = models.ForeignKey(SubCategory,related_name="texts") .. class Meta: unique_together = ('language','subcategory') CategoryText and SubCategoryText contain translations. ON any given page I want those for one language. My current queryset is: SubCategoryText.objects.filter(language=lang).annotate(subcat_places=(Count('subcategory__places'))).exclude(subcat_places=0).select_related().order_by('subcategory__category__order','- subcat_places','name') if I iterate over this in the template it gives me almost what I want, but I want to be able to do something like this. {{listing.subcategory.category.texts.name}} and get back the name from the CategoryText for the current language. I have tried filtering in various ways. I am currently trying looping over the queryset and adding attributes to each model with the name from the CategoryText and the category url (which are what I need in the template) , but this feels a bit hackish (assuming it works). On Aug 30, 12:02 pm, graeme wrote: > On Aug 30, 6:25 am, Tim wrote: > > > worst case you could always just write the sql query? > > >https://docs.djangoproject.com/en/dev/topics/db/sql/ > > I have been looking at that already, what I have not yet figured out > is how the results map to models if I do a join in the SQL query. Can > it create the models for the joined tables as well? > > > > > > > > > On Aug 29, 8:15 am,graeme wrote: > > > > I looks like my attempt to simplify and abstract the problem just made > > > it harder to help me: my apologies for that. I was trying to combined > > > two different problems rather than ask two questions. Thanks for > > > helping despite that. > > > > I think I have a solution for most of my problems, as far as getting > > > the queries working. I might be back with questions about > > > optimisation, but I can live with a little inefficiency in the query I > > > need to get working first. > > > > On Aug 28, 4:33 am, Matteius wrote: > > > > > Since you are combining two sets of different objects you'll want > > > > Gelonida's response. Additionally, Use Q to create more logically > > > > advanced queries. I find your language difficult to gather what query > > > > you are looking for exactly, but here is an example of what I think > > > > you might mean: > > > > > from django.db.models import Q > > > > > the_Ds = D.objects.all().filter(b=B) > > > > the_Es = E.objects.all().filter(c=C) > > > > > combined = the_Ds | the_Es > > > > > # Other Example (an & requires both constraints to be met, and an Or > > > > will include the set of all matches. > > > > the_As = A.objects.all().filter(Q(constraint1) & Q(constraint2)) > > > > the_Bs = B.objects.all().filter(Q(constraint1) | Q(constraint2)) > > > > > -Matteius > > > > > Don't overlook how powerful this is because Django has Manager classes > > > > so you can make your constraints refer to both local properties and > > > > foreign key constraints as well as properties within the foreign key > > > > lookups. You may find that you wish to edit your schema relationship, > > > > perhaps by pointing backwards or reversing the relationship. It is > > > > hard to say with the categorical A, B, C, D example, but hope this > > > > helps and Good Luck! > > > > > On Aug 27, 3:47 pm, Gelonida N wrote: > > > > > > On 08/27/2011 11:39 AM,graemewrote: > > > > > > > I have a some models related link this: > > > > > > > A has a foreign key on B which has a foreign key on C > > > > > > > I also have D with a foreign key on B, and E with a foreign key of C > > > > > > > If I do A.filter(**args).select_related() I will get all the As, Bs, > > > > > > and Cs I want. > > > > > > > How do I get the Ds with a foreign key on a B in my queryset > > > > > > (preferably filtered) and all Es with a foreign key on C (also > > > > > > preferably filtered) > > > > > > > The best I have been able to come up with is to query for all the > > > > > > the > > > > > > Ds and Es I want, and combine them with the Bs and Cs in the view. > > > > > > > I have a similar problem with another site, except that there not > > > > > > every B I want has an A with a foreignkey po
Looking for an experienced full time Django developer, Birmingham UK
Hi All Looking to expand an existing small but specialist team in Birmingham UK for established market leading retail / trading operation. Ideal candidates will be a proficient and experienced solution developer with strong commercial awareness. Technologies required : Django / LAMP / postgress. Package dependant upon candidate. If this sounds of interest, please drop me a line. All levels of experience will be considered, but reflected in remuneration. Please, no agencies at this time. Thanks James -- 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: Historical Djangocon videos available for download in iTunes?
Hi Simon, If you add /rss to the end of the blip.tv url this should give you an rss feed suitable for iTunes. For example http://blip.tv/djangocon-europe-2011/rss regards David On Sat, Aug 27, 2011 at 12:59 PM, Simon Connah wrote: > Does anyone know of a source for previous Djangocon (both US and EU) videos > that allow you to download them in iTunes? So far I've only seen them > available on the schedule page of the EU Djangocon site and on Blip.tv. > While I can certainly watch them there I prefer to have them on my hard > drive for easy reference at a later date. > > Thanks for any help. > > -- > 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. > > -- 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: Teacher online
Hi ivan, I am a home tutor for engineering candidates.I posses 1 yr experience in python and django. Tell your availability. Thanks, Maurya 9962973320 On Mon, Aug 8, 2011 at 3:40 PM, bambanx wrote: > Hey guys i am looking for a teacher for django beginner i Pay for > hour ,with the skype > And teamviewer ,chat Pls Send me skype user for contact me to > ivan_vilc...@hotmail.com > 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. > > -- 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.
Unable To Delete Records
Hi All... I have created a small application where in i am inserting and deleting records. I am able to delete a single record however when a select all or more then one record it deletes the last record only.. I tried a lot but failed please help I am wring the Code and the Console output here === my function to delete a medecine from its table in views.py === def delete_medecine(request,medecine={}): print "-->>",request.POST list = [] for i in request.POST['del_id']: m = Medecine.objects.get(id = i) m.delete() return HttpResponseRedirect('/medecine') == my template file SNo. Name Price Quantity Exp. Date Description {% for single in medecine_obj%} {{single.id}} {{single.name}} {{single.price}} {{single.exp_date}} {{single.discription}} {%endfor%} === My Console === /usr/local/lib/python2.6/dist-packages/django/middleware/csrf.py:262: DeprecationWarning: CsrfResponseMiddleware and CsrfMiddleware are deprecated; use CsrfViewMiddleware and the template tag instead (see CSRF documentation). DeprecationWarning == = 8 [30/Aug/2011 06:04:56] "POST /delete_medecine/ HTTP/1.1" 302 0 == Please help -- 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.
dynamic use of django form widgets in template
Hi, I have a dictionary of field names and a their type. I want to use this in the html template to render form widgets for the correct type for each field. Am I better off rendering the html in the python view and then passing it through as content? Example: data = {'name' : 'string', 'age' : 'int'} form.html {% for key in data %} {% endfor %} Any help appreciated, Bob -- 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: App namespace/packages?
On 30-08-11 09:57, Danny W. Adair wrote: I think a shop system is a good example, and looking at satchmo I saw apps called "satchmo_this" and "satchmo_that". I'd rather see such apps packaged up so it's clear where they belong to. Before posting a feature request on the issue tracker I thought I'd ask how other people deal with this situation? I'd love if all apps were in a directory "apps", and the various loaders allowed me to go another level. Django doesn't play nice with namespace packages as are possible with setuptools. It just looks at the part after the last dot for many internals, like database table naming. So what we're doing is name our packages with a dash and a common prefix: "lizard-ui", "lizard-map", "lizard-shape". The python modules within it are the same, but with an underscore (lizard_ui, lizard_map, lizard_shape). The only reason for the dash/underscore difference is that it makes it easier to spot in which directory you are (the dash is the one with the setup.py, the underscore is the directory with the code within that outer-one-with-the-dash). Reinout -- Reinout van Reeshttp://reinout.vanrees.org/ rein...@vanrees.org http://www.nelen-schuurmans.nl/ "If you're not sure what to do, make something. -- Paul Graham" -- 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: Unable To Delete Records
On 30-08-11 13:05, Showket Bhat wrote: I have created a small application where in i am inserting and deleting records. I am able to delete a single record however when a select all or more then one record it deletes the last record only.. I tried a lot but failed please help I am wring the Code and the Console output here === my function to delete a medecine from its table in views.py === def delete_medecine(request,medecine={}): print "-->>",request.POST list = [] for i in request.POST['del_id']: m = Medecine.objects.get(id = i) m.delete() return HttpResponseRedirect('/medecine') Ah! Your code is fine, apart from one detail: the request.POST looks like a regular dictionary, but it isn't. It is a querydict, look at https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.QueryDict your request.POST['del_id'] effectively calls __getitem__('del_id') on the querydict and the querydict documentation says: "If the key has more than one value, __getitem__() returns the last value." Now you know why only the last item gets deleted. It bit my once, too. What you need to call is request.POST.getlist('del_id'): that will give you the list you're expecting. Reinout -- Reinout van Reeshttp://reinout.vanrees.org/ rein...@vanrees.org http://www.nelen-schuurmans.nl/ "If you're not sure what to do, make something. -- Paul Graham" -- 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: Unable To Delete Records
On Tue, Aug 30, 2011 at 12:44 PM, Reinout van Rees wrote: > On 30-08-11 13:05, Showket Bhat wrote: >> >> I have created a small application where in i am inserting and >> deleting records. I am able to delete a single record however when a >> select all or more then one record it deletes the last record only.. I >> tried a lot but failed please help I am wring the Code and the Console >> output here >> >> >> === >> my function to delete a medecine from its table in views.py >> === >> >> def delete_medecine(request,medecine={}): >> print "-->>",request.POST >> list = [] >> for i in request.POST['del_id']: >> m = Medecine.objects.get(id = i) >> m.delete() >> return HttpResponseRedirect('/medecine') > > Ah! Your code is fine, apart from one detail: the request.POST looks like a > regular dictionary, but it isn't. It is a querydict, look at > https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.QueryDict > > your request.POST['del_id'] effectively calls __getitem__('del_id') on the > querydict and the querydict documentation says: > > "If the key has more than one value, __getitem__() returns the last value." > > Now you know why only the last item gets deleted. It bit my once, too. > > What you need to call is request.POST.getlist('del_id'): that will give you > the list you're expecting. > > > > Reinout > DANGER! - it's actually much much worse than that! Everything that Reinout said is correct, but remember that POST data is handled as strings, and strings are iterable collections of characters. If you had selected 3 items, and your POSTed data looked like this: del_id=123&del_id=345&del_id=678 and then run this code: for i in request.POST['del_id']: m = Medecine.objects.get(id = i) m.delete() request.POST['del_id'] will return '678', and the for loop will iterate three times with the values '6', '7' and '8', and you will delete three unrequested items! Cheers Tom -- 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: Unable To Delete Records
On Tuesday 30 August 2011, Showket Bhat wrote: > Hi All... Hello Showket... > > I have created a small application where in i am inserting and > deleting records. I am able to delete a single record however when a > select all or more then one record it deletes the last record only.. I > tried a lot but failed please help I am wring the Code and the Console > output here Probably you should try using: m = Medecine.objects.get(pk = i) Instead of using: m = Medecine.objects.get(id = i) Also, try to handle the DoesNotExist and similar exception once you try to retrieve the object using the /get()/ method. Also you can reduce the look by using: del_ids = request.POST.getlist('del_id') Medecine.objects.filter(id__in = del_id).delete() Which should be faster than your loop. > > > === > my function to delete a medecine from its table in views.py > === > > def delete_medecine(request,medecine={}): > print "-->>",request.POST > list = [] > for i in request.POST['del_id']: > m = Medecine.objects.get(id = i) > m.delete() > return HttpResponseRedirect('/medecine') > > == > my template file > > > > > > > > > SNo. > Name > Price > Quantity > Exp. Date > Description > > > > > {% for single in medecine_obj%} > > = "del_id" /> > {{single.id}} > {{single.name}} > {{single.price}} > {{single.exp_date}} > {{single.discription}} > src="/login/media/assets/action_delete.png" alt="Delete" /> href="#"> a> > > {%endfor%} > > value = "Add Record" alt="Add" /> > alt="Delete" /> > > > > > > > === > My Console > === > > /usr/local/lib/python2.6/dist-packages/django/middleware/csrf.py:262: > DeprecationWarning: CsrfResponseMiddleware and CsrfMiddleware are > deprecated; use CsrfViewMiddleware and the template tag instead (see > CSRF documentation). > DeprecationWarning > == {u'csrfmiddlewaretoken': [u'fea796e4bc7836bb8584140b71a0afcc'], > u'del_id': [u'1', u'2', u'8'], u'delete': [u'Delete Records']}> > = 8 > [30/Aug/2011 06:04:56] "POST /delete_medecine/ HTTP/1.1" 302 0 > > > > == > > > Please help Best regards, -- Daniel Molina Wegener System Programmer & Web Developer Phone: +56 (2) 979-0277 | Blog: http://coder.cl/ -- 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: Model.save() does nothing
That won't be necessary. I found the problem and it was just because I was to stupid. The problem was not the toggle function for that worked absolutely as it should. But the function which it redirects to in the not working case doesn't retrieve the data from the database. Instead it uses a session variable which, of course, contains the untoggled value. And later this old value is saved again so that it seems as the first save didn't work. Quite simple if one looks at the right function... So, the problem is solved. But thank you anyway. On 30 Aug., 01:35, "christian.posta" wrote: > No it shouldn't be dependent on anything like that. > Im curious to know what the issue is for you. I know this might be a > pain in the butt, but if you could put together a small sample program > that demonstrates something like this, I would be more than happy to > help you debug through it. > > On Aug 28, 4:33 am, j0ker wrote: > > > > > > > > > I'm playing around with Django at the moment and have a strange > > problem. > > > There is a view function which basiclydoesnothingelse than toggle a > > boolean value in a model field - or at least should do so. > > > The field definition: > > > class Character(models.Model): > > ... > > ready = models.BooleanField(default=False) > > ... > > > The view function: > > > @decorators.login_required > > def character_toggle_ready(request, id): > > character = get_object_or_404(Character, pk=id) > > character.ready = not character.ready > > character.save() > > return redirect(request.META.get('HTTP_REFERER', '/accounts/ > > overview')) > > > The url conf: > > urlpatterns = patterns('', > > ... > > url(r'^character/toggle_ready/(\d+)/$', > > views.character_toggle_ready), > > ...) > > > In practice I want to have the ready-value toggled when clicking on a > > hyperlink on my site. E.g. when clicking on '/character/toggle_ready/ > > 1', the value should be toggled and then the view function should > > redirect to the page before. > > > That works as intended, when I access the view from a template which > > belongs to the app in which this view is definded. But strangely it > >doesnot work if the link is in a different app. So, when the toggle- > > view lies in the app 'accounts', it's no problem when accessing it > > from a template that's rendered by another view of this app. But when > > the template comes from the app 'core', it wouldn't save. The > > redirection still works as a charm and also the object is retrieved > > and the value is toggled, I've checked that with print-functions. But > > after the save seems to be before the save. > > > Has anybody an idea what the reason for that behavior could be? Is the > > save-function dependend on the passed request? Or am I overlooking > > something? -- 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 Development environment
Arch Linux, GNU/Emacs with emacs-for-python extension, pylint, virtualenv, fabric, pudb, winpdb and firebug, postgresql, django-extensions, git Am 23.08.2011 00:07, schrieb Stephen Jackson: I am new to the world of Django. I would like to hear from other django developers describe their dev environment (tools, os, editors, etc.). -- 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/-/Fq-jCVxrK7AJ. 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. -- Bastian Ballmann / Web Developer Notch Interactive GmbH / Badenerstrasse 571 / 8048 Zürich Phone +41 43 818 20 91 / www.notch-interactive.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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Error was: No module named io
Let me make a couple of suggestions stemming from my experience: 1. Develop on the same exact version of python that you have installed on your production server. These kinds of backwards incompatible changes have bitten me more than once. This should be true for any language you develop in. You want to mirror the production environment as closely as possible. Your web host may even be willing to provide a virtual machine image that exactly replicates the environment they install on their servers. 2. Working with io streams was not new functionality in 2.6. The io documentation itself (http://docs.python.org/library/io.html) says that it is a replacement for the built-in file object (http:// docs.python.org/library/functions.html#file), which you most certainly can use in Python 2.5. Hope that helps! :-) -Mark On Aug 27, 8:59 pm, CrabbyPete wrote: > I developed my code with python 2.6 and django 1.3. Now that I am > deploying it on a dreamhost server the python is version 2.5 and I get > the error above. Is there a work around. Do I need to upgrade python? -- 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: Looking for an experienced full time Django developer, Birmingham UK
Hi James, I am a Django developer, for the last 6 months. I am moving to Manchester soon from the USA for 4-6 months to look for work. I am interested in the position, I lived in the UK when I was a child as well. Christian On 30 Aug 2011, at 02:48, jamesm wrote: > Hi All > > Looking to expand an existing small but specialist team in Birmingham > UK for established market leading retail / trading operation. > > Ideal candidates will be a proficient and experienced solution > developer with strong commercial awareness. > > Technologies required : Django / LAMP / postgress. > > Package dependant upon candidate. If this sounds of interest, please > drop me a line. All levels of experience will be considered, but > reflected in remuneration. > > Please, no agencies at this time. > > Thanks > > James > > -- > 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. > -- 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: Update the parent model when a related (inline) model changed?
Hi all, many thanks to everyone who replied! For the records/archives, here is the solution that we eventually implemented: Am 25.08.2011 16:19, schrieb Carsten Fuchs: what is the best way to automatically update a parent model when one of it's related models (i.e. the "inline" models in the admin interface) changed? For the related models (except for the single related model that contains the cache (the dependent monthly sums)), overriding the save() and delete() methods was very simple and straightforward: The code in these function updates the "cache is valid before" member in the main model before running the save() or delete() methods in the super class. For the main model itself, it turned out that overriding delete() was never necessary, because if the main model is deleted, it's cached data is deleted as well, no need to update the "cache is valid before" member. Overriding save() in the main model (for cases when a change to the main model requires an update of the cache) turned out to be not a good idea, because it easily conflicts with the newly overridden save() methods of the related models, whose implementation in turn calls save() of the main model. Instead, for the main model, we overrode save_model() in the ModelAdmin. In summary, overriding save() for the related models and save_model() in ModelAdmin for the main model solved the problem. Best regards, Carsten -- Cafu - the open-source Game and Graphics Engine for multiplayer, cross-platform, real-time 3D Action Learn more at http://www.cafu.de -- 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: Combining queries? A "join" in Python?
On Aug 30, 3:10 am, graeme wrote: > I think I need to restate this question with the actual models. Apologies in advance for answering a question you didn't ask, but is your subcategory model truly representing something different from your category model? I think the problems you are having with the query may be indicative of a problem with your model definitions / database layout. Unless I have the wrong idea about what you are trying to accomplish, I recommend a single Category model with a parent field defined as a back-reference to itself. Something like this: parent = models.ForeignKey('self', blank=True, null=True, related_name='child') This approach would eliminate the SubCategory and SubCategoryText models. The CategoryText looks about right as it is. I'm not clear on precisely what you are trying to accomplish with your query, but perhaps rethinking your models will make the query easier. Hope that helps, --Stuart -- 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: App namespace/packages?
On Tue, Aug 30, 2011 at 8:57 AM, Danny W. Adair wrote: > Hi, > There are "reusable" apps which provide functionality in a variety of > contexts. > However, some apps only make sense (because of dependencies) in the > context of one or more other apps. > For example, I have a relatively big piece of software consisting of > (like a good boy) multiple apps, which work together. > Some are "core apps", some are optional "plugin apps". The latter > could be installed and used, but really only when the core apps are > present. > Nevertheless, they sit on that same top-level namespace together with > all the other "really reusable" apps. > > I think a shop system is a good example, and looking at satchmo I saw > apps called "satchmo_this" and "satchmo_that". > I'd rather see such apps packaged up so it's clear where they belong > to. > > Before posting a feature request on the issue tracker I thought I'd > ask how other people deal with this situation? > I'd love if all apps were in a directory "apps", and the various > loaders allowed me to go another level. > An app does not have to equate to a python package. One of my projects consists of a bunch of tightly coupled apps which are all delivered as part of one python package. Eg, I install 'rc_nubtek', which gives me 5 django apps named 'rc_nubtek.remote', 'rc_nubtek.media', 'rc_nubtek.playerd', 'rc_nubtek.recorderd' and 'rc_nubtek.api'. These apps aren't automatically added to INSTALLED_APPS by adding 'rc_nubtek', I list them explicitly in settings, so there is no need for a custom loader. Since they are so tightly coupled, it makes no sense to have them as separate packages. There are also other packages in this project which are not tightly coupled, and they live in their own package. Cheers Tom -- 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.py not found
I get the following error when I execute this command, django-admin.py startproject mysite Error: django-admin.py not found. -- Prem 408-393-2545 -- 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.
satchmo project down?
Hi, I can't get one the website. Johnf -- 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.
Groups Model Randomly Disappears In the Admin View
I have a very strange problem that I am having difficultly in debugging. In my application I have registered two models, each of which contains two classes. When I go to the admin view, the groups class from the auth model sometimes disappears. If I keep refreshing, it will appear then disappear almost randomly. Does anyone know what the cause might be or how I can debug this. I am using Django v1.2.5. Thanks, Laurence -- 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.py not found
Not all methods of installing Django on all systems manage to make that file work as a command. You can use whatever file search tool your system provides to find the file. For example, almost everywhere but windows you can type, at a bash prompt. find / -name django-admin.py 2>& /dev/null And it will tell you the path to the file, e.g.; /a/bunch/of/directory/names/django-admin.py You should then be able to use that (whatever you got instead of the sample) and type: python /a/bunch/of/directory/names/django-admin.py startproject mysite On Tue, Aug 30, 2011 at 10:39 AM, PremAnand Lakshmanan wrote: > I get the following error when I execute this command, > > django-admin.py startproject mysite > > Error: > django-admin.py not found. > > > -- > Prem > 408-393-2545 > > -- > 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. > -- 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.py not found
What OS are you running? Is it in your path? I'm having a similar issue and managed to get around it (although the solution is not as elegant as I'd like) using this: python C:\Python27\Lib\site-packages\django\bin\django-admin.py startproject mysite2 On Tue, Aug 30, 2011 at 10:39 AM, PremAnand Lakshmanan wrote: > I get the following error when I execute this command, > > django-admin.py startproject mysite > > Error: > django-admin.py not found. > > > > -- > Prem > 408-393-2545 > > -- > 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. > -- 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: satchmo project down?
On 30/08/11 15:55, John Fabiani wrote: Hi, I can't get one the website. Johnf http://www.downforeveryoneorjustme.com/http://www.satchmoproject.com/ Tim. http://percussion360.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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Combining queries? A "join" in Python?
On Aug 30, 7:25 pm, Stuart wrote: > On Aug 30, 3:10 am, graeme wrote: > > > I think I need to restate this question with the actual models. > > Apologies in advance for answering a question you didn't ask, but is > your subcategory model truly representing something different from > your category model? I think the problems you are having with the > query may be indicative of a problem with your model definitions / > database layout. > > Unless I have the wrong idea about what you are trying to accomplish, > I recommend a single Category model with a parent field defined as a > back-reference to itself. Something like this: > > parent = models.ForeignKey('self', blank=True, null=True, > related_name='child') > > This approach would eliminate the SubCategory and SubCategoryText > models. The CategoryText looks about right as it is. > > I'm not clear on precisely what you are trying to accomplish with your > query, but perhaps rethinking your models will make the query easier. I must admit I never thought of structuring the database like that. I had to think about it quite a bit. What my query does is give me a list of subcategories, ordered by category, and then by the number of places in the category, and annotates each subcategory with the number of places in it. Having a single category model might simplify the query, but as I want the page to show something like: CATEGORY Subcategory One Subcategory Two CATEGORY TWO Subcategory Three etc. I am still going to have to, at least, join the category table to itself, instead of joining the subcategory table to the category table. I have not yet figured out if this will give me easier access to the CategoryText of a parent category (in that case it may simplify things a lot). If I am iterating over subcategories (which will now just be those categories without a parent), will I have easier access to the CategoryText of the parent. The disadvantage is that the current structure enforces, at the database level, that Places can only belong to a sub-category, and that the hierarchy is only two levels deep. I would have to move some validation out of the database if I did this. My current approach, or adding the necessary attributes in Python works. It does help, as I just found out, that I can add attributes to the Categories while looping over SubCategoryTexts (i.e. subcategorytextobject.subcategory.category.foo = bar works). It is still an ugly hack, though. > > Hope that helps, > > --Stuart -- 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.
question regarding doing authentication for a mobile client via REST call
Hello All, hope you all are doing great. I have a question regarding how to authenticate a User via REST (using tastypie) call. I search the group and found something similar here (http://groups.google.com/group/django-users/browse_thread/thread/ 4417516a26c2a1cc/496b54b93e4420a8? lnk=gst&q=authentication#496b54b93e4420a8) but it didnt help much. I know we can authenticate user using authenticate() method of django.contrib.auth package. this method takes username and password (not the hash) as an argument. so my question is, its not safe to pass the actual password over the http. and I am not quite getting the idea how should I go about implementing this service which will allow mobile clients to login. I would appreciate your help. Thanks, sanket -- 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: question regarding doing authentication for a mobile client via REST call
reposting the thread link http://groups.google.com/group/django-users/browse_thread/thread/4417516a26c2a1cc/496b54b93e4420a8?lnk=gst&q=authentication#496b54b93e4420a8 On Aug 30, 11:20 am, sanket wrote: > Hello All, > hope you all are doing great. > > I have a question regarding how to authenticate a User via REST (using > tastypie) call. I search the group and found something similar here > (http://groups.google.com/group/django-users/browse_thread/thread/ > 4417516a26c2a1cc/496b54b93e4420a8? > lnk=gst&q=authentication#496b54b93e4420a8) but it didnt help much. > > I know we can authenticate user using authenticate() method of > django.contrib.auth package. > this method takes username and password (not the hash) as an argument. > so my question is, > its not safe to pass the actual password over the http. and I am not > quite getting the idea how should I go about implementing this service > which will allow mobile clients to login. > > I would appreciate your help. > Thanks, > sanket -- 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: Combining queries? A "join" in Python?
FWIW, I'm using django-mptt to help me traverse my tree of self-referencing models, as well as run complex aggregates based on them. http://django-mptt.github.com/django-mptt/index.html Be aware that the API has changed a lot from 0.3 (which is easily found around the web) to 0.5 (which will require some more googling or cloning for a specific commit from github). The key advantage of using this library is that it takes care of adding (and handling) a tree_id column for your MPTTModels, which you can then use to filter aggregates and the like. So do check it out! As an anedoctal aside, In my use case I have AccountGroup, Account and Entry, and my problem could only be solved through a HUMONGOUS query (62 lines total) that returns the aggregate sum for Entries for a given AccountGroup for a given month, including subtotals for each level of the AccountGroup and each Account. So be ready to sharpen up on your SQL skills if you're looking for something similar! Cheers, AT On Tue, Aug 30, 2011 at 2:10 PM, graeme wrote: > > > On Aug 30, 7:25 pm, Stuart wrote: > > On Aug 30, 3:10 am, graeme wrote: > > > > > I think I need to restate this question with the actual models. > > > > Apologies in advance for answering a question you didn't ask, but is > > your subcategory model truly representing something different from > > your category model? I think the problems you are having with the > > query may be indicative of a problem with your model definitions / > > database layout. > > > > Unless I have the wrong idea about what you are trying to accomplish, > > I recommend a single Category model with a parent field defined as a > > back-reference to itself. Something like this: > > > > parent = models.ForeignKey('self', blank=True, null=True, > > related_name='child') > > > > This approach would eliminate the SubCategory and SubCategoryText > > models. The CategoryText looks about right as it is. > > > > I'm not clear on precisely what you are trying to accomplish with your > > query, but perhaps rethinking your models will make the query easier. > > I must admit I never thought of structuring the database like that. I > had to think about it quite a bit. > > What my query does is give me a list of subcategories, ordered by > category, and then by the number of places in the category, and > annotates each subcategory with the number of places in it. > > Having a single category model might simplify the query, but as I want > the page to show something like: > > CATEGORY > Subcategory One > Subcategory Two > CATEGORY TWO > Subcategory Three > etc. > > I am still going to have to, at least, join the category table to > itself, instead of joining the subcategory table to the category > table. I have not yet figured out if this will give me easier access > to the CategoryText of a parent category (in that case it may simplify > things a lot). > > If I am iterating over subcategories (which will now just be those > categories without a parent), will I have easier access to the > CategoryText of the parent. > > The disadvantage is that the current structure enforces, at the > database level, that Places can only belong to a sub-category, and > that the hierarchy is only two levels deep. I would have to move some > validation out of the database if I did this. > > My current approach, or adding the necessary attributes in Python > works. It does help, as I just found out, that I can add attributes to > the Categories while looping over SubCategoryTexts (i.e. > subcategorytextobject.subcategory.category.foo = bar works). It is > still an ugly hack, though. > > > > > Hope that helps, > > > > --Stuart > > -- > 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. > > -- 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.
Argh: templates, admin, and app loading order
So... I'm trying to keep all site-specific code and overrides to third- party app behavior in a single "current_site" app in my project. For the sake of template loading order, this app is listed first in INSTALLED_APPS so that its templates are located before the third- party defaults. But... Now I can't use this app to override the default ModelAdmin declarations for third-party apps because of course "admin.site.unregister(ThirdPartyModel)" throws a NotRegistered exception because current_site appears before the third party app in INSTALLED_APPS. Ah, the irony. Now, I know how to work around this: create a separate app for admin overrides that loads at the end of the INSTALLED_APPS list instead of the beginning. But am I the only one who thinks that feels a little clumsy? Thoughts? Other solutions? Thanks, -Nan -- 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 to run tests?
Newbie question: I am trying to run tests for my one webapp "vip_mobile". The settings.py contains a line like this: INSTALLED_APPS = ( ... 'vip_mobile.data', ) It also contains a file data/tests.py with appropriate test content. When I run: manage.py test vip_mobile.data I get the error: django.core.exceptions.ImproperlyConfigured: App with label vip_mobile could not be found I also tried running: manage.py test vip_mobile and got the same error. Any ideas? Am I doing something wrong? Thanks, --Steve -- 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.
"manage.py" command not found
Hi, I'm running the latest django 1.4 alpha from the repository. I have a django project hosted on bitbucket, I run the bitbucket "clone" command and pull down my code onto my server. But when I go into my project folder and run the command... "./manage.py runfcgi method=threaded host=127.0.0.1 port=8080" I get the following error... "manage.py: command not found" If I start a project directly on my server running the "startproject" command it works fine, it's only when I clone a project onto my server I get this. Is there anything I can do to make my cloned projects work? As I need to be able to pull the latest project versions from my repositories. Thanks. -- 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/-/14GRq9ygTJsJ. 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: "manage.py" command not found
Put python in front of it or check permissions to make it executable? On Tue, Aug 30, 2011 at 4:01 PM, Phil wrote: > Hi, > > I'm running the latest django 1.4 alpha from the repository. > > I have a django project hosted on bitbucket, I run the bitbucket "clone" > command and pull down my code onto my server. But when I go into my project > folder and run the command... > > "./manage.py runfcgi method=threaded host=127.0.0.1 port=8080" > > I get the following error... > > "manage.py: command not found" > > If I start a project directly on my server running the "startproject" > command it works fine, it's only when I clone a project onto my server I get > this. > > Is there anything I can do to make my cloned projects work? As I need to be > able to pull the latest project versions from my repositories. > > Thanks. > > -- > 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/-/14GRq9ygTJsJ. > 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. > -- 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 to run tests?
On 30-08-11 21:02, mrstevegross wrote: INSTALLED_APPS = ( ... 'vip_mobile.data', ) It also contains a file data/tests.py with appropriate test content. When I run: manage.py test vip_mobile.data I get the error: django.core.exceptions.ImproperlyConfigured: App with label vip_mobile could not be found Try "manage.py test data". Django doesn't really like those dot-separated namespace packages, sadly. Only the last part is used. Reinout -- Reinout van Reeshttp://reinout.vanrees.org/ rein...@vanrees.org http://www.nelen-schuurmans.nl/ "If you're not sure what to do, make something. -- Paul Graham" -- 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: "manage.py" command not found
The permissions were OK, but putting python in front of it seems to have worked(I have database connection issue now, but once I fix that I reckon it will be work)! Thanks Yves, big help! -- 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/-/Y0D0NYyo4Q8J. 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: "manage.py" command not found
I don't know about Windows (if anyone does, please say so), but in a *nix OS putting this (don't remember its official name) at the top of your file can help: #!/usr/bin/env python On Tue, Aug 30, 2011 at 4:11 PM, Phil wrote: > The permissions were OK, but putting python in front of it seems to have > worked(I have database connection issue now, but once I fix that I reckon it > will be work)! > > Thanks Yves, big help! > > -- > 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/-/Y0D0NYyo4Q8J. > > 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. > -- 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: "manage.py" command not found
I opened my "manage.py" file to insert the line, but it was already there on the first line. -- 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/-/uXSA23Fl7iEJ. 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: "manage.py" command not found
On 08/30/2011 04:18 PM, Yves S. Garret wrote: I don't know about Windows (if anyone does, please say so), but in a *nix OS putting this (don't remember its official name) at the top of your file can help: #!/usr/bin/env python It's called a 'shebang line,' and it's ignored in Windows. It's important in *nix, but the file still has to be executable. If you invoke Python manually then the line isn't necessary. -- 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: "manage.py" command not found
Maybe you have Python installed somewhere that's not described in the shebang line? Don't know, don't know your environment. Glad that your stuff works now :) . On Tue, Aug 30, 2011 at 4:22 PM, Phil wrote: > I opened my "manage.py" file to insert the line, but it was already there > on the first line. > > > > -- > 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/-/uXSA23Fl7iEJ. > > 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. > -- 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: "manage.py" command not found
Hi, Put python (Location of install python directory. mainly C:\Python26\) in your windows environment variable path also with django-admin.py path. Thanks, Mitesh Patel Senior OpenSource Executive, Mobile: +91-97110-99601 Email: mitesh.patel1...@gmail.com LinkedIn : http://in.linkedin.com/in/miteshpatel11 On 31 August 2011 01:54, Yves S. Garret wrote: > Maybe you have Python installed somewhere that's not described in the > shebang line? > > Don't know, don't know your environment. Glad that your stuff works now :) > . > > > On Tue, Aug 30, 2011 at 4:22 PM, Phil wrote: > >> I opened my "manage.py" file to insert the line, but it was already there >> on the first line. >> >> >> >> -- >> 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/-/uXSA23Fl7iEJ. >> >> 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. >> > > -- > 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. > -- 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.
using django-filer with rich textfields
Is anyone aware of a way to add images from django-filer to rich textfields? I'm using django-filer in my project for an image library, and WYMEditor for a rich textfield in the admin panel. The default behavior of the image button in WYMEditor is to prompt the user to enter a URL where the image lives. However with django-filer the image urls are mostly hidden and will not be that easy for a content integrator to figure out. I would like to be able to have the user click the image button in WYMEditor and select an image from the django-filer image library instead of the default behavior. I would have thought that someone would have already done this but the google has failed me in my attempts to find any information on this. -- 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/-/2FD5R05eofoJ. 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 based in url for user
Hej I am new and trying to make a login for mysite. I have written a basic login which validates against another site and is working fine atm. I would like to make the auth related to the url. So that user a with permission 1 can access www.test.dk/1/content but he is not allowed to access www.test.dk/2/content user 2 with permission 4 can access www.test.dk/4/content but he is not allowed to access www.test.dk/1/content It there a good way to solved this? Is it possible extend the or use the @login_required tag to this solution. Hope for some input so I can find a solution. Regards Carsten -- 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: Argh: templates, admin, and app loading order
Can you use the filesystem loader as the first template loader, then set TEMPLATE_DIRS in settings.py to specify a template directory outside any app? Use this location for all of your overrides, just make sure the path is right... ie each app you override would have its own subdirectory. -- 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.
manage.py test app can't find tests
Using Python 2.7 and Django trunk I can run python tests.py successfully in the app directory or in /app/tests subdirectory where it says (no setup or teardown required yet) . -- Ran 25 tests in 0.141s OK but in the project directory can someone tell me why this runs zero tests? python manage.py test app says Creating test database for alias 'default'... -- Ran 0 tests in 0.000s OK Destroying test database for alias 'default'... Maybe there are no database related tests just yet On the other hand broadening the scope seems to run a whole mess of contrib app tests. python manage.py test says Creating test database for alias 'default'... .s .. .. -- Ran 326 tests in 33.157s OK (skipped=1) Destroying test database for alias 'default'... My settings.py says in part ... INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', # keeps track of labels and tables 'django.contrib.sessions', # keys, values, expiry 'django.contrib.sites', # for connecting content to 'a' site 'django.contrib.messages', 'django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.staticfiles', 'django.contrib.comments', 'commoninfo', 'ldap_groups', # Novell login for auth 'app', ) Thanks for any hints 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: django-admin.py not found
My django-admin.py file is located in C:\django-1.3\django\bin\django-admin.py I tried executing this command but get the following error in my python shell, >>> python C:\django-1.3\django\bin\django-admin.py startproject mysite SyntaxError: invalid syntax On Tue, Aug 30, 2011 at 11:28 AM, Yves S. Garret wrote: > What OS are you running? Is it in your path? > > I'm having a similar issue and managed to get around it (although the > solution is not as elegant as I'd like) using this: > python C:\Python27\Lib\site-packages\django\bin\django-admin.py > startproject mysite2 > > On Tue, Aug 30, 2011 at 10:39 AM, PremAnand Lakshmanan > wrote: > >> I get the following error when I execute this command, >> >> django-admin.py startproject mysite >> >> Error: >> django-admin.py not found. >> >> >> >> -- >> Prem >> 408-393-2545 >> >> -- >> 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. >> > > -- Prem 408-393-2545 -- 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.py not found
Do me a favor and check that you have \Lib\site-packages\django\bin\django-admin.py If you do, try that. I don't think I have a C:\django-1.3\... directory, could be an issue with how you installed it (I didn't experiment, there was no need). On Tue, Aug 30, 2011 at 8:18 PM, PremAnand Lakshmanan wrote: > My django-admin.py file is located in > > C:\django-1.3\django\bin\django-admin.py > > I tried executing this command but get the following error in my python > shell, > > >>> python C:\django-1.3\django\bin\django-admin.py startproject mysite > SyntaxError: invalid syntax > > > > > On Tue, Aug 30, 2011 at 11:28 AM, Yves S. Garret < > yoursurrogate...@gmail.com> wrote: > >> What OS are you running? Is it in your path? >> >> I'm having a similar issue and managed to get around it (although the >> solution is not as elegant as I'd like) using this: >> python C:\Python27\Lib\site-packages\django\bin\django-admin.py >> startproject mysite2 >> >> On Tue, Aug 30, 2011 at 10:39 AM, PremAnand Lakshmanan < >> prem1...@gmail.com> wrote: >> >>> I get the following error when I execute this command, >>> >>> django-admin.py startproject mysite >>> >>> Error: >>> django-admin.py not found. >>> >>> >>> >>> -- >>> Prem >>> 408-393-2545 >>> >>> -- >>> 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. >>> >> >> > > > -- > Prem > 408-393-2545 > -- 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.py not found
I dont see any file under site packages. I think my Django is not installed within Python. Something is wrong.. On Tue, Aug 30, 2011 at 8:28 PM, Yves S. Garret wrote: > Do me a favor and check that you have install>\Lib\site-packages\django\bin\django-admin.py > > If you do, try that. I don't think I have a C:\django-1.3\... directory, > could be an issue with how you installed it (I didn't experiment, there was > no need). > > > On Tue, Aug 30, 2011 at 8:18 PM, PremAnand Lakshmanan > wrote: > >> My django-admin.py file is located in >> >> C:\django-1.3\django\bin\django-admin.py >> >> I tried executing this command but get the following error in my python >> shell, >> >> >>> python C:\django-1.3\django\bin\django-admin.py startproject mysite >> SyntaxError: invalid syntax >> >> >> >> >> On Tue, Aug 30, 2011 at 11:28 AM, Yves S. Garret < >> yoursurrogate...@gmail.com> wrote: >> >>> What OS are you running? Is it in your path? >>> >>> I'm having a similar issue and managed to get around it (although the >>> solution is not as elegant as I'd like) using this: >>> python C:\Python27\Lib\site-packages\django\bin\django-admin.py >>> startproject mysite2 >>> >>> On Tue, Aug 30, 2011 at 10:39 AM, PremAnand Lakshmanan < >>> prem1...@gmail.com> wrote: >>> I get the following error when I execute this command, django-admin.py startproject mysite Error: django-admin.py not found. -- Prem 408-393-2545 -- 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. >>> >>> >> >> >> -- >> Prem >> 408-393-2545 >> > > -- Prem 408-393-2545 -- 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.py not found
Where do you have Python installed? I just followed these steps to install Django, worked like a charm (no special setup or anything.) I did this just for the fun of it without any production settings (just to try stuff out), did you do something different? https://docs.djangoproject.com/en/dev/intro/install/ On Tue, Aug 30, 2011 at 8:36 PM, PremAnand Lakshmanan wrote: > This is steps I used to download. > > 1. Download from the Django website. > 2. Unzipped it to C:/Django-1.3 folder > > On Tue, Aug 30, 2011 at 8:31 PM, PremAnand Lakshmanan > wrote: > >> I dont see any file under site packages. I think my Django is not >> installed within Python. >> >> Something is wrong.. >> >> On Tue, Aug 30, 2011 at 8:28 PM, Yves S. Garret < >> yoursurrogate...@gmail.com> wrote: >> >>> Do me a favor and check that you have >> install>\Lib\site-packages\django\bin\django-admin.py >>> >>> If you do, try that. I don't think I have a C:\django-1.3\... directory, >>> could be an issue with how you installed it (I didn't experiment, there was >>> no need). >>> >>> >>> On Tue, Aug 30, 2011 at 8:18 PM, PremAnand Lakshmanan < >>> prem1...@gmail.com> wrote: >>> My django-admin.py file is located in C:\django-1.3\django\bin\django-admin.py I tried executing this command but get the following error in my python shell, >>> python C:\django-1.3\django\bin\django-admin.py startproject mysite SyntaxError: invalid syntax On Tue, Aug 30, 2011 at 11:28 AM, Yves S. Garret < yoursurrogate...@gmail.com> wrote: > What OS are you running? Is it in your path? > > I'm having a similar issue and managed to get around it (although the > solution is not as elegant as I'd like) using this: > python C:\Python27\Lib\site-packages\django\bin\django-admin.py > startproject mysite2 > > On Tue, Aug 30, 2011 at 10:39 AM, PremAnand Lakshmanan < > prem1...@gmail.com> wrote: > >> I get the following error when I execute this command, >> >> django-admin.py startproject mysite >> >> Error: >> django-admin.py not found. >> >> >> >> -- >> Prem >> 408-393-2545 >> >> -- >> 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. >> > > -- Prem 408-393-2545 >>> >>> >> >> >> -- >> Prem >> 408-393-2545 >> > > > > -- > Prem > 408-393-2545 > -- 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.py not found
Where do I type the following commands? Is it in the python shell? tar xzvf Django-1.3.tar.gz cd Django-1.3 sudo python setup.py install What does tar xzvf mean? On Tue, Aug 30, 2011 at 8:41 PM, Yves S. Garret wrote: > Where do you have Python installed? > > I just followed these steps to install Django, worked like a charm (no > special setup or anything.) I did this just for the fun of it without any > production settings (just to try stuff out), did you do something different? > > https://docs.djangoproject.com/en/dev/intro/install/ > > > On Tue, Aug 30, 2011 at 8:36 PM, PremAnand Lakshmanan > wrote: > >> This is steps I used to download. >> >> 1. Download from the Django website. >> 2. Unzipped it to C:/Django-1.3 folder >> >> On Tue, Aug 30, 2011 at 8:31 PM, PremAnand Lakshmanan > > wrote: >> >>> I dont see any file under site packages. I think my Django is not >>> installed within Python. >>> >>> Something is wrong.. >>> >>> On Tue, Aug 30, 2011 at 8:28 PM, Yves S. Garret < >>> yoursurrogate...@gmail.com> wrote: >>> Do me a favor and check that you have >>> install>\Lib\site-packages\django\bin\django-admin.py If you do, try that. I don't think I have a C:\django-1.3\... directory, could be an issue with how you installed it (I didn't experiment, there was no need). On Tue, Aug 30, 2011 at 8:18 PM, PremAnand Lakshmanan < prem1...@gmail.com> wrote: > My django-admin.py file is located in > > C:\django-1.3\django\bin\django-admin.py > > I tried executing this command but get the following error in my python > shell, > > >>> python C:\django-1.3\django\bin\django-admin.py startproject mysite > SyntaxError: invalid syntax > > > > > On Tue, Aug 30, 2011 at 11:28 AM, Yves S. Garret < > yoursurrogate...@gmail.com> wrote: > >> What OS are you running? Is it in your path? >> >> I'm having a similar issue and managed to get around it (although the >> solution is not as elegant as I'd like) using this: >> python C:\Python27\Lib\site-packages\django\bin\django-admin.py >> startproject mysite2 >> >> On Tue, Aug 30, 2011 at 10:39 AM, PremAnand Lakshmanan < >> prem1...@gmail.com> wrote: >> >>> I get the following error when I execute this command, >>> >>> django-admin.py startproject mysite >>> >>> Error: >>> django-admin.py not found. >>> >>> >>> >>> -- >>> Prem >>> 408-393-2545 >>> >>> -- >>> 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. >>> >> >> > > > -- > Prem > 408-393-2545 > >>> >>> >>> -- >>> Prem >>> 408-393-2545 >>> >> >> >> >> -- >> Prem >> 408-393-2545 >> > > -- Prem 408-393-2545 -- 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.py not found
No. Here is a more lengthy explanation as to what you need to do: https://docs.djangoproject.com/en/dev/topics/install/#installing-official-release On Tue, Aug 30, 2011 at 8:46 PM, PremAnand Lakshmanan wrote: > Where do I type the following commands? Is it in the python shell? > > tar xzvf Django-1.3.tar.gz > cd Django-1.3 > sudo python setup.py install > > What does tar xzvf mean? > > On Tue, Aug 30, 2011 at 8:41 PM, Yves S. Garret < > yoursurrogate...@gmail.com> wrote: > >> Where do you have Python installed? >> >> I just followed these steps to install Django, worked like a charm (no >> special setup or anything.) I did this just for the fun of it without any >> production settings (just to try stuff out), did you do something different? >> >> https://docs.djangoproject.com/en/dev/intro/install/ >> >> >> On Tue, Aug 30, 2011 at 8:36 PM, PremAnand Lakshmanan > > wrote: >> >>> This is steps I used to download. >>> >>> 1. Download from the Django website. >>> 2. Unzipped it to C:/Django-1.3 folder >>> >>> On Tue, Aug 30, 2011 at 8:31 PM, PremAnand Lakshmanan < >>> prem1...@gmail.com> wrote: >>> I dont see any file under site packages. I think my Django is not installed within Python. Something is wrong.. On Tue, Aug 30, 2011 at 8:28 PM, Yves S. Garret < yoursurrogate...@gmail.com> wrote: > Do me a favor and check that you have install>\Lib\site-packages\django\bin\django-admin.py > > If you do, try that. I don't think I have a C:\django-1.3\... > directory, could be an issue with how you installed it (I didn't > experiment, > there was no need). > > > On Tue, Aug 30, 2011 at 8:18 PM, PremAnand Lakshmanan < > prem1...@gmail.com> wrote: > >> My django-admin.py file is located in >> >> C:\django-1.3\django\bin\django-admin.py >> >> I tried executing this command but get the following error in my >> python shell, >> >> >>> python C:\django-1.3\django\bin\django-admin.py startproject >> mysite >> SyntaxError: invalid syntax >> >> >> >> >> On Tue, Aug 30, 2011 at 11:28 AM, Yves S. Garret < >> yoursurrogate...@gmail.com> wrote: >> >>> What OS are you running? Is it in your path? >>> >>> I'm having a similar issue and managed to get around it (although the >>> solution is not as elegant as I'd like) using this: >>> python C:\Python27\Lib\site-packages\django\bin\django-admin.py >>> startproject mysite2 >>> >>> On Tue, Aug 30, 2011 at 10:39 AM, PremAnand Lakshmanan < >>> prem1...@gmail.com> wrote: >>> I get the following error when I execute this command, django-admin.py startproject mysite Error: django-admin.py not found. -- Prem 408-393-2545 -- 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. >>> >>> >> >> >> -- >> Prem >> 408-393-2545 >> > > -- Prem 408-393-2545 >>> >>> >>> >>> -- >>> Prem >>> 408-393-2545 >>> >> >> > > > -- > Prem > 408-393-2545 > -- 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.py not found
What do you mean it gets opened? Also, I'd recommend doing this in a temp My Documents (Documents in Vista/Windows 7) folder, let the installers build the necessary directory trees (get rid of the previous installs.) On Tue, Aug 30, 2011 at 9:52 PM, PremAnand Lakshmanan wrote: > I downloaded as mentioned and when I try this command the file setup.py > gets opened. > > C:\Django\Django-1.3>setup.py install > > On Tue, Aug 30, 2011 at 8:49 PM, Yves S. Garret < > yoursurrogate...@gmail.com> wrote: > >> No. Here is a more lengthy explanation as to what you need to do: >> >> >> https://docs.djangoproject.com/en/dev/topics/install/#installing-official-release >> >> >> On Tue, Aug 30, 2011 at 8:46 PM, PremAnand Lakshmanan > > wrote: >> >>> Where do I type the following commands? Is it in the python shell? >>> >>> tar xzvf Django-1.3.tar.gz >>> cd Django-1.3 >>> sudo python setup.py install >>> >>> What does tar xzvf mean? >>> >>> On Tue, Aug 30, 2011 at 8:41 PM, Yves S. Garret < >>> yoursurrogate...@gmail.com> wrote: >>> Where do you have Python installed? I just followed these steps to install Django, worked like a charm (no special setup or anything.) I did this just for the fun of it without any production settings (just to try stuff out), did you do something different? https://docs.djangoproject.com/en/dev/intro/install/ On Tue, Aug 30, 2011 at 8:36 PM, PremAnand Lakshmanan < prem1...@gmail.com> wrote: > This is steps I used to download. > > 1. Download from the Django website. > 2. Unzipped it to C:/Django-1.3 folder > > On Tue, Aug 30, 2011 at 8:31 PM, PremAnand Lakshmanan < > prem1...@gmail.com> wrote: > >> I dont see any file under site packages. I think my Django is not >> installed within Python. >> >> Something is wrong.. >> >> On Tue, Aug 30, 2011 at 8:28 PM, Yves S. Garret < >> yoursurrogate...@gmail.com> wrote: >> >>> Do me a favor and check that you have >> install>\Lib\site-packages\django\bin\django-admin.py >>> >>> If you do, try that. I don't think I have a C:\django-1.3\... >>> directory, could be an issue with how you installed it (I didn't >>> experiment, >>> there was no need). >>> >>> >>> On Tue, Aug 30, 2011 at 8:18 PM, PremAnand Lakshmanan < >>> prem1...@gmail.com> wrote: >>> My django-admin.py file is located in C:\django-1.3\django\bin\django-admin.py I tried executing this command but get the following error in my python shell, >>> python C:\django-1.3\django\bin\django-admin.py startproject mysite SyntaxError: invalid syntax On Tue, Aug 30, 2011 at 11:28 AM, Yves S. Garret < yoursurrogate...@gmail.com> wrote: > What OS are you running? Is it in your path? > > I'm having a similar issue and managed to get around it (although > the solution is not as elegant as I'd like) using this: > python C:\Python27\Lib\site-packages\django\bin\django-admin.py > startproject mysite2 > > On Tue, Aug 30, 2011 at 10:39 AM, PremAnand Lakshmanan < > prem1...@gmail.com> wrote: > >> I get the following error when I execute this command, >> >> django-admin.py startproject mysite >> >> Error: >> django-admin.py not found. >> >> >> >> -- >> Prem >> 408-393-2545 >> >> -- >> 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. >> > > -- Prem 408-393-2545 >>> >>> >> >> >> -- >> Prem >> 408-393-2545 >> > > > > -- > Prem > 408-393-2545 > >>> >>> >>> -- >>> Prem >>> 408-393-2545 >>> >> >> > > > -- > Prem > 408-393-2545 > -- 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.py not found
The setup.py just gets opened as a text file. But you can ignore it now, Django got installed once I used this command, python setup.py install instead of setup.py install Thanks for your great support. On Tue, Aug 30, 2011 at 9:58 PM, Yves S. Garret wrote: > What do you mean it gets opened? Also, I'd recommend doing this in a temp > My Documents (Documents in Vista/Windows 7) folder, let the installers build > the necessary directory trees (get rid of the previous installs.) > > > On Tue, Aug 30, 2011 at 9:52 PM, PremAnand Lakshmanan > wrote: > >> I downloaded as mentioned and when I try this command the file setup.py >> gets opened. >> >> C:\Django\Django-1.3>setup.py install >> >> On Tue, Aug 30, 2011 at 8:49 PM, Yves S. Garret < >> yoursurrogate...@gmail.com> wrote: >> >>> No. Here is a more lengthy explanation as to what you need to do: >>> >>> >>> https://docs.djangoproject.com/en/dev/topics/install/#installing-official-release >>> >>> >>> On Tue, Aug 30, 2011 at 8:46 PM, PremAnand Lakshmanan < >>> prem1...@gmail.com> wrote: >>> Where do I type the following commands? Is it in the python shell? tar xzvf Django-1.3.tar.gz cd Django-1.3 sudo python setup.py install What does tar xzvf mean? On Tue, Aug 30, 2011 at 8:41 PM, Yves S. Garret < yoursurrogate...@gmail.com> wrote: > Where do you have Python installed? > > I just followed these steps to install Django, worked like a charm (no > special setup or anything.) I did this just for the fun of it without any > production settings (just to try stuff out), did you do something > different? > > https://docs.djangoproject.com/en/dev/intro/install/ > > > On Tue, Aug 30, 2011 at 8:36 PM, PremAnand Lakshmanan < > prem1...@gmail.com> wrote: > >> This is steps I used to download. >> >> 1. Download from the Django website. >> 2. Unzipped it to C:/Django-1.3 folder >> >> On Tue, Aug 30, 2011 at 8:31 PM, PremAnand Lakshmanan < >> prem1...@gmail.com> wrote: >> >>> I dont see any file under site packages. I think my Django is not >>> installed within Python. >>> >>> Something is wrong.. >>> >>> On Tue, Aug 30, 2011 at 8:28 PM, Yves S. Garret < >>> yoursurrogate...@gmail.com> wrote: >>> Do me a favor and check that you have >>> install>\Lib\site-packages\django\bin\django-admin.py If you do, try that. I don't think I have a C:\django-1.3\... directory, could be an issue with how you installed it (I didn't experiment, there was no need). On Tue, Aug 30, 2011 at 8:18 PM, PremAnand Lakshmanan < prem1...@gmail.com> wrote: > My django-admin.py file is located in > > C:\django-1.3\django\bin\django-admin.py > > I tried executing this command but get the following error in my > python shell, > > >>> python C:\django-1.3\django\bin\django-admin.py startproject > mysite > SyntaxError: invalid syntax > > > > > On Tue, Aug 30, 2011 at 11:28 AM, Yves S. Garret < > yoursurrogate...@gmail.com> wrote: > >> What OS are you running? Is it in your path? >> >> I'm having a similar issue and managed to get around it (although >> the solution is not as elegant as I'd like) using this: >> python C:\Python27\Lib\site-packages\django\bin\django-admin.py >> startproject mysite2 >> >> On Tue, Aug 30, 2011 at 10:39 AM, PremAnand Lakshmanan < >> prem1...@gmail.com> wrote: >> >>> I get the following error when I execute this command, >>> >>> django-admin.py startproject mysite >>> >>> Error: >>> django-admin.py not found. >>> >>> >>> >>> -- >>> Prem >>> 408-393-2545 >>> >>> -- >>> 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. >>> >> >> > > > -- > Prem > 408-393-2545 > >>> >>> >>> -- >>> Prem >>> 408-393-2545 >>> >> >> >> >> -- >> Prem >> 408-393-2545 >> > > -- Prem 408-393-2545 >>> >>> >> >> >> -- >> Prem >> 408-393-2545 >> > > -- Prem 408-393-2545 -- You received this message because you are subscribed to the Google Groups "Dj
Password Field Not being encrypted
Hey guys, I'm trying to make a custom registration form for a custom UserProfile class. I have the following form: class UserForm(ModelForm): username = forms.EmailField(label = _("Email"), widget = forms.TextInput(attrs ={ 'id':'email'}), required=True) first_name = forms.CharField(widget = forms.TextInput(attrs = {'id':'fname'}), required=True) last_name = forms.CharField(widget = forms.TextInput(attrs = {'id':'lname'}), required=True) linked_id = forms.CharField(widget = forms.HiddenInput(attrs = {'id':'linkedid'})) password = forms.CharField(label=_('Password'), widget=forms.PasswordInput(render_value = False), required = True) password2 = forms.CharField(label=_('Re-Enter your password'), widget = forms.PasswordInput(render_value = False)) email = forms.CharField(widget = forms.HiddenInput(), required = False) class Meta: model = UserProfile fields = ('username', 'first_name', 'last_name', 'linked_id', 'password', 'email', ) def clean_password2(self): password1 = self.cleaned_data.get("password", "") password2 = self.cleaned_data['password2'] if password1 != password2: raise forms.ValidationError(_("The passwords you entered did not match!")) return password2 def clean_email(self): email = self.cleaned_data['username'] return email The issue that I'm having is that when the password is entered, and saved, its not being encrypted. So I can just view a users password in my admin panel... How do I get the passwords to be encrypted? I had another website and it worked then, but when I'm trying it now, it just isn't working. Help please. Thank you. -- 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: Password Field Not being encrypted
Raj, PasswordInput deals with browser forms to make sure that a password can't be seen in the form by someone looking over user's shoulder. But it does nothing to encrypt passwords in database. Why don't you check out django.contrib.auth.models for inspiration about encrypting passwords if plan on doing it yourself and not reusing the standard auth framework? Cheers Jirka -- 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: Combining queries? A "join" in Python?
On Aug 30, 11:48 pm, Andre Terra wrote: > FWIW, I'm using django-mptt to help me traverse my tree of self-referencing > models, as well as run complex aggregates based on them. > > http://django-mptt.github.com/django-mptt/index.html > > Be aware that the API has changed a lot from 0.3 (which is easily found > around the web) to 0.5 (which will require some more googling or cloning for > a specific commit from github). The key advantage of using this library is > that it takes care of adding (and handling) a tree_id column for your > MPTTModels, which you can then use to filter aggregates and the like. So do > check it out! > > As an anedoctal aside, In my use case I have AccountGroup, Account and > Entry, and my problem could only be solved through a HUMONGOUS query (62 > lines total) that returns the aggregate sum for Entries for a given > AccountGroup for a given month, including subtotals for each level of the > AccountGroup and each Account. So be ready to sharpen up on your SQL skills > if you're looking for something similar! My needs are not as complex as yours: although I think I will need to drop down to SQL if I ever need to optimise this. What I am am doing (in Python) is effectively annotating the related model with the result of a query: each Category the template gets has data from the natching CategoryText added to it as attributes. As this does not make sense to anyone who has lost track of the models mentioned earlier, the structure is SubCategoryText -> SubCategory -> Category <- CategoryText where -> means "has a foreign key on" and a *Text contains a translation. > > Cheers, > AT > > > > > > > > On Tue, Aug 30, 2011 at 2:10 PM, graeme wrote: > > > On Aug 30, 7:25 pm, Stuart wrote: > > > On Aug 30, 3:10 am, graeme wrote: > > > > > I think I need to restate this question with the actual models. > > > > Apologies in advance for answering a question you didn't ask, but is > > > your subcategory model truly representing something different from > > > your category model? I think the problems you are having with the > > > query may be indicative of a problem with your model definitions / > > > database layout. > > > > Unless I have the wrong idea about what you are trying to accomplish, > > > I recommend a single Category model with a parent field defined as a > > > back-reference to itself. Something like this: > > > > parent = models.ForeignKey('self', blank=True, null=True, > > > related_name='child') > > > > This approach would eliminate the SubCategory and SubCategoryText > > > models. The CategoryText looks about right as it is. > > > > I'm not clear on precisely what you are trying to accomplish with your > > > query, but perhaps rethinking your models will make the query easier. > > > I must admit I never thought of structuring the database like that. I > > had to think about it quite a bit. > > > What my query does is give me a list of subcategories, ordered by > > category, and then by the number of places in the category, and > > annotates each subcategory with the number of places in it. > > > Having a single category model might simplify the query, but as I want > > the page to show something like: > > > CATEGORY > > Subcategory One > > Subcategory Two > > CATEGORY TWO > > Subcategory Three > > etc. > > > I am still going to have to, at least, join the category table to > > itself, instead of joining the subcategory table to the category > > table. I have not yet figured out if this will give me easier access > > to the CategoryText of a parent category (in that case it may simplify > > things a lot). > > > If I am iterating over subcategories (which will now just be those > > categories without a parent), will I have easier access to the > > CategoryText of the parent. > > > The disadvantage is that the current structure enforces, at the > > database level, that Places can only belong to a sub-category, and > > that the hierarchy is only two levels deep. I would have to move some > > validation out of the database if I did this. > > > My current approach, or adding the necessary attributes in Python > > works. It does help, as I just found out, that I can add attributes to > > the Categories while looping over SubCategoryTexts (i.e. > > subcategorytextobject.subcategory.category.foo = bar works). It is > > still an ugly hack, though. > > > > Hope that helps, > > > > --Stuart > > > -- > > 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. -- 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 dja
Django and Cherokee...
Hi all, I'm having some trouble getting Cherokee to work with Django, and I noticed there are a number of Cherokee, Django users out there. I've posted questions on the Cherokee list, but there are some Django specific questions I have. My project is called triagedb. It resides in the directory /var/www/NurseTriage/triagedb. In Cherokee I have a vServer for the NurseTriage directory in the physical file system (/var/www/NurseTriage). There is an index.html file in this directory and it is served normally. Within this vServer, I have a rule with web directory of /triagedb (physical directory is /var/www/NurseTriage/triagedb), and only accepts requests from port 443 (required for this app). This rule's handler is set to SCGI with the usual settings as configured by the Django wizard. It uses an information source called Django 11. This is the interpreter line for that source: python /var/www/NurseTriage/triagedb/manage.py runfcgi protocol=scgi host=127.0.0.1 port=44945 After browsing to https://localhost/NurseTriage/triagedb/admin, I notice there is no instance of manage.py running. Do I need to launch the above command in init.d, or will Cherokee do it? Also, when I run the above command manually from the command prompt, I get 6 distinct processes running all on the same port. Is this normal? Finally, I'm getting the following error in the Cherokee error log every time I hit the url for Django app: {'type': "error", 'time': "29/08/2011 01:22:34.324", 'title': "epoll_ctl: ep_fd 19, fd 5: 'Bad file descriptor'", 'code': "fdpoll-epoll.c:140", 'error': "81", 'description': "The issue seems to be related to your system.", 'version': "1.0.14", 'compilation_date': "Dec 13 2010 21:49:35", 'configure_args': " '--host=x86_64-linux-gnu' '--build=x86_64-linux-gnu' '--enable-os-string=Ubuntu' '--enable-pthreads' '--prefix=/usr' '--localstatedir=/var' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--docdir=/usr/share/doc/cherokee-doc' '--with-wwwroot=/var/www' '--with-included-gettext' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-Wall -g -O2' 'LDFLAGS=-Wl,-Bsymbolic-functions' 'CPPFLAGS=' '--host=x86_64-linux-gnu' '--build=x86_64-linux-gnu' '--enable-os-string=Ubuntu' '--enable-pthreads' '--prefix=/usr' '--localstatedir=/var' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--docdir=/usr/share/doc/cherokee-doc' '--with-wwwroot=/var/www' '--with-included-gettext' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-Wall -g -O2' 'LDFLAGS=-Wl,-Bsymbolic-functions' 'CPPFLAGS='", 'backtrace': ""} This suggests a permissions problem to me. What should the file owners and permissions be on the Django files? Root, or only something readable by root? Thanx in advance, Brian -- 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.