How to have two unicode methods in the models?
This is what I currently have- def __unicode__(self): return u'%s %s %s %s %s %s' % (self.first_name, self.last_name, self.course, self.lab, self.start_time, self.end_time) How do I add another unicode method so that it will return only first_name and last_name? I understand that unicode method is a constructor. So, is there an alternative for this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
How can I have two unicode methods?
In my models file, I have the following unicode method- def __unicode__(self): return u'%s %s %s %s %s %s' % (self.first_name, self.last_name, self.course, self.lab, self.start_time, self.end_time) How can I have another unicode method which will return only first_name and last_name? I understand unicode is a constructor. So is there any alternative for this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
I am having trouble using ajax with model form set.
EventsFormSet = modelformset_factory(Events, extra=0) if request.method == 'POST': formset = EventsFormSet(request.POST) if formset.is_valid(): formset.save(); return HttpResponseRedirect('/sucess/') else: formset = EventsFormSet(queryset=Events.objects.filter(date__day=current_day, date__month=current_month, date__year = current_year)) return render(request, template_name, {'formset': formset}) The above does not work. But this code works EventsFormSet = modelformset_factory(Events, extra=0) formset = EventsFormSet(queryset=Events.objects.filter(date__day=current_day, date__month=current_month, date__year = current_year)) return render(request, template_name, {'formset': formset}) This is my jquery $(document).ready(function() { $(".foo").click(function() { var day = $(this).text() day = day.substring(0, 2); $.post('/foo/',{day:day}, function(data) { $("aside").hide().html(data).fadeIn("4000"); window.scrollTo(0, 0); }); }); }); -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: A PHP framework with some Django features?
Even cake php framework does create db tables from models. The only thing is that you need to install a third party application. On Thursday, June 27, 2013 4:13:38 PM UTC-5, thoms wrote: > > Hello, > > I have a PHP background, and I'm learning Django. > Long story short: I love Django, but some things are really painful to do > (configuration, media/static content, etc.). > > That's why I want to know if there is a PHP framework that has some of > Django's really cool features: > - Automatically creates the SQL table from the model > - Automatically creates an admin > > Thanks for your help > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Add dynamically form to Formset
Can you explain a little more? On Thursday, June 27, 2013 11:22:14 AM UTC-5, Mário Idival wrote: > > Hello, > How you do for add more formset in form with Django 1.5? > > -- > Mário Idival > > *Twitter *: *@marioigd* > *Facebook*: *mario.idival* > *User Linux : **#554446* > Skype*: marioidival* > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: What is the best practice to learn Django 1.5?
The way I learned it was by reading the offical free django book. According to me, the tutorial app does not teach you lot of django. The first chapter 8 chapter of the book will give you a solid understanding. Hope that thelps. On Friday, June 28, 2013 2:35:17 AM UTC-5, subs...@gmail.com wrote: > > Hi all, > > I am very new to the world of Django and I have a couple questions > regarding "how to learn it?": > > My background is .NET development, mostly developing business logic tiers. > I am very fluent with OOP, HTML5, CSS, JavaScript and have an entry-level > knowledge of Python. Still, I have no knowledge of MVC (or MVT in this > case) nor Django, nor command-line in *nix systems. I am in need to build > quickly several web apps and due to the productivity gain in using Python > rather than C# / Java, I naturally took a look at Django. I would like to > thouroughly learn the framework and be able to bend it to my will as I > think I'm in here for the long haul (kinda fed up with the Microsoft stack > for development). > > I have a need to do things like provide a web-based interface where users > can find each other with criteria such as the geographical distance between > them, upload images and edit them online, provide natural language search > capabilities, etc... (just to highlight that I need to get to the level of > knowing more than building a basic polls app or a simple blog). > > As I understand, the entry point to learn Django is by completing the > tutorial. What then? What would you recommend? As I've seen, most of the > resources I can find online are outdated and target 1.4, would I still be > able to learn from those and not getting frustrated? Also, I'm working on > OS X and I have practically no knowledge of the command line. I glanced a > little at how to deploy a Django site to production and quickly got lost... > virtualenv, git, etc... No knowledge of that and looks a bit scary for a > guy used to deploy an app by copying the compiled build using FTP. > > So I'm asking you, experts... ...if you had to learn Django today, with no > prior knowledge of previous versions, what would be your learning path? > > Thank you for your time and looking forward to join what seems like a > really cool community! > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Get Form from string?
I am afraid, I did not understand your question. Are you trying to generate a form based on your model/ models? On Friday, June 28, 2013 3:23:00 PM UTC-5, MacVictor wrote: > > and how to get only Form (not ModelForm) use string name? > > W dniu piątek, 28 czerwca 2013 22:09:41 UTC+2 użytkownik MacVictor napisał: >> >> get the model by string i use: >> >> from django.db.models.loading import get_model >> def get_model(self, app_label, model_name, seed_cache=True): >> >> how to get ModelForm by string? >> >> i try used: >> >> modelforms = forms.ModelForm.__subclasses__() >> >> def get_form(form): >> try: >> for model_form in modelforms: >> try: >> if model_form.Meta.form == form: >> return model_form >> except AttributeError: >> continue >> except IndexError: >> print "Does not exist Model Forms for the object" >> >> but I must import the form in which I will seek appropriate by name! >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.