This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class DocumentoAdmin(admin.ModelAdmin): | |
| search_fields = ('asunto__nom_asunto','remitente__mom_pernat') | |
| raw_id_fields = ('remitente',) | |
| valid_lookups = ('asunto') | |
| def get_list_display(self, request): | |
| if request.user.is_admin: | |
| list_display = ('remitente','area','tipodoc','asunto','estado','ver_seguimiento','ver_historial','archivo') | |
| return list_display | |
| else: | |
| list_display = ('asunto',) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (18:11:26) erre: http://www.youtube.com/watch?v=MG2fSeis30E | |
| (18:13:37) erre: http://www.youtube.com/watch?NR=1&feature=endscreen&v=TODDnIqlxi0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def docx(request): | |
| response = HttpResponse(content_type="application/vnd.openxmlformats-officedocument.wordprocessingml.document") | |
| response['Content-Disposition'] = 'attachment; filename="archivo.docx"' | |
| html_content = "Informacion recibida de <br><br><br>***Mensaje****<br><br>" | |
| msg = EmailMessage('Correo de Contacto', html_content, '[email protected]', [to_admin]) | |
| file_ = open('archivo.docx', 'r+') | |
| msg.attach('archivo.docx', file_.read(), 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') | |
| msg.send() | |
| return response |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tweepy, tweepy.api | |
| key="tukey" | |
| sec = "tuconsumersecret" | |
| tok= "tutoken" | |
| toks = "tutokensecreto" | |
| auth = tweepy.OAuthHandler(key, sec) | |
| auth.set_access_token(tok, toks) | |
| api = tweepy.API(auth) | |
| pub = api.home_timeline()[:3] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from managers import TicketManager | |
| class Ticket(models.Model): | |
| empresa = models.CharField() | |
| folio = models.CharField() | |
| objects = TicketManager() | |
| ################################################ managers.py | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def time24hr(tstr): | |
| x=tstr[-2:] | |
| y=tstr.split(':') | |
| z=y[0] | |
| global v | |
| v=y[1] | |
| global b | |
| global c | |
| global total | |
| if x== "am": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).ajaxSend(function(event, xhr, settings) { | |
| function getCookie(name) { | |
| var cookieValue = null; | |
| if (document.cookie && document.cookie !== '') { | |
| var cookies = document.cookie.split(';'); | |
| for (var i = 0; i < cookies.length; i++) { | |
| var cookie = jQuery.trim(cookies[i]); | |
| // Does this cookie string begin with the name we want? | |
| if (cookie.substring(0, name.length + 1) == (name + '=')) { | |
| cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).ajaxSend(function(event, xhr, settings) { | |
| function getCookie(name) { | |
| var cookieValue = null; | |
| if (document.cookie && document.cookie !== '') { | |
| var cookies = document.cookie.split(';'); | |
| for (var i = 0; i < cookies.length; i++) { | |
| var cookie = jQuery.trim(cookies[i]); | |
| // Does this cookie string begin with the name we want? | |
| if (cookie.substring(0, name.length + 1) == (name + '=')) { | |
| cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| :+ | |
| {:app | |
| #{:lt.objs.clients.local/startup-with-local-client | |
| :lt.objs.sidebar.workspace/workspace.open-on-start | |
| :lt.objs.settings2/load-behaviors | |
| :lt.objs.settings2/load-keys | |
| :lt.objs.settings2/create-user-settings | |
| :lt.objs.proc/set-path-OSX | |
| :lt.objs.workspace/reconstitute-last-workspace |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.contrib import admin | |
| class MiAdmin(model.Admin): | |
| def get_queryset(self, request): | |
| qs = Model.objects.filter(usuario=request.user) ###NO PONGAS [0] porque si no dara error en al base de datos debido a que [0] devuelve un modelo no un queryset, por eso se llama get_queryset | |
| ordering = self.get_ordering(request) | |
| if ordering: | |
| qs = qs.order_by(*ordering) |